from JCL to REXX



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

from JCL to REXX

Postby mehi1353 » Tue Sep 19, 2023 6:45 pm

Hi all,

I want to Define some parameters in a JCL "DD Statement" and then, pass them all to rexx program with IKJEFT01.

I mean something like this:

//INP EXEC PGM=IKJEFT01,PARM='KRKH &LAUF_NUMM &account' <========================== calling rexx
//STEPLIB DD DISP=SHR,DSN=SYS2.DB2.ALIAS.DSNP.SDSNEXIT
// DD DISP=SHR,DSN=SYS2.DB2.ALIAS.DSNP.SDSNLOAD
//SYSEXEC DD DISP=SHR,DSN=V990909.PROG.REXX
//SYSIN DD * <========================= sample parameters
LAUF_NUMM=1983
Account='Mehrdad Rastegar'
.....

It doesn't work. Anyone has a solution, that works fine? or maybe a Sample?

Thanks in advance

Mehrdad
mehi1353
 
Posts: 39
Joined: Sun Jan 11, 2009 4:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: from JCL to REXX

Postby willy jensen » Wed Sep 20, 2023 5:56 pm

Sure, Address TSO "EXECIO * DISKR SYSIN (STEM TEXT. FINIS)" - or could you be more specific as to the requirements?
When you write 'it doesnt work', we really need details, and a code snippet of what you have tried already, otherwise it will be pure guesswork from any responder.

These users thanked the author willy jensen for the post:
vasanthz (Wed Sep 20, 2023 10:25 pm)
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: from JCL to REXX

Postby sergeyken » Thu Sep 21, 2023 9:30 pm

mehi1353 wrote:Hi all,

I want to Define some parameters in a JCL "DD Statement" and then, pass them all to rexx program with IKJEFT01.

I mean something like this:

//INP EXEC PGM=IKJEFT01,PARM='KRKH &LAUF_NUMM &account'   <========================== calling REXX            
//STEPLIB  DD DISP=SHR,DSN=SYS2.DB2.ALIAS.DSNP.SDSNEXIT    
//         DD DISP=SHR,DSN=SYS2.DB2.ALIAS.DSNP.SDSNLOAD    
//SYSEXEC  DD DISP=SHR,DSN=V990909.PROG.REXX              
//SYSIN  DD *                     <========================= sample parameters                        
     LAUF_NUMM=1983        
     Account='Mehrdad Rastegar'
     .....


It doesn't work. Anyone has a solution, that works fine? or maybe a Sample?

Thanks in advance

Mehrdad


1. Learn how to use the Code button.

2. Change your code to
//*========================= sample parameters                        
// SET  LAUFNUMM=1983        
// SET  ACCOUNT='Mehrdad Rastegar'
//*
//INP      EXEC PGM=IKJEFT01,PARM='KRKH &LAUFNUMM &ACCOUNT'   <========================== calling rexx            
//STEPLIB  DD DISP=SHR,DSN=SYS2.DB2.ALIAS.DSNP.SDSNEXIT    
//         DD DISP=SHR,DSN=SYS2.DB2.ALIAS.DSNP.SDSNLOAD    
//SYSEXEC  DD DISP=SHR,DSN=V990909.PROG.REXX              
//SYSIN    DD DUMMY
     .....
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 408
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: from JCL to REXX

Postby mehi1353 » Fri Sep 22, 2023 1:15 pm

Hello Sergey,

Thanks a lot.
There is a little problem. I had executed your code. It works and passes the parameters to my Rexx Program, but it seems that it works 2 times!

In rexx, I have written:
ARG LAUFNUMM
SAY 'LAUFNUMM= 'LAUFNUMM
ARG ACCOUNT
SAY 'ACCIUNT= 'ACCOUNT

and in JCL output, I see:

LAUFNUMM= 1983 MEHRDAD RASTEGAR
ACCIUNT= 1983 MEHRDAD RASTEGAR

I don't undestand why?

Thanks a lot and all the best
mehi1353
 
Posts: 39
Joined: Sun Jan 11, 2009 4:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: from JCL to REXX

Postby willy jensen » Fri Sep 22, 2023 1:24 pm

