Using a long TSO command from batch is easy

I wanted to run a rexx exec with a long string of parameters from JCL, and had problems because the line was too long. One evening, I couldn’t fix it, but when I came back next day I fixed it in seconds.

Using the PARM statement and symbol substitution

// SET REP='-REPLACE '
// SET KEY='-KEY REXXDH '
// SET PR='-PRIVATE ECCB512Z '
// SET PU='-PUBLIC ECCB512PUB '
//S1 EXEC PGM=IKJEFT01,REGION=0M,PARM='GAESDH &PR &PU &KEY &REP'
//SYSEXEC DD DISP=SHR,DSN=COLIN.ICSF.REXX
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
/*

This worked fine as long as the length of the PARM was under 100 characters long, after substitution. it looks for GAESDH in //SYSEXEC

Using SYSTSIN

The TSO command reference says

When it is necessary to continue to the next line, use a plus (+) or minus (-) sign as the last character of the line you want to continue.

That worked

//S1 EXEC PGM=IKJEFT01,REGION=0M 
//SYSEXEC DD DISP=SHR,DSN=COLIN.ICSF.REXX 
//SYSPRINT DD SYSOUT=* 
//SYSTSPRT DD SYSOUT=* 
//SYSTSIN DD * 
EXEC 'COLIN.ICSF.REXX(GAESDH)' '-KEY REXXDH -PRIVATE RSA1 - 
-PUBLIC RSA2PUB -REPLACE ' 
// 

Ending it with a comma does not work! (After struggling yesterday, it took 10 seconds this morning to find this was my problem).

Using SYSTSIN and JCL overrides

I tried using the JCL variables, and substitute them in the SYSTSIN file.

//E1 EXPORT SYMLIST=*
// SET REP='-REPLACE '
// SET KEY='-KEY REXXDH '
// SET PR='-PRIVATE ECCB512Z '
// SET PU='-PUBLIC ECCB512PUB '
//S1 EXEC PGM=IKJEFT01,REGION=0M PARM='GAESDH &PR &PU &KEY &REP'
//SYSEXEC DD DISP=SHR,DSN=COLIN.ICSF.REXX
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD ,SYMBOLS=JCLONLY 
EXEC 'COLIN.ICSF.REXX(GAESDH)' ' &KEY &PR &PU &REP' 
/*

This gave me

IEC020I 001-4,IBMREXDH,S1 ,SYSTSIN ,JES

Because the line after substitution was greater than 80 bytes long.

Putting it all together

//E1 EXPORT SYMLIST=*
// SET REP='-REPLACE '
// SET KEY='-KEY REXXDH '
// SET PR='-PRIVATE ECCB512Z '
// SET PU='-PUBLIC ECCB512PUB '
//S1 EXEC PGM=IKJEFT01,REGION=0M 
//SYSEXEC DD DISP=SHR,DSN=COLIN.ICSF.REXX
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *,SYMBOLS=JCLONLY 
EXEC 'COLIN.ICSF.REXX(GAESDH)' '-KEY REXXDH - 
  &PR &PU - 
  &REP 
/*

This also worked. I find this a cleaner way of using JCL, for example I could have

//E1 EXPORT SYMLIST=*
// SET REP='-REPLACE '
// SET KEY='-KEY REXXDH '
// SET PR='-PRIVATE ECCB512Z '
//T1 SET PU='-PUBLIC TRY1 '
//T2  SET PU='-PUBLIC TRY2 '
// SET PU='-PUBLIC TRY3 '
// SET PU='-PUBLIC ECCB512PUB '
//S1 EXEC PGM=IKJEFT01,REGION=0M 
//SYSEXEC DD DISP=SHR,DSN=COLIN.ICSF.REXX
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *,SYMBOLS=JCLONLY 
EXEC 'COLIN.ICSF.REXX(GAESDH)' '-KEY REXXDH - 
  &PR &PU - 
  &REP 
/*

The last definition of a variable wins. I could move line T1 down and run the JCL, then move line T2 down and run the JCL.

It is then easy to “pick and mix” your variables.

JCL with long PARM strings

Thanks to Morag who pointed me to the MQGEM blog post. I can also use PARMSDD. For example

//E1 EXPORT SYMLIST=*
// SET REP='-REPLACE '
// SET KEY='-KEY REXXDH '
// SET PR='-PRIVATE ECCB512Z '
// SET PU='-PUBLIC ECCB512PUB '
//S1 EXEC PGM=IKJEFT01,REGION=0M,PARMDD=PARMS
//PARMS DD *,SYMBOLS=JCLONLY 
  GAESDH -KEY REXXDH 
  &PR &PU 
  &REP 
//SYSEXEC DD DISP=SHR,DSN=COLIN.ICSF.REXX
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY

This gives you a nice long parameter, with no quotes or continuation characters

One thought on “Using a long TSO command from batch is easy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s