Page 2 of 3

Re: CallinG REXX thru JCL

PostPosted: Tue Feb 14, 2017 7:03 pm
by willy jensen
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.

Re: CallinG REXX thru JCL

PostPosted: Wed Feb 15, 2017 8:30 pm
by arya_starc
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.

Re: CallinG REXX thru JCL

PostPosted: Wed Feb 15, 2017 8:34 pm
by willy jensen
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.

Re: CallinG REXX thru JCL

PostPosted: Wed Feb 15, 2017 10:33 pm
by Pedro
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.

Re: CallinG REXX thru JCL

PostPosted: Thu Feb 16, 2017 1:07 pm
by arya_starc
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.

Re: CallinG REXX thru JCL

PostPosted: Thu Feb 16, 2017 2:12 pm
by willy jensen
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).

Re: CallinG REXX thru JCL

PostPosted: Thu Feb 16, 2017 6:32 pm
by arya_starc
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                                

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

Re: CallinG REXX thru JCL

PostPosted: Thu Feb 16, 2017 7:21 pm
by willy jensen
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.

Re: CallinG REXX thru JCL

PostPosted: Thu Feb 16, 2017 8:51 pm
by NicC
You should also provide your trace output.

Re: CallinG REXX thru JCL

PostPosted: Thu Feb 16, 2017 9:59 pm
by arya_starc
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.