CallinG REXX thru JCL



IBM's Command List programming language & Restructured Extended Executor

Re: CallinG REXX thru JCL

Postby willy jensen » Tue Feb 14, 2017 7:03 pm

Hi arya_starc,
you left out the percentage sign in the parm field: PARM='%LISTDS'. Without that, TSO executes the program LISTDS, not your REXX, as I explained earlier.
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: CallinG REXX thru JCL

Postby arya_starc » Wed Feb 15, 2017 8:30 pm

thanks a lot Willy.
One more question, if i need to pass more than one dataset then same syntax will be used or different?

Since, that dataset I am allocating in the rexx but I need to pass that datset thru JCL.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: CallinG REXX thru JCL

Postby willy jensen » Wed Feb 15, 2017 8:34 pm

the combination
cc=Listdsi('ddname FILE')
dsn="'"sysdsname"'"
can be used any number of times. I strongly suggest that you look up the LISTDSI function in the REXX manual for details.
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: CallinG REXX thru JCL

Postby Pedro » Wed Feb 15, 2017 10:33 pm

Since, that dataset I am allocating in the rexx...


You probably meant something else, but your rexx sample did not do any 'allocate's. Your JCL has already allocated the data set.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: CallinG REXX thru JCL

Postby arya_starc » Thu Feb 16, 2017 1:07 pm

As I am used two dataset in rexx and oth dataset I am calling via JCL by using cc=Listdsi('ddname FILE') combination.
But mine JCL is executed with MAX CC 0 but I am not getting the data population in the output file.
below is my rexx code

000100 /*REXX*/                                                                
 000200 ADDRESS TSO                                                            
 000300  CC = Listdsi('FILEI FILE')                                            
 000400  CC = Listdsi('FILEO FILE')                                            
 000500  FILEI="'"SYSDSNAME"'"                                                  
 000600  FILEO="'"SYSDSNAME"'"                                                  
 000700  SAY HI                                                                
 000800  SAY FILEI                                                              
 000900     "LISTDS" FILEI "MEMBERS"                                            
 001000  WRT = 1                                                                
 001100  X = OUTTRAP(MEMBERS.)                                                  
 001200  "LISTDS" FILEI "MEMBERS"                                              
 001300  X = OUTTRAP(OFF)                                                      
 001400  DO I=7 TO MEMBERS.0                                                    
 001500     X = STRIP(MEMBERS.I)                                                
 001600     FILEO.WRT = X                                                      
 001700     WRT = WRT + 1                                                      
 001800  END                                                                    

001900  WRT = WRT - 1                                                          
 002000     OUT.0 = WRT                                                        
 002100     FILEO = OUT.0                                                      
 002200  OU1 = fileo                                                            
 002300   "EXECIO "OUT.0" DISKW OU (STEM OUT. FINIS"                            
 002400   "FREE F(OU)"                                                          
 002500  SAY "MEMBERS SUCCESSFULLY WRITE"                                      
 002600  EXIT                                      
 

This rexx taking input pds member and copy all the member into one sequential dataset.
Note:- The pds dataset and sequential dataset I am passing thru the JCL.
Below is the JCL

****** ***************************** Top of Data ******************************
 000001 //PAFKREX2 JOB (0000,REXX),'DEV11',CLASS=Y,MSGCLASS=A,                  
 000002 // USER=PAFK                                                            
 000003 //STEP30 EXEC PGM=IKJEFT01,PARM='%GETMEM1'                              
 000004 //SYSEXEC DD DSN=TS.PAFK.SUSHIL.PDS,DISP=SHR                            
 000005 //FILEI   DD DSN=VM.LAT.D10A010.PF.JCLLIB.SASH,DISP=SHR                
 000006 //FILEO   DD DSN=VM.LAT.D10A.PF.V10.JOB.SE.SASH8,DISP=SHR              
 000007 //SYSPRINT DD SYSOUT=*                                                  
 000008 //SYSTSPRT DD SYSOUT=*                                                  
 000009 //SYSTSIN  DD DUMMY                                

**************************************************************************          
 


iN MY JCL EXECUTION IT TREATED BOTH FILEI AND FILE O as 'VM.LAT.D10A.PF.V10.JOB.SE.SASH8' dataset.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: CallinG REXX thru JCL

