Make your own free website on Tripod.com
DocBag

Back Issue

Quotes & Blanks in JCL Symbolic Variables

Symbolic substitution in JCL can be a minefield when embedded blanks or quotes are involved. The JCL conversion process

Here is a relatively straight-forward example of how to deal with this situation. Say that you want to run SDSF in batch and limit the jobs selected to only those associated with the user who owns the batch job. Here is some JCL that you could use:

// SET QT='''' // SET CMD='OWNER ' // SET PRM=&QT.&CMD.&SYSUID.&QT //GETMSGS EXEC PGM=SDSF,DYNAMNBR=32,REGION=1024K,TIME=5, // PARM=&QT.&PRM.&QT //REPORT DD DISP=(,CATLG),DSN=&SYSUID..ABC.LIST, // SPACE=(CYL,(1,1)),RECFM=FB,LRECL=80,BLKSIZE=0 //ISFOUT DD SYSOUT=* //ISFIN DD * PRINT FILE REPORT ... more SDSF control statements ... &SYSUID is a standard JCL symbolic which contains the userid associated with the executing job. Refer to an earlier stupid trick for more information. The PARM string 'OWNER userid' tells SDSF to only look at jobs belonging to userid.

We construct the parm by combining constant strings (which may contain blanks) with symbolic variables and frame the resulting string using the symbolic variable &QT (one single quote) to glue it all together.

The symbolic variable PRM contains 'OWNER userid'; however, if you don't put the &QTs around it as in the sample above, you wind up with just PARM=OWNER being passed to SDSF.

Here is a more complex example. Caution-overexposure to this topic may cause discomfort:

//NESTED PROC LS=132, // PS=60 // SET QT='''' //SAUS EXEC SAUS, // OPTIONS='SYSPARM='''&QT.&LS-&PS.&QT'''' //SYSIN DD DISP=(OLD,DELETE),DSN=&&SASIN // PEND //RUNJCL EXEC NESTED The instream procedure NESTED invokes a catalogued procedure SAUS. The intent is to assign the value 'SYSPARM=''132-60''' to symbolic parameter OPTIONS. OPTIONS is appended to the execution parm in the invoked catalogued procedure, (which is contained within quotes), resulting in the value SYSPARM='132-60' being included in the run-time parms for program SAUS, once all the extra quotes have been stripped away. The values 132 and 60 are being used as default line size and page size values by the application. They can be modified in the JCL which makes use of the instream procedure.

Feedback

Comments or suggestions can be sent to the author.

Last Month's Topic

Big Iron