Page 1 of 2
from JCL to REXX
Posted:
Tue Sep 19, 2023 6:45 pm
by mehi1353
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
Re: from JCL to REXX
Posted:
Wed Sep 20, 2023 5:56 pm
by willy jensen
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.
Re: from JCL to REXX
Posted:
Thu Sep 21, 2023 9:30 pm
by sergeyken
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
.....
Re: from JCL to REXX
Posted:
Fri Sep 22, 2023 1:15 pm
by mehi1353
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
Re: from JCL to REXX
Posted:
Fri Sep 22, 2023 1:24 pm
by willy jensen
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.
Re: from JCL to REXX
Posted:
Fri Sep 22, 2023 4:55 pm
by willy jensen
Actually, I probably should have shown it as
as the 'parse' verb causes the string to be parsed as is, without uppercase translation.
Re: from JCL to REXX
Posted:
Fri Sep 22, 2023 5:55 pm
by sergeyken
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 1ARG LAUFNUMM ACCOUNT
SAY 'LAUFNUMM= 'LAUFNUMM
SAY 'ACCOUNT= 'ACCOUNT
LAUFNUMM= 1983
ACCOUNT= MEHRDAD RASTERGAR
Sample 2. Same without uppercase conversionPARSE ARG LAUFNUMM ACCOUNT
SAY 'LAUFNUMM= 'LAUFNUMM
SAY 'ACCOUNT= 'ACCOUNT
LAUFNUMM= 1983
ACCOUNT= Mehrdad Rastegar
Sample 3. Importance of a minor dot in PARSE statementPARSE ARG LAUFNUMM ACCOUNT .
SAY 'LAUFNUMM= 'LAUFNUMM
SAY 'ACCOUNT= 'ACCOUNT
LAUFNUMM= 1983
ACCOUNT= Mehrdad
Sample 4. Same with uppercase conversionARG 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 sensitiveParse Arg LAUFNUMM account
Say 'LAUFNUMM= 'LaufNumm
Say 'ACCOUNT= 'AcCoUnT
LAUFNUMM= 1983
ACCOUNT= Mehrdad Rastegar
Re: from JCL to REXX
Posted:
Fri Sep 22, 2023 6:08 pm
by sergeyken
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.
Re: from JCL to REXX
Posted:
Fri Sep 22, 2023 6:30 pm
by mehi1353
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
Re: from JCL to REXX
Posted:
Fri Sep 22, 2023 7:00 pm
by willy jensen
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!