Can you suggest a way to code PCL to be conditional upon the contents of an entity?

Document ID : KB000055368
Last Modified Date : 14/02/2018
Show Technical Document Details

Yes.

Let's say that you want to flag an error if any JCL to move into a particular zone contains an IEFBR14 step, you could code the following:

//ASRSRCH  PROC
//*
// SET ENAME='&ASRRED.ENAME'<<F,L>>,
//     TFILE=1,
//     INSRC='&ASRRED.IS.DSN'<<F,L>>
//*
//CHKJOB   EXEC PGM=ISRSUPC,MAXCC=0,
//         PARM=(SRCHCMP,'ANYC')
//NEWDD    DD  DSN=&INSRC(&ENAME),DISP=SHR
//OUTDD    DD  SYSOUT=*
//SYSIN    DD  *,FORMAT=(,SUB)
SRCHFOR  'IEFBR14'
/*
//*
//STEP2    EXEC PGM=ZCBTCOPY,MAXCC=4,PARM='TFILE=1',
//         DDPARM=('SYSUT1','SYSUT2')
//SYSUT1   DD DSN=&&SOURCE,DISP=SHR
//SYSUT2   DD DSN=&ASRREF(TFILE).TF.DSN,DISP=SHR
//*
//*   ERROR CHECKING
// IF PCLEMODE = TRUE
//  ERROR 2,'JCL CHECK FAILED (SEE PRECEDING STEPS)'
// ENDIF

In the above example, step CHKJOB uses the standard ISPF SUPERC/SEARCH FOR program ISRSUPC to search for text "IEFBR14". If IEFBR14 is found then the CHKJOB step ends with a CC (condition code) of 1.

MAXCC=0 specifies the maximum acceptable return code for this EXEC command, in this case 0. If this return code is exceeded, the system variable PCLEMODE is set to TRUE.

Then the ERROR command is used to simulate command error action after this user-detected error. The action initiated by this command is identical to standard command error processing and the error text is written to the Alchemist log. This example produces a user error code 2. 700 is added to this code to create a command error code 702.

(Please refer to the Process Control Language (PCL) Guide) for addition details on any of the PCL commands.)

This Frequently Asked Question applies to all supported releases of ESP Alchemist.