To pass long commands to BPXBATCH, use the STDPARM DD.
While it is possible to pass relatively long commands to BPXBATCH via the PARM parameter on the JCL EXEC statement by using JCL continuation rules, this method is still limited to 100 bytes.
A parameter file passed to BPXBATCH via STDPARM supports parameters (i.e the command) up to 64K in length. The parameter file can be a z/OS-Unix file, a traditional z/OS dataset, or in-stream in the JCL.
For example, place a long command (this sample command is 105 bytes):
SH ls -altr /listed_environments/cics/test/pickup/webs/test-portal-v01/src/assets/mixins | grep functions
into a z/OS-Unix file at /u/userid/stdparmfile
Then execute the command via BPXBATCH by utilizing STDPARM (PATHOPTS must be set to ORDONLY):
//USSCMD EXEC PGM=BPXBATCH
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDPARM DD PATH='/u/userid/stdparmfile',PATHOPTS=ORDONLY
/*
//
Or place the same command into a traditional z/OS dataset (with a sufficient LRECL). Ensure that sequence numbers are removed from the dataset by issuing UNNUM
and/or NUMBER OFF
while in ISPF EDIT. Then similarly submit through JCL:
//USSCMD EXEC PGM=BPXBATCH
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDPARM DD DISP=SHR,DSN=USERID.STDPARM.TEST
/*
//
In-stream submission on the STDPARM DD is a bit more restrictive, as a space character is assumed on each line-end. An in-stream command should be fine if it can be broken apart on space-char boundaries to fit within the 80-byte limit for JCL. The sample command we've used here would work like this:
//USSCMD EXEC PGM=BPXBATCH
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDPARM DD *
SH ls -altr
/listed_environments/cics/test/pickup/webs/test-portal-v01/src/assets/mixins
| grep functions
/*
//
But, a command that includes an uninterrupted string of text >80 bytes would likely present challenges for in-stream.
The z/OS 2.3 documentation for STDPARM can be found here:
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.bpxa400/batstdparm.htm