Postby willy jensen » Thu Feb 16, 2017 2:12 pm

Please read the documentation for the LISTDSI function. Each call to LISTDSI sets the SYSDSNAME variable, so you must assign that to another variable before using LISTDSI again. Also you should check the success of the LISTDSI function (in my sample the 'cc' variable).
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: CallinG REXX thru JCL

Postby arya_starc » Thu Feb 16, 2017 6:32 pm

Hi Willy,

Thanks for guiding.
Now first I assign the cc variable to DSN then I use another Listdsi function.
But now I am getting issue in populating the dataset.
Below is my rexx code

000100 /*REXX*/                                                                
 000200 ADDRESS TSO                                                            
 000300  CC = Listdsi('FILEI FILE')                                            
 000500  FILEI="'"SYSDSNAME"'"                                                  
 000510  CC1 = Listdsi('FILEO FILE')                                            
 000600  FILEO="'"SYSDSNAME"'"                                                  
 001000  WRT = 1                                                                
 001100  X = OUTTRAP(MEMBERS.)                                                  
 001200  "LISTDS" FILEI "MEMBERS"                                              
 001300  X = OUTTRAP(OFF)                                                      
 001400  DO I=7 TO MEMBERS.0                                                    
 001500     X = STRIP(MEMBERS.I)                                                
 001510     SAY X                                                              
 001600     OUT.WRT = X                                                        
 001610     SAY OUT.WRT                                                        

001700     WRT = WRT + 1                                                      
 001800  END                                                                    
 001900  WRT = WRT - 1                                                          
 002000     OUT.0 = WRT                                                        
 002100     FILEO = OUT.0                                                      
 002110      DISKW OU STEM OUT. FINIS                                          
 002500  SAY "MEMBERS SUCCESSFULLY WRITE"                                      
 002600  EXIT                                                                  
 ****** **************************** Bottom of Data *******************
 


On executing the above rexx code, JCL is executed with max cc 0.
But in the dataset nothing data is populated.

Below is the JCL


****** ***************************** Top of Data ******************************
 000001 //PAFKREX2 JOB (0000,REXX),'DEV11',CLASS=Y,MSGCLASS=A,                  
 000002 // USER=PAFK                                                            
 000003 //STEP30 EXEC PGM=IKJEFT01,PARM='%GETMEM1'                              
 000004 //SYSEXEC DD DSN=TS.PAFK.SUSHIL.PDS,DISP=SHR                            
 000005 //FILEI   DD DSN=VM.LAT.D10A010.PF.JCLLIB.SASH,DISP=SHR                
 000006 //FILEO   DD DSN=VM.LAT.D10A.PF.V10.JOB.SE.SASH8,DISP=SHR              
 000007 //SYSPRINT DD SYSOUT=*                                                  
 000008 //SYSTSPRT DD SYSOUT=*                                                  
 000009 //SYSTSIN  DD DUMMY                                

**************************************************************************          
 
 
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: CallinG REXX thru JCL

Postby willy jensen » Thu Feb 16, 2017 7:21 pm

You are not doing anything with the sysdsname for FILEO. As I read your program, you want to write the list on members in ddname FILEI to ddname FILEO and for that you don't need the FILEO sysdsname. You don't see anything in FILEO, because the statement 'DISKW OU STEM OUT. FINIS' is missing the EXECIO command at the front. Apart from that, the syntax is wrong, please refer to the manual for details of EXECIO.
And you really should check return codes, i.e. from EXECIO, before you put out a 'success' message.

These users thanked the author willy jensen for the post:
arya_starc (Thu Feb 16, 2017 9:59 pm)
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: CallinG REXX thru JCL

Postby NicC » Thu Feb 16, 2017 8:51 pm

You should also provide your trace output.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: CallinG REXX thru JCL

Postby arya_starc » Thu Feb 16, 2017 9:59 pm

Thanks Willy, I got the desired output by using correct syntax.
willy jensen wrote:And you really should check return codes, i.e. from EXECIO, before you put out a 'success' message.

How can i check return code before any line.This i didn't get, could you please tell me more.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

PreviousNext

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post