Because the ARG statement takes the entire parameter string. You need to parse the string like so:
Parse arg LAUFNUMM ACCOUNT .
 
The trailing dot is to take up any slack (blanks etc).
Please read up on the PARSE statement.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: from JCL to REXX

Postby willy jensen » Fri Sep 22, 2023 4:55 pm

Actually, I probably should have shown it as
Arg LAUFNUMM ACCOUNT .

as the 'parse' verb causes the string to be parsed as is, without uppercase translation.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: from JCL to REXX

Postby sergeyken » Fri Sep 22, 2023 5:55 pm

mehi1353 wrote:Hello Sergey,

Thanks a lot.
There is a little problem. I had executed your code. It works and passes the parameters to my Rexx Program, but it seems that it works 2 times!

In rexx, I have written:
ARG LAUFNUMM              
SAY 'LAUFNUMM= 'LAUFNUMM  
ARG ACCOUNT              
SAY 'ACCIUNT=  'ACCOUNT  


and in JCL output, I see:

LAUFNUMM= 1983 MEHRDAD RASTEGAR  
ACCIUNT=  1983 MEHRDAD RASTEGAR  


I don't undestand why?

Thanks a lot and all the best


1. Learn how to use the Code button, please!!!

2. There are several issues. Just samples, without comments

Sample 1

ARG LAUFNUMM ACCOUNT            
SAY 'LAUFNUMM= 'LAUFNUMM  
SAY 'ACCOUNT= 'ACCOUNT  

LAUFNUMM= 1983        
ACCOUNT= MEHRDAD RASTERGAR  


Sample 2. Same without uppercase conversion

PARSE ARG LAUFNUMM ACCOUNT            
SAY 'LAUFNUMM= 'LAUFNUMM  
SAY 'ACCOUNT= 'ACCOUNT  

LAUFNUMM= 1983        
ACCOUNT= Mehrdad Rastegar  


Sample 3. Importance of a minor dot in PARSE statement

PARSE ARG LAUFNUMM ACCOUNT .          
SAY 'LAUFNUMM= 'LAUFNUMM  
SAY 'ACCOUNT= 'ACCOUNT  

LAUFNUMM= 1983        
ACCOUNT= Mehrdad 


Sample 4. Same with uppercase conversion
ARG is equivalent to PARSE UPPER ARG !!!

ARG LAUFNUMM ACCOUNT .          
SAY 'LAUFNUMM= 'LAUFNUMM  
SAY 'ACCOUNT= 'ACCOUNT  

LAUFNUMM= 1983        
ACCOUNT= MEHRDAD 


Sample 5. In REXX, keywords and variable names are not case sensitive

Parse Arg LAUFNUMM account            
Say 'LAUFNUMM= 'LaufNumm  
Say 'ACCOUNT= 'AcCoUnT  

LAUFNUMM= 1983        
ACCOUNT= Mehrdad Rastegar  
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 408
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: from JCL to REXX

Postby sergeyken » Fri Sep 22, 2023 6:08 pm

3. I recommend you to RTFM about PARSE statement options, and about REXX features in general.
I cannot repeat here the REXX guide in full.
And you should not ask the Forum about every and each specific option, especially about the basic ones.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 408
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: from JCL to REXX

Postby mehi1353 » Fri Sep 22, 2023 6:30 pm

Hello again,

it works fine, just when th first argument has not any Blanks.

When I for example use this entry:

// SET LAUFNUMM='MAY 1983'
// SET ACCOUNT='MEHRDAD RASTEGAR'

I receive this output:

LAUFNUMM= MAY
ACCOUNT= 1983 MEHRDAD RASTEGAR

In rexx, I had used: PARSE ARG LAUFNUMM ACCOUNT

Special Thanks,
and
All the best
mehi1353
 
Posts: 39
Joined: Sun Jan 11, 2009 4:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: from JCL to REXX

Postby willy jensen » Fri Sep 22, 2023 7:00 pm

You really really must read up on the PARSE statement!
Quick solution:
Change the JCL to PARM='KRKH &LAUFNUMM,&account' , note the comma.
Change the parse statement to: arg laufnum','account
And do read up on the PARSE statement!
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post