MVS JCL concepts Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 1 Presentation Thanks for using this presentation. You are free to use it. I appreciate if you refer to the author when using it. I’m sorry about the language errors; my english isn’t so good; I’ll appreciate if you send me any corrections and suggestions to optimize the comprehension to the reader. The same is valid for any technical error; please help me to make this an error-free text. Alberto Romano Schiesari – São Paulo - Brazil www.profars.com [email protected] Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 2 Summary IBM main operating systems MVS line Executing services demand General flow JES2 Input spool and Output spool Input spool Job submission - Roscoe Stacking jobs at input spool Contents of each job in the input spool Initiators Output spool JCL JOB EXEC DD Library search PROCS Apendix - CONTROL’s Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 3 Concepts IBM main operating systems see http://publib.boulder.ibm.com/infocenter/zos/basics/index.jsp Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 4 Concepts – IBM main operating systems IBM main operating systems “DOS” or “VSE” line DOS (1966) DOS/VS (1972) DOS/VSE (80’s) VSE/ESA (1991) z/VSE (2005) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 5 Concepts – IBM main operating systems IBM main operating systems “VM” line VM/370 (1972) VM/SP (1980) VM/XA (1988) VM/ESA (1990) z/VM (2000) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 6 Concepts – IBM main operating systems Conceitos IBM main operating systems “Real-time” (transactional) line ACP (1969) TPF (1979) z/TPF (2005) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 7 Concepts – IBM main operating systems Conceitos IBM main operating systems Unix-like line UTS (1981) AIX/370 (1990) AIX/ESA (1991) LINUX (1999) Open Solaris (2008) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 8 Concepts – IBM main operating systems Conceitos IBM main operating systems MVS line MFT (1966) ; OS/VS1 (1972) (end) MVT (1967) OS/VS2 R1 (SVS) (1972) 24-bit addressing; Single Address Space MVS (OSVS2 R2) (1974) 24-bit addressing; Multiple Address Spaces MVS/370 (1981) . MVS/XA (83) Extended Architecture MVS/ESA (1988) Enterprise System Architeture; 31-bit addressing OS/390 (1995) . z/OS (2000) ; 24-,31- 64-bit addressing z/OS 1.10 (Sep 2008) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 9 Concepts – IBM main operating systems Conceitos Each operating system has its own language to code “scripts” and to be the formal tool to (a) user ask operating system for service execution (b) operating system return results and messages to the user This language, in MVS and derived operating systems, is known as JCL (Job Control Language) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 10 Concepts – IBM main operating systems Conceitos Curiosity: example of a DOS (PC’s) JCL (.bat files) @echo off cls :a ECHO Compiling %1 IF EXIST %1.OBJ DEL %1.OBJ COBOL %1; ANIM COPYLIST > %1.LST IF ERRORLEVEL 1 ECHO *** Error LINK %1+%COBDIR%\ADIS+%COBDIR%\ADISKEY+%COBDIR%\ADISINIT; >> %1.LST rem TYPE %1.LST shift if not "%1" == "" goto a @ECHO Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 11 Concepts – IBM main operating systems Conceitos Curiosity: sample JCL for UNIX line (Shell Script) #!/bin/ksh #--------------------------------------------------------------------# # Rotina: rsyil02.sh - Salva arquivo de retorno do Mainframe # #--------------------------------------------------------------------# BN=` basename $0 ` DN=` dirname $0 ` . $DN/raet.functions FILE=/comunnications/bi/received/rsybi02 if [ -f $FILE.txt ] ; then if [ -f $FILE.txt ] ; then bkpcop $FILE.txt || exit $? scratf $FILE.txt 12 || exit $? else echo " Error. $FILE.txt does not exist" exit 1 fi \mv -f $FILE.txt $FILE else echo " No transactions today." exit 0 fi Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 12 Concepts – IBM main operating systems Conceitos Curiosity: example of JCL for the VSE line >SUB,R,N >* BKPD047 - BACKUP D047 TO T047 * $$ JOB JNM=BKPD047,CLASS=8,USER='44-R.WALKO' * $$ PRT CLASS=B,DISP=H // JOB BKPD047 BACKUP D047 TO T047 // DLBL D047,'D047.ADPDCS.INPUT ',,VSAM,CAT=PRODCAT,BUFSP=40960 // TLBL FILEB,'T047,U' // EXEC EASYTREV INCLUDE EZBKVSES D047 VS VB 750 8352 UNLOAD /* /& * $$ EOJ http://gsf-soft.com/Prism-CS/Samples/BKPD047.shtml Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 13 Concepts – IBM main operating systems Conceitos Curiosity: this is the equivament for the MVS line //BKPD047 JOB (BKPD047),' ',CLASS=A,MSGCLASS=X, // MSGLEVEL=(1,1),REGION=6M //* //JOBLIB INCLUDE MEMBER=JOBLIB //STEP0010 EXEC PGM=SORT //* MODULE EASYTREV PROCESSED BY PLUG-IN LCPEZT //* VS VS I PRODCAT D047 'D047.ADPDCS.INPUT' //SORTIN DD DSN=MVS.D047.ADPDCS.INPUT,DISP=SHR //* MT O FILEB 'T047,U' //SORTOUT DD DSN=MVS.T047, // DISP=(NEW,CATLG,DELETE), // UNIT=TAPE //* PR O //SYSOUT DD SYSOUT=* //* CD I //SYSIN DD * *INCLUDE EZBKVSES D047 VS VB 750 8352 UNLOAD SORT FIELDS=COPY RECORD TYPE=V,LENGTH=750 /* // http://gsf-soft.com/Prism-CS/Samples/BKPD047.shtml Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 14 MVS line – executing services demand Executing services demand Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 15 MVS line – executing services demand BE CAREFUL! ACHTUNG! Everything you’re gonna see/read/listen is OK for BACTH applications ! Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 16 MVS line – executing services demand BE CAREFUL! ACHTUNG! Everything you’re gonna see/read/listen is OK for BACTH applications ! Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 17 MVS line – general flow General flow System Service Input (execution order) Summary Prev.Pg. Result Output basically: print (paper or “terminal”) Alberto Romano Schiesari – www.profars.com 18 MVS line – general flow General flow SYSTEM How do services get into the system? Service Input (execution order) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 19 MVS line – general flow General flow SYSTEM How do results get out of the system? Result Output basically: print (paper or “terminal”) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 20 MVS line – general flow General flow There is a specific software to execute those functions (service input and result output). It is JES2. (Job Entry Subsystem) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 21 JES2 Therefore: JES2 JES2 components that receive the inputs Service Input (execution order) Summary Prev.Pg. JES2 components that send the results out Result Output (basically: print on paper or “terminal”) Alberto Romano Schiesari – www.profars.com 22 JES2 In other words: z/OS Operating system Component 1 ... Component 2 ... JES2 Component n ... Application 1 Service Input (execution order) Result Output Application 2 ... Apllication n (ex.:CICS) ... (basically: print on paper or “terminal”) Application x (ex.: DB2) ... Application z ... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 23 JES2 For example: z/OS Operating system Component 1 ... Component 2 ... JES2 Component n ... Application 1 Services input via terminal (“sub” command ) Application 2 ... Apllication n (ex.:CICS) ... Application x (ex.: DB2) ... Application z ... Summary Prev.Pg. Results output browse via terminal (job sysout browse) Alberto Romano Schiesari – www.profars.com 24 JES2 But... We have to remember that: z/OS Operating system Component 1 ... Component 2 ... JES2 Component n ... Application 1 Application 2 ... Apllication n (ex.:CICS) ... Terminals for SUB Application x (ex.: DB2) ... Terminals for BROWSE (they MUST be associated to an application program !!!) Application z ... (they MUST be associated to an application program !!!) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 25 JES2 What is (are) this (these) application program(s)? z/OS Operating system Component 1 ... Component 2 ... JES2 Component n ... Application 1 Application 2 ... Apllication n (ex.:CICS) ... What is the application program responsible for this terminal? Summary Prev.Pg. Application x (ex.: DB2) ... Application z ... What is the application program responsible for this terminal? Alberto Romano Schiesari – www.profars.com 26 JES2 It may be Roscoe... JES2 ROSCOE Roscoe sends the services to the JES2 Summary Prev.Pg. Roscoe gets the results from JES2 Alberto Romano Schiesari – www.profars.com 27 JES2 Or TSO... JES2 TSO TSO sends the services to the JES2 Summary Prev.Pg. TSO gets the results from JES2 Alberto Romano Schiesari – www.profars.com 28 JES2 But, even either Roscoe or TSO... JES2 Roscoe or TSO The terminal is just a visual interface Summary Prev.Pg. The terminal is just a visual interface Alberto Romano Schiesari – www.profars.com 29 JES2 Where are, in fact, the data? JES2 Roscoe or TSO Where is the stream we built and submitted? Summary Prev.Pg. Where is the sysout being accessed to browse? Alberto Romano Schiesari – www.profars.com 30 JES2 In disk ! In the spool areas ! JES2 Roscoe or TSO INPUT spool area Summary Prev.Pg. Output spool area Alberto Romano Schiesari – www.profars.com 31 JOB input Let’s see some details about spool input process JES2 Summary Input spool area Roscoe or TSO Prev.Pg. Alberto Romano Schiesari – www.profars.com 32 JOB input – TSO/ROSCOE NOTE : use of ROSCOE (data manipulation via AWS)... Roscoe Roscoe work area (AWS) (create / FETCH/ATTACH) Roscoe LIB’s (proprietary data organization) (SAVE or UPDATE) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 33 JOB input – TSO/ROSCOE NOTE : ... or TSO (data manipulation directly in the “normal” datsets areas) TSO Partitioned dataset member Sequential dataset Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 34 JOB input – TSO/ROSCOE NOTE : we’ll refer to data manipulation using Roscoe or TSO using this figure TSO/Roscoe Edited data To be submitted Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 35 JOB input – TSO/ROSCOE Step 1 = edit data to be submitted TSO/Roscoe Edited data To be submitted Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 36 JOB input – TSO/ROSCOE Step 1 = edit data to be submitted Summary TSO/Roscoe Prev.Pg. //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,*-4 SALVA ENDERECO VOLTA OPEN (AGENCIAS,INPUT) ABRE ARQUIVO LEITURA BAL 14,LEREG LE REGISTRO CLI FLAGFIM,C'Y' END OF FILE? BE ACABAR SE SIM, TERMINAR O PROGRAMA AP LIDOS,=P'1' CONTA REGISTROS LIDOS B LEITURA VOLTA A LER ACABAR CLOSE (AGENCIAS) FECHA ARQUIVO L R14,ROTMAIN-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,*-4 SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA * DECLARACAO DE ARQUIVOS E AREAS RELAT DCB LRECL=133,DSORG=PS,RECFM=FA,DDNAME=SYSPRINT,MACRF=PM AGENCIAS DCB LRECL=80,DSORG=PS,DDNAME=AGENCIAS,MACRF=GM,EODAD=FIMAG FLAGFIM DC C'N' FLAG INDICA FIM ARQ ENTRADA LAG DS CL80 AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA 0001---------* 0002NOME DA AGENCIA 0002---------* 0003NOME DA AGENCIA 0003---------* 0004NOME DA AGENCIA 0004---------* Alberto Romano Schiesari – www.profars.com 37 JOB input – TSO/ROSCOE Another sight... Roscoe JOB Statement 1st step components (assembly = execution of Assembler program) 2nd step components (linkedit = execution of linkeditor program) 3rd step components (my program) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 38 JOB input – TSO/ROSCOE A c-a-r-e-f-u-l analysys of the data to be submitted... Summary TSO/Roscoe Prev.Pg. //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,*-4 SALVA ENDERECO VOLTA OPEN (AGENCIAS,INPUT) ABRE ARQUIVO LEITURA BAL 14,LEREG LE REGISTRO CLI FLAGFIM,C'Y' END OF FILE? BE ACABAR SE SIM, TERMINAR O PROGRAMA AP LIDOS,=P'1' CONTA REGISTROS LIDOS B LEITURA VOLTA A LER ACABAR CLOSE (AGENCIAS) FECHA ARQUIVO L R14,ROTMAIN-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,*-4 SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA * DECLARACAO DE ARQUIVOS E AREAS RELAT DCB LRECL=133,DSORG=PS,RECFM=FA,DDNAME=SYSPRINT,MACRF=PM AGENCIAS DCB LRECL=80,DSORG=PS,DDNAME=AGENCIAS,MACRF=GM,EODAD=FIMAG FLAGFIM DC C'N' FLAG INDICA FIM ARQ ENTRADA LAG DS CL80 AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA 0001---------* 0002NOME DA AGENCIA 0002---------* 0003NOME DA AGENCIA 0003---------* 0004NOME DA AGENCIA 0004---------* Alberto Romano Schiesari – www.profars.com 39 JOB input – TSO/ROSCOE Another sight, the stream as a whole ... TSO/Roscoe //PSTARS3T JOB (1234),'ALBERTO', // CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * Step C, SYSIN dataset data //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * Step G, AGENCIAS dataset data Red = JCL Blue = data Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 40 JOB input – TSO/ROSCOE Another way to view the data ... TSO/Roscoe //PSTARS3T JOB (1234),‘ALBERTO', // CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * Step C, SYSIN dataset data Step G, AGENCIAS dataset data Red = JCL Blue = data Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 41 JOB input – TSO/ROSCOE Getting back to the relationship between Roscoe and JES... Summary TSO/Roscoe Prev.Pg. //PSTARS3T JOB (9526),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,*-4 SALVA ENDERECO VOLTA OPEN (AGENCIAS,INPUT) ABRE ARQUIVO LEITURA BAL 14,LEREG LE REGISTRO CLI FLAGFIM,C'Y' END OF FILE? BE ACABAR SE SIM, TERMINAR O PROGRAMA AP LIDOS,=P'1' CONTA REGISTROS LIDOS B LEITURA VOLTA A LER ACABAR CLOSE (AGENCIAS) FECHA ARQUIVO L R14,ROTMAIN-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,*-4 SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA * DECLARACAO DE ARQUIVOS E AREAS RELAT DCB LRECL=133,DSORG=PS,RECFM=FA,DDNAME=SYSPRINT,MACRF=PM AGENCIAS DCB LRECL=80,DSORG=PS,DDNAME=AGENCIAS,MACRF=GM,EODAD=FIMAG FLAGFIM DC C'N' FLAG INDICA FIM ARQ ENTRADA FLAG DS CL80 AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA 0001---------* 0002NOME DA AGENCIA 0002---------* 0003NOME DA AGENCIA 0003---------* 0004NOME DA AGENCIA 0004---------* Alberto Romano Schiesari – www.profars.com 42 JOB input – TSO/ROSCOE Roscoe submits (delivers) the stream that came from AWS to JES... JES2 Input spool area Summary SUB TSO/Roscoe Edited data Prev.Pg. Alberto Romano Schiesari – www.profars.com 43 JOB input – TSO/ROSCOE The JES component that reads the things somebody (Roscoe, TSO...) submitted is (are) the READER(s) / INTERPRETER(s) JES2 Input spool area Reader Summary SUB TSO/Roscoe AWS Prev.Pg. Alberto Romano Schiesari – www.profars.com 44 JOB input – TSO/ROSCOE There are several READER/INTERPRETER(s); they get the records from the submitted JOBs; while reading, they validate some information before send to the spool (that’s because the “interpreter”) JES2 Input spool area Readers “Normal” datasets Roscoe AWS SUB Summary TSO SUB Prev.Pg. Alberto Romano Schiesari – www.profars.com 45 JOB input Let’s see better the input spool area JES2 Input spool area Readers “Normal” datasets Roscoe AWS SUB Summary TSO SUB Prev.Pg. Alberto Romano Schiesari – www.profars.com 46 JOB input Input spool area : the archieving unit is the JOB JOB0001 JOB0002 JOB0003 JOB0004 JOB0006 JOB0007 JOB0008 Etc... Summary Prev.Pg. JOB0005 Alberto Romano Schiesari – www.profars.com 47 JOB input The JOBS are queued based on the entry sequence; each Job receive an Id #, that will follow it throughout its whole life. JOB0001 JOB0002 JOB0003 JOB0004 JOB0006 JOB0007 JOB0008 Etc... Summary Prev.Pg. JOB0005 Alberto Romano Schiesari – www.profars.com 48 JOB input The JOBS remains in the queue awaiting execution. JOB0001 JOB0002 JOB0003 JOB0004 JOB0006 JOB0007 JOB0008 Etc... Summary Prev.Pg. JOB0005 Alberto Romano Schiesari – www.profars.com 49 JOB input Let’s see some details about how the Jobs are stored. Let’s detail one of them (JOB0001): JOB0001 ALL JCL records (statements) (one single dataset) Summary Prev.Pg. For each in-stream dataset in the submitted stream, is created a file identified with stepname + DDname Alberto Romano Schiesari – www.profars.com 50 JOB input Example: if this stream (ref. JOB0001) is submitted //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=‘TOT=YES' //STEP2 EXEC PGM=PGTST02 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 51 JOB input The input spool data related to JOB0001 is as follows: //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=‘TOT=YES' //STEP2 EXEC PGM=PGTST02 JOB0001 //PSTARS3T JOB (123),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=‘TOT=YES‘ //STEP2 EXEC PGM=PGTST02 There is no datasets related to in-stream data, because there is no in-stream data Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 52 JOB input Example: if this stream is submitted (ref. JOB0002) //PSTARS3T //STEP1 //STEP2 //STEP3 //SYSOUT //SYSPRINT //SYSIN DD DELETE Summary JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O EXEC PGM=PGTST01,PARM=‘TOT=YES' EXEC PGM=PGTST02 EXEC PGM=IDCAMS DD SYSOUT=* DD SYSOUT=* * DES.ALB.A001 PURGE /* DELETE DATASET */ Prev.Pg. Alberto Romano Schiesari – www.profars.com 53 JOB input The input spool related to JOB0002 is as follows: //PSTARS3T //STEP1 //STEP2 //STEP3 //SYSOUT //SYSPRINT //SYSIN DD DELETE JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O EXEC PGM=PGTST01,PARM=‘TOT=YES' EXEC PGM=PGTST02 EXEC PGM=IDCAMS DD SYSOUT=* DD SYSOUT=* * DES.ALB.A001 PURGE /* DELETA DATASET */ JOB0002 //PSTARS3T //STEP1 //STEP2 //STEP3 //SYSOUT //SYSPRINT //SYSIN DD JOB EXEC EXEC EXEC DD DD * (1234),'ALBERTO',CLASS=T,MSGCLASS=O PGM=PGTST01,PARM=‘TOT=YES' PGM=PGTST02 PGM=IDCAMS SYSOUT=* SYSOUT=* Step=STEP3 ; DD=SYSIN DELETE Summary DES.ALB.A001 PURGE Prev.Pg. /* DELETA DATASET */ Alberto Romano Schiesari – www.profars.com 54 JOB input Getting back to the original JOB, that with the 3 steps (compile, link & go of an assembler program); suppose that the id is JOB1234 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,*-4 SALVA ENDERECO VOLTA OPEN (AGENCIAS,INPUT) ABRE ARQUIVO LEITURA BAL 14,LEREG LE REGISTRO CLI FLAGFIM,C'Y' END OF FILE? BE ACABAR SE SIM, TERMINAR O PROGRAMA AP LIDOS,=P'1' CONTA REGISTROS LIDOS B LEITURA VOLTA A LER ACABAR CLOSE (AGENCIAS) FECHA ARQUIVO L R14,ROTMAIN-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,*-4 SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA * DECLARACAO DE ARQUIVOS E AREAS RELAT DCB LRECL=133,DSORG=PS,RECFM=FA,DDNAME=SYSPRINT,MACRF=PM AGENCIAS DCB LRECL=80,DSORG=PS,DDNAME=AGENCIAS,MACRF=GM,EODAD=FIMAG FLAGFIM DC C'N' FLAG INDICA FIM ARQUIVO ENTRADA LAG DS CL80 AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA 0001---------* 0002NOME DA AGENCIA 0002---------* 0003NOME DA AGENCIA 0003---------* 0004NOME DA AGENCIA 0004---------* Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 55 JOB input It has JCL and in-stream data //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,*-4 SALVA ENDERECO VOLTA OPEN (AGENCIAS,INPUT) ABRE ARQUIVO LEITURA BAL 14,LEREG LE REGISTRO CLI FLAGFIM,C'Y' END OF FILE? BE ACABAR SE SIM, TERMINAR O PROGRAMA AP LIDOS,=P'1' CONTA REGISTROS LIDOS B LEITURA VOLTA A LER ACABAR CLOSE (AGENCIAS) FECHA ARQUIVO L R14,ROTMAIN-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,*-4 SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA * DECLARACAO DE ARQUIVOS E AREAS RELAT DCB LRECL=133,DSORG=PS,RECFM=FA,DDNAME=SYSPRINT,MACRF=PM AGENCIAS DCB LRECL=80,DSORG=PS,DDNAME=AGENCIAS,MACRF=GM,EODAD=FIMAG FLAGFIM DC C'N' FLAG INDICA FIM ARQUIVO ENTRADA LAG DS CL80 AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA 0001---------* 0002NOME DA AGENCIA 0002---------* 0003NOME DA AGENCIA 0003---------* 0004NOME DA AGENCIA 0004---------* Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 56 JOB input The input spool related to JOB1234 is (almost...) as follows: JOB1234 //PSTARS3T JOB (1234),‘ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * Step=C ; DD=SYSIN PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,*-4 SALVA ENDERECO VOLTA OPEN (AGENCIAS,INPUT) ABRE ARQUIVO LEITURA BAL 14,LEREG LE REGISTRO CLI FLAGFIM,C'Y' END OF FILE? BE ACABAR SE SIM, TERMINAR O PROGRAMA AP LIDOS,=P'1' CONTA REGISTROS LIDOS B LEITURA VOLTA A LER ACABAR CLOSE (AGENCIAS) FECHA ARQUIVO L R14,ROTMAIN-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,*-4 SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA * DECLARACAO DE ARQUIVOS E AREAS RELAT DCB LRECL=133,DSORG=PS,RECFM=FA,DDNAME=SYSPRINT,MACRF=PM AGENCIAS DCB LRECL=80,DSORG=PS,DDNAME=AGENCIAS,MACRF=GM,EODAD=FIMAG FLAGFIM DC C'N' FLAG INDICA FIM ARQUIVO ENTRADA LAG DS CL80 AREA PARA LEITURA ARQUIVO END , Summary Step=G ; DD=AGENCIAS 0001NOME 0002NOME 0003NOME 0004NOME DA DA DA DA AGENCIA AGENCIA AGENCIA AGENCIA 0001---------* 0002---------* 0003---------* 0004---------* ULTIMO STMT FONTE Prev.Pg. Alberto Romano Schiesari – www.profars.com 57 JOB input In fact, JCL is already EXPANDED (details when we’ll see PROCs) JOB1234 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG XXASMACLG PROC XXC EXEC PGM=ASMA90 XXSYSLIB DD DSN=SYS1.MACLIB,DISP=SHR XXSYSUT1 DD DSN=&&SYSUT1,SPACE=(4096,(120,120),,,ROUND), XX UNIT=SYSALLDA,DCB=BUFNO=1 XXSYSPRINT DD SYSOUT=* XXSYSLIN DD DSN=&&OBJ,SPACE=(3040,(40,40),,,ROUND), XX UNIT=SYSALLDA,DISP=(MOD,PASS), XX DCB=(BLKSIZE=3040,LRECL=80,RECFM=FB,BUFNO=1) //C.SYSIN DD * XXL EXEC PGM=HEWL,PARM='MAP,LET,LIST',COND=(8,LT,C) XXSYSLIN DD DSN=&&OBJ,DISP=(OLD,DELETE) XX DD DDNAME=SYSIN XXSYSLMOD DD DISP=(,PASS),UNIT=SYSALLDA,SPACE=(CYL,(1,1,1)), XX DSN=&&GOSET(GO) XXSYSUT1 DD DSN=&&SYSUT1,SPACE=(1024,(120,120),,,ROUND), XX UNIT=SYSALLDA,DCB=BUFNO=1 XXSYSPRINT DD SYSOUT=* XXG EXEC PGM=*.L.SYSLMOD,COND=((8,LT,C),(8,LT,L)) //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 58 JOB input FINALLY !!! JOB1234 “final” format is: JOB1234 1 2 3 4 5 6 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG XXASMACLG PROC XXC EXEC PGM=ASMA90 XXSYSLIB DD DSN=SYS1.MACLIB,DISP=SHR XXSYSUT1 DD DSN=&&SYSUT1,SPACE=(4096,(120,120),,,ROUND), XX UNIT=SYSALLDA,DCB=BUFNO=1 7 XXSYSPRINT DD SYSOUT=* 8 XXSYSLIN DD DSN=&&OBJ,SPACE=(3040,(40,40),,,ROUND), XX UNIT=SYSALLDA,DISP=(MOD,PASS), XX DCB=(BLKSIZE=3040,LRECL=80,RECFM=FB,BUFNO=1) 9 //C.SYSIN DD * 10 XXL EXEC PGM=HEWL,PARM='MAP,LET,LIST',COND=(8,LT,C) 11 XXSYSLIN DD DSN=&&OBJ,DISP=(OLD,DELETE) 12 XX DD DDNAME=SYSIN 13 XXSYSLMOD DD DISP=(,PASS),UNIT=SYSALLDA,SPACE=(CYL,(1,1,1)), XX DSN=&&GOSET(GO) 14 XXSYSUT1 DD DSN=&&SYSUT1,SPACE=(1024,(120,120),,,ROUND), XX UNIT=SYSALLDA,DCB=BUFNO=1 15 XXSYSPRINT DD SYSOUT=* 16 XXG EXEC PGM=*.L.SYSLMOD,COND=((8,LT,C),(8,LT,L)) 17 //G.SYSPRINT DD SYSOUT=* 18 //G.SYSOUT DD SYSOUT=* 19 //G.AGENCIAS DD * Step=C ; DD=SYSIN PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,*-4 SALVA ENDERECO VOLTA OPEN (AGENCIAS,INPUT) ABRE ARQUIVO LEITURA BAL 14,LEREG LE REGISTRO CLI FLAGFIM,C'Y' END OF FILE? BE ACABAR SE SIM, TERMINAR O PROGRAMA AP LIDOS,=P'1' CONTA REGISTROS LIDOS B LEITURA VOLTA A LER ACABAR CLOSE (AGENCIAS) FECHA ARQUIVO L R14,ROTMAIN-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,*-4 SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA * DECLARACAO DE ARQUIVOS E AREAS RELAT DCB LRECL=133,DSORG=PS,RECFM=FA,DDNAME=SYSPRINT,MACRF=PM AGENCIAS DCB LRECL=80,DSORG=PS,DDNAME=AGENCIAS,MACRF=GM,EODAD=FIMAG FLAGFIM DC C'N' FLAG INDICA FIM ARQUIVO ENTRADA LAG DS CL80 AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE Step=G ; DD=AGENCIAS 0001NOME 0002NOME 0003NOME 0004NOME Summary Prev.Pg. DA DA DA DA AGENCIA AGENCIA AGENCIA AGENCIA 0001---------* 0002---------* 0003---------* 0004---------* Alberto Romano Schiesari – www.profars.com 59 JOB input OK? No doubts? We’ll talk about that again soon... JOB1234 1 dataset with all JCL, already expanded Summary Prev.Pg. Step=ssssssss ; DD=dddddddd 1 dataset for each in-stream dataset Alberto Romano Schiesari – www.profars.com 60 JOB input Getting back to the matter, there was a queue of JOBs waiting for execution... JOB0001 JOB0002 JOB0003 JOB0004 JOB0006 JOB0007 JOB0008 Etc... Summary Prev.Pg. JOB0005 Alberto Romano Schiesari – www.profars.com 61 JOB input For job execution, there are other system components: the INITIATORs z/OS Operating System Component 1 ... Selection for execution Initiator’s JES2 Input spool area JOBS Component n ... Application program 1 Application program o 2 ... Application program n (ex.:CICS) ... Application program x (ex.: DB2) ... Application program z ... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 62 Execution They (the INITIATORs) do the selection (pick up 1 at a time) of the “waiting-for-execution” job(s) and begin their execution. Initiator’s Selection for execution Input spool Area JOBS What is the criteria for the selection? The JOB class. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 63 Execution Each initiator deals with some pre-defined classes. Ex. INIT 1 = jobs classes A, B and C INIT 2 = jobs classes D, E and F Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) INIT 1 : server for jobs class A, B and C; in the example, this INIT will select the jobs 0001 e 0002. JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) INIT 2 : server for jobs class D, E and F; in the example, this INIT will select the jobs 0004 e 0005. JOB0006 (class T) Etc... Summary While there is no INIT serving classes R and/or T, the jobs 0003 and 0006 won’t be executed (selected for execution) Prev.Pg. Alberto Romano Schiesari – www.profars.com 64 Execution Example: see the list of INITs as shown by Roscoe’ DIS INIT command: > APPLID(EMPROSCD) USER(OB3,ARS243) > ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 INIT 1 ACTIVE JOB00716 ADP#6IA (1) PVAG1 0:17:13 C=12345 INIT 2 ACTIVE JOB01873 NDVJD000 (1) COPYDIR 0:05:04 C=21345 INIT 3 ACTIVE JOB00809 SCO#END (1) NDVRBAT 0:01:15 C=32154 INIT 4 INACTIVE C=0 INIT 5 INACTIVE C=85 INIT 6 ACTIVE JOB00789 OCC#SCL (9) NDVRBAT 0:05:05 C=9 INIT 7 INACTIVE C=QP INIT 8 ACTIVE JOB00812 FIN#T305 (S) STEP002 0:01:00 C=QS INIT 9 INACTIVE C=QR INIT 10 ACTIVE JOB00605 CPC#BUS (A) NDVRBAT 0:28:38 C=YA INIT 11 ACTIVE JOB00771 SCO#ALB (Y) NDVRBAT 0:08:08 C=YU INIT 12 ACTIVE JOB00819 NDVJPKPR (Z) BC1JPCKG 0:00:05 C=ZB INIT 13 INACTIVE C=CT INIT 14 INACTIVE C=ZN INIT 15 ACTIVE JOB00782 SCO#A005 (W) STEP1 0:06:13 C=W Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 65 Execution Ex.: INIT 1 = serves jobs with classes A, B and C. The SELECTION PRIORITY is basically FIFO. Then, JOB0001 is selected first, and JOB0002 is selected after JOB0001 Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) INIT 1 : serves jobs with classes A, B and C; in the example, INIT 1 will select jobs 0001 and 0002. JOB0003 (class R) Selection priority: basically FIFO JOB0004 (class D) (First In First Out) JOB0005 (class E) JOB0006 (class T) Etc... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 66 Execution INIT 1 selected JOB0001 Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) INIT 1 : selected JOB0001 for execution JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 67 Execution INIT 1 pick up the information related to each step (program execution order [EXEC] + information about the datasets the program uses [DD] ) to do some things. Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) Process each STEP JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 68 Execution 1st. step : - Identify which program must be executed (PGM=xxxxxxxx) - Verify DISP of each DD: -- IF DISP=OLD or DISP=SHR or DISP=MOD, verify whether the dataset already exists, whether it is reserved / locked for another user, etc... - If DISP=NEW, create the dataset (does it exist? Is there enough room? etc...) - Ask LOADER to fetch program from the right library (is there STEPLIB? Is there JOBLIB?) Let everything set up so that OPEN can go smoothly... (*) (*) unless the program uses DYNALLOC... As CICS does... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 69 Execution Starting parenthesis... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 70 Execution Dataset allocation: (a) outside program, before starting the execution (by initiator); information is provided by DD statement (b) by the program (dinamically); in this case: - no DD needed - allocation is done by a service ordered to the operating system (via macro / SVC) called DYNALLOC (dynamic allocation) - program must process the “no allocation possible” condition Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 71 Execution Ending parenthesis... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 72 Execution 1st. step : Everything OK? Then you can call the program for execution. Order LOADER to fetch program and transfer control (remember PSW? remember entry-point?) to the program’s 1st instruction. In other words, (talking in assemblish...): INIT orders the BALR 14,15 to transfer control to the program. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 73 Execution 1st. step : Our program is executed. What does it mean? It means that CPU executes its instructions. But... There are dozens of other programs that need to use the CPU time, dreaming of CPU executing its instructions. That’s when the dispatching priority comes. It determines the privileges (or none) my program has in the algorithm that determines how much time each cuncurrent program get from CPU. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 74 Execution 1st. step : What if a dataset is read, and the dataset is available via DD * ? When OPEN is issued, the access method receives information (set up by JES2) that the dataset is awaiting at the input job spool (identified by its stepname and ddname). Therefore our program is going to read data directly from input spool area. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 75 Execution 1st. step : JOB1234 1 2 3 4 5 6 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG XXASMACLG PROC XXC EXEC PGM=ASMA90 XXSYSLIB DD DSN=SYS1.MACLIB,DISP=SHR XXSYSUT1 DD DSN=&&SYSUT1,SPACE=(4096,(120,120),,,ROUND), XX UNIT=SYSALLDA,DCB=BUFNO=1 7 XXSYSPRINT DD SYSOUT=* 8 XXSYSLIN DD DSN=&&OBJ,SPACE=(3040,(40,40),,,ROUND), XX UNIT=SYSALLDA,DISP=(MOD,PASS), XX DCB=(BLKSIZE=3040,LRECL=80,RECFM=FB,BUFNO=1) 9 //C.SYSIN DD * 10 XXL EXEC PGM=HEWL,PARM='MAP,LET,LIST',COND=(8,LT,C) 11 XXSYSLIN DD DSN=&&OBJ,DISP=(OLD,DELETE) 12 XX DD DDNAME=SYSIN 13 XXSYSLMOD DD DISP=(,PASS),UNIT=SYSALLDA,SPACE=(CYL,(1,1,1)), XX DSN=&&GOSET(GO) 14 XXSYSUT1 DD DSN=&&SYSUT1,SPACE=(1024,(120,120),,,ROUND), XX UNIT=SYSALLDA,DCB=BUFNO=1 15 XXSYSPRINT DD SYSOUT=* 16 XXG EXEC PGM=*.L.SYSLMOD,COND=((8,LT,C),(8,LT,L)) 17 //G.SYSPRINT DD SYSOUT=* 18 //G.SYSOUT DD SYSOUT=* 19 //G.AGENCIAS DD * Step=C ; DD=SYSIN PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,*-4 SALVA ENDERECO VOLTA OPEN (AGENCIAS,INPUT) ABRE ARQUIVO LEITURA BAL 14,LEREG LE REGISTRO CLI FLAGFIM,C'Y' END OF FILE? BE ACABAR SE SIM, TERMINAR O PROGRAMA AP LIDOS,=P'1' CONTA REGISTROS LIDOS B LEITURA VOLTA A LER ACABAR CLOSE (AGENCIAS) FECHA ARQUIVO L R14,ROTMAIN-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,*-4 SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG-4 RESTAURA ENDERECO VOLTA BR R14 VOLTA * DECLARACAO DE ARQUIVOS E AREAS RELAT DCB LRECL=133,DSORG=PS,RECFM=FA,DDNAME=SYSPRINT,MACRF=PM AGENCIAS DCB LRECL=80,DSORG=PS,DDNAME=AGENCIAS,MACRF=GM,EODAD=FIMAG FLAGFIM DC C'N' FLAG INDICA FIM ARQUIVO ENTRADA LAG DS CL80 AREA PARA LEITURA ARQUIVO END , Program reads directly from here Summary Prev.Pg. ULTIMO STMT FONTE Step=G ; DD=AGENCIAS 0001NOME 0002NOME 0003NOME 0004NOME DA DA DA DA AGENCIA AGENCIA AGENCIA AGENCIA 0001---------* 0002---------* 0003---------* 0004---------* Alberto Romano Schiesari – www.profars.com 76 Execution 1st. step : Our program finishes. Talking in “assemblish”, on the last BR 14, control is returned to initiator; especifically to a little-sub-component called terminator: it verifies the end-of-execution type (normal, abnormal), Return Code, closes the non-closed datasets, etc. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 77 Execution 2nd. step and so on: Process is repeated for all JOB steps, including the Return Code test (COND...), to know whether or not the step must be executed, flushed, etc... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 78 Execution OK? Job input OK? Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 79 Execution Time to start understanding output spooling system Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 80 Result output (reports) A bunch of people access data from the output spool. JES2 Output spool area Roscoe (CA software) or TSO (IBM software) Control (BMC softwares) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 81 Result output (reports) Who “writes” on the output spool? JES2 Output spool area Application programs Operating System and its components (including JES2) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 82 Result output (reports) Everybody “prints” something... Application programs and operating system. JES2 Output spool area Application programs Operating System and its components (including JES2) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 83 Result output (reports) But... In fact, only JES2 really writes. Do you know why? JES2 Output spool area Application Programs Operating System and its components (including JES2) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 84 Result output (reports) Because everybody “printing” is intercepted by JES, and JES redirects those lines to the output spool area. JES is its administrator. This is done naturally if output is specified as SYSOUT=xxx JES2 Output spool area Application programs Operating System and its components (including JES2) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 85 Result output (reports) What about the operating system outputs? They are redirected to where especified at MSGCLASS=xxx JES2 Output spool area Operating system and its components (including JES2) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 86 Result output (reports) What about the application programs’ output? They are redirected to where especified at SYSOUT=xxx JES2 Output spool area Application programs Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 87 Result output (reports) But what is that xxx? JES2 ? Application programs Operating Systems and its components (including JES2) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 88 Result output (reports) It is the output class. JES2 There is n datsets for each job, Each one has an associated class Application Programs Opertating System and its components (including JES2) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 89 Result output (reports) Unless otherwise specified at MSGLEVEL, system generates 3 reports about the JCL processing: JES2.JESMSGLG = job events log (start, end, etc) JES2.JESJCL = expanded JCL JES2.JESYSMSG = initiator / terminator messages JOB1234 , file JES2.JESMSGLG, class R Line 1 file 1 ... Etc... JOB JOB1234 , file JES2.JESJCL, class R Line 1 Relat1 ... Etc... JOB1234 , file JES2.JESYSMSG, class R Line 1 Relat2 ... Etc... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 90 Result output (reports) JES2.JESMSGLG example ( truncated at right) J E S 2 J O B L O G -- S Y S T E M D 1 T -- 15.42.13 JOB04227 ---- FRIDAY, 28 AUG 2009 ---15.42.13 JOB04227 IRR010I USERID D839471 IS ASSIGNED TO THIS JOB. 15.42.13 JOB04227 ******* PSTARS3T *--------------------------Sepro-41* 15.42.13 JOB04227 IEF196I ******* PSTARS3T *--------------------------Se 15.42.13 JOB04227 ******* PSTARS3T * IEFUJV PROCESSING COMPLETE * 15.42.13 JOB04227 IEF196I ******* PSTARS3T * IEFUJV PROCESSING COMPLETE 15.42.13 JOB04227 ******* PSTARS3T *--------------------------Sepro-41* 15.42.13 JOB04227 IEF196I ******* PSTARS3T *--------------------------Se 15.42.13 JOB04227 IEF677I WARNING MESSAGE(S) FOR JOB PSTARS3T ISSUED 15.42.13 JOB04227 ICH70001I D839471 LAST ACCESS AT 15:42:05 ON FRIDAY, 15.42.13 JOB04227 $HASP373 PSTARS3T STARTED - INIT 28 - CLASS T - SYS 15.42.13 JOB04227 IEF403I PSTARS3T - STARTED - TIME=15.42.13 15.42.14 JOB04227 IEF285I SYS1.MACLIB 15.42.14 JOB04227 IEF285I VOL SER NOS= D1T900. 15.42.14 JOB04227 --TIMINGS (M 15.42.14 JOB04227 -JOBNAME STEPNAME PROCSTEP RC EXCP CPU SRB 15.42.14 JOB04227 -PSTARS3T STEP1 C 00 63 .00 .00 15.42.14 JOB04227 -PSTARS3T STEP1 L 00 19 .00 .00 15.42.14 JOB04227 IEF285I SYS09240.T154213.RA000.PSTARS3T.GOSET.H06 15.42.14 JOB04227 -PSTARS3T STEP1 G 00 9 .00 .00 15.42.14 JOB04227 IEF404I PSTARS3T - ENDED - TIME=15.42.14 15.42.14 JOB04227 -PSTARS3T ENDED. NAME-JAGUA #4 ALBERTO TOTAL CPU 15.42.14 JOB04227 $HASP395 PSTARS3T ENDED ------ JES2 JOB STATISTICS -----28 AUG 2009 JOB EXECUTION DATE 116 CARDS READ 640 SYSOUT PRINT RECORDS 0 SYSOUT PUNCH RECORDS 44 SYSOUT SPOOL KBYTES 0.00 MINUTES EXECUTION TIME Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 91 Result output (reports) JES2.JESJCL example (truncatd at right) =============================== T O P ================================= 1 //PSTARS3T JOB (9526,,,20,,1090),'JAGUA #4 ALBERTO', // CLASS=T,TIME=3,MSGCLASS=O 2 //STEP1 EXEC ASMACLG,PARM.G='INFORMACOES VIA PARM' 3 XXASMACLG PROC XX* XX************************************************************* XX* ASMACLG XX* THIS PROCEDURE RUNS THE HIGH LEVEL ASSEMBLER, LINK-EDITS TH XX* NEWLY ASSEMBLED PROGRAM AND RUNS THE PROGRAM AFTER XX* THE LINK-EDIT IS ACCOMPLISHED. XX************************************************************* XX* 4 XXC EXEC PGM=ASMA90 5 XXSYSLIB DD DSN=SYS1.MACLIB,DISP=SHR 6 XXSYSUT1 DD DSN=&&SYSUT1,SPACE=(4096,(120,120),,,ROUND), XX UNIT=SYSALLDA,DCB=BUFNO=1 7 XXSYSPRINT DD SYSOUT=* 8 XXSYSLIN DD DSN=&&OBJ,SPACE=(3040,(40,40),,,ROUND), XX UNIT=SYSALLDA,DISP=(MOD,PASS), XX DCB=(BLKSIZE=3040,LRECL=80,RECFM=FB,BUFNO=1) 9 //C.SYSIN DD * 10 XXL EXEC PGM=HEWL,PARM='MAP,LET,LIST',COND=(8,LT,C) 11 XXSYSLIN DD DSN=&&OBJ,DISP=(OLD,DELETE) 12 XX DD DDNAME=SYSIN 13 XXSYSLMOD DD DISP=(,PASS),UNIT=SYSALLDA,SPACE=(CYL,(1,1,1)), XX DSN=&&GOSET(GO) 14 XXSYSUT1 DD DSN=&&SYSUT1,SPACE=(1024,(120,120),,,ROUND), XX UNIT=SYSALLDA,DCB=BUFNO=1 15 XXSYSPRINT DD SYSOUT=* 16 XXG EXEC PGM=*.L.SYSLMOD,COND=((8,LT,C),(8,LT,L)) 17 //G.SYSPRINT DD SYSOUT=* Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 92 Result output (reports) JES2.JESYSMSG example (truncated at right) STMT NO. MESSAGE 2 IEFC001I PROCEDURE ASMACLG WAS EXPANDED USING SYSTEM LIBRARY JE 16 IEF686I DDNAME REFERRED TO ON DDNAME KEYWORD IN PRIOR STEP WAS ICH70001I D839471 LAST ACCESS AT 15:42:05 ON FRIDAY, AUGUST 28, 2009 IEF236I ALLOC. FOR PSTARS3T C STEP1 IEF237I BE10 ALLOCATED TO SYSLIB IGD101I SMS ALLOCATED TO DDNAME (SYSUT1 ) DSN (SYS09240.T154213.RA000.PSTARS3T.SYSUT1.H06 ) STORCLAS (SCVIO) MGMTCLAS ( ) DATACLAS ( ) VOL SER NOS= VIO IEF237I JES2 ALLOCATED TO SYSPRINT IGD101I SMS ALLOCATED TO DDNAME (SYSLIN ) DSN (SYS09240.T154213.RA000.PSTARS3T.OBJ.H06 ) STORCLAS (SCVIO) MGMTCLAS ( ) DATACLAS ( ) VOL SER NOS= VIO IEF237I JES2 ALLOCATED TO SYSIN IEF142I PSTARS3T C STEP1 - STEP WAS EXECUTED - COND CODE 0000 IEF285I SYS1.MACLIB KEPT IEF285I VOL SER NOS= D1T900. IGD105I SYS09240.T154213.RA000.PSTARS3T.SYSUT1.H06 DELETED, DDNAME=SY IEF285I D839471.PSTARS3T.JOB04227.D0000102.? SYSOUT IGD106I SYS09240.T154213.RA000.PSTARS3T.OBJ.H06 PASSED, DDNAME=SY IEF285I D839471.PSTARS3T.JOB04227.D0000101.? SYSIN IEF373I STEP/C /START 2009240.1542 IEF374I STEP/C /STOP 2009240.1542 CPU 0MIN 00.01SEC SRB 0MIN IEF236I ALLOC. FOR PSTARS3T L STEP1 IGD103I SMS ALLOCATED TO DDNAME SYSLIN IEF237I DMY ALLOCATED TO IGD101I SMS ALLOCATED TO DDNAME (SYSLMOD ) DSN (SYS09240.T154213.RA000.PSTARS3T.GOSET.H06 ) STORCLAS (SCVIO) MGMTCLAS ( ) DATACLAS ( ) VOL SER NOS= VIO Summary Prev.Pg. Continua na próxima página Alberto Romano Schiesari – www.profars.com 93 Result output (reports) JES2.JESYSMSG example (truncated at right) Continuação IGD101I SMS ALLOCATED TO DDNAME (SYSUT1 ) DSN (SYS09240.T154213.RA000.PSTARS3T.SYSUT1.H06 ) STORCLAS (SCVIO) MGMTCLAS ( ) DATACLAS ( ) VOL SER NOS= VIO IEF237I JES2 ALLOCATED TO SYSPRINT IEF142I PSTARS3T L STEP1 - STEP WAS EXECUTED - COND CODE 0000 IGD105I SYS09240.T154213.RA000.PSTARS3T.OBJ.H06 DELETED, DDNAME=SY IGD106I SYS09240.T154213.RA000.PSTARS3T.GOSET.H06 PASSED, DDNAME=SY IGD105I SYS09240.T154213.RA000.PSTARS3T.SYSUT1.H06 DELETED, DDNAME=SY IEF285I D839471.PSTARS3T.JOB04227.D0000103.? SYSOUT IEF373I STEP/L /START 2009240.1542 IEF374I STEP/L /STOP 2009240.1542 CPU 0MIN 00.00SEC SRB 0MIN IEF236I ALLOC. FOR PSTARS3T G STEP1 IEF237I VIO ALLOCATED TO PGM=*.DD IEF237I JES2 ALLOCATED TO SYSPRINT IEF142I PSTARS3T G STEP1 - STEP WAS EXECUTED - COND CODE 0000 IEF285I SYS09240.T154213.RA000.PSTARS3T.GOSET.H06 KEPT IEF285I D839471.PSTARS3T.JOB04227.D0000104.? SYSOUT IEF373I STEP/G /START 2009240.1542 IEF374I STEP/G /STOP 2009240.1542 CPU 0MIN 00.00SEC SRB 0MIN IGD105I SYS09240.T154213.RA000.PSTARS3T.GOSET.H06 DELETED, DDNAME=SY IEF375I JOB/PSTARS3T/START 2009240.1542 IEF376I JOB/PSTARS3T/STOP 2009240.1542 CPU 0MIN 00.01SEC SRB 0MIN Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 94 Result output (reports) Let’s see an example of an application program that writes 2 reports: //REPORT1 DD SYSOUT=* , //REPORT2 DD SYSOUT=B and it has MSGCLASS=R parameter in the JOB statement JOB1234, JES2.JESMSGLG, class R JOB1234, JES2.JESJCL, class R Operating System JOB1234, JES2.JESMSGLG, class R JOB1234 , STEP 1, DD REPORT1, class R Line 1 Report1 Line 2 Report1 ... Etc... Application Program (my program) JOB1234 , STEP1, DD REPORT2, class B Line 1 Report2 Line 2 Report2 ... Etc... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 95 Result output (reports) Similarly as occur in the input process, there are system components to deal with the (real) print demand generated by the queued datasets at output spool area. These components are the WRITERS; they work based on SYSOUT class. They read the spool datasets in the output spool area and “print” them at some device. JOB1234, JES2.JESMSGLG, class R JOB1234, JES2.JESJCL, class R JOB1234, JES2.JESMSGLG, class R JOB1234 , STEP 1, DD REPORT1, class R Line 1 Report1 Line 2 Report1 ... Etc... JOB1234 , STEP1, DD REPORT2, class B Line 1 Report2 Line 2 Report2 ... Etc... Summary Prev.Pg. Writer serves R class datasets Writer serves B class datasets Alberto Romano Schiesari – www.profars.com 96 Result output (reports) Sometimes (mostly at development activities) the output is NOT to be directed to a printer. User wants to browse it at a terminal. That’s what happen when we access sysouts Roscoe, TSO or CONTROL-V. JOB1234, JES2.JESMSGLG, class R JOB1234, JES2.JESJCL, class R JOB1234, JES2.JESMSGLG, class R JOB1234 , STEP 1, DD REPORT1, class R Line 1 Report1 Line 2 Report1 ... Etc... JOB1234 , STEP1, DD REPORT2, class B Line 1 Report2 Line 2 Report2 ... Etc... Summary Prev.Pg. Writer serves R class datasets Writer serves B class datasets Alberto Romano Schiesari – www.profars.com 97 JCL It’s JCL time Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 98 JCL JCL = Job Control Language = language to ask operating system to execute services/tasks Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 99 JCL All languages must have its commands. In JCL, there are 3 main commands: JOB, EXEC and DD Before starting with the details, let’s see some basics Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 100 JCL – Basic sintax Basic syntax Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 101 JCL – Basic sintax // at positions 1-2 Comments: //* at positions 1-3 Always: Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 102 JCL – Basic sintax Continuation statements · statement to be continued : last character must be a comma, to indicate there are more parameter(s) · following statement : // at columns 1-2, as usual, and continuation begins at any position from 4 through 16 (position 3 must be blank) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 103 JCL – Basic sintax Continuation statements Example (first 2 lines are “rulers” to use as a reference to the statement positions) : . 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA DD DSN=SYS5.LINKLIB, // DISP=SHR BIBLIOTECA DE UTILITARIOS HOME MADE //ENTRADA DD DSN=SYS5.LINKLIB, // DISP=SHR COMENTARIO //ENTRADA DD DSN=SYS5.LINKLIB, // DISP=SHR COMENTARIO //ENTRADA DD DSN=SYS5.LINKLIB, // DISP=SHR Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 104 JCL – Basic sintax Continuation statements Most common problems . 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA DD // DISP=SHR DSN=SYS5.LINKLIB BIBLIOTECA DE UTILITARIOS HOME MADE Here there is no comma after; therefore DISP=SHR wasn’t considered as part of DD statement, but a separated statement; note that bo JCL error is detected at //ENTRADA DD; system understands that dataset SYS5.LINKLIB must be created (there is no DISP parameter) and that following statement is wrong (DISP=SHR is na invalid operation). Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 105 JCL – Basic sintax Continuation statements Most common problems . 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA // DD DISP=SHR DSN=SYS5.LINKLIB, COMENTARIO Continuation begins at position 17; it’s wrong (maximum allowed for the beginning is position 16) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 106 JCL – Basic sintax Continuation statements Most common problems . 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA DD //DISP=SHR COMENTARIO DSN=SYS5.LINKLIB, Continuation at position 3 (wrong: minimum is position 4) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 107 JCL – Basic sintax Continuation statements Most common problems . 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA DD DISP=SHR DSN=SYS5.LINKLIB, “Continuation” statement (second statement) hasn’t // at positions 1-2: system understands that //ENTRADA DD DSN=SYS5.LINKLIB, will be resumed at the next line (its last character is a comma – it indicates there will be a continuation), but the next line is not a JCL line (it is recognized as the first – and only - data record of a dataset named SYSIN) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 108 JCL – Basic sintax Summary – statement syntax q q Identification = // columns 1-2 Name = 1 to 8 positions, starting at posiition 3; it must have at least one blank after the name (and before the operation) q Operation = JOB or EXEC or DD (or PROC or PEND or IF or END-IF or other); it must have at least one blank after operation name q Parameter(s); it/they may be of two types: posicional : depend on the position (sequence of specification) or keyword : followed by “=“ sign v If there is only positional parameter(s), they must be specified in the correct sequence v If there is only keyword parameter(s), they may be specified in any sequence v If there is both positional and keyword operands, the positional (in the correct sequence) must be specified before the keyword ones (in any sequence) q Comments; it must have at least one blank after the operand(s) specification, before comments Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 109 O JOB as a whole - overwiew JOB as a whole – overview Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 110 O JOB as a whole - overwiew Overview Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 111 JOB – Overview Job start delimiter JOB EXEC (for the 1st step) DD 1 (for the 1st step) . 1st Step . DD n (for the 1st step) EXEC (for the 2nd step) JOB DD 1 (for the 2nd step) . 2nd Step . DD n (for the 2nd step) EXEC (for the 3rd step) DD 1 (for the 3rd step) . 3rd Step . DD n (for the 3rd step) The job end delimiter is the next job begin (in the old times, it was mandatory a statement just with // in positions 1-2 and remaining spaces) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 112 JOB – Overview For the steps: Remember that DDs are opcional. If a program does not use datasets, no DD’s are needed or If a program uses dynamic allocation for a dataset, no DD is needed to that dataset BUT : EXEC is mandatory; EXEC defines a step. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 113 JOB – Overview If, for instance, the 2nd step “EXEC” has na operation code error, it isn’t identified as a EXEC and therefore it does not identify another new step delimiter, and therefore its DD’s are considered as belonging to the 1st step DD’s. //ABCARS01 JOB ... //STEP1 EXEC PGM=PGM01 //DDA1 DD ... //DDB1 DD ... //DDC1 DD ... //STEP2 ESEC PGM=PGM02 //DDA2 DD ... //DDB2 DD ... //DDC2 DD ... //STEP3 EXEC PGM=PGM03 //DDA3 DD ... //DDB3 DD ... //DDC3 DD ... As 2nd “EXEC” is in error, it doesn’t delimits the 2nd step beginning. All blue statements are the 1st step statements The green ones are the 2nd step statements Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 114 JOB – Overview Example of a batch JOB with a SELECT from a DB2 database, and the corresponding output produced. //ARSARS01 JOB (1234),’ALBERTO’,MSGCLASS=X,CLASS=R //STEP001 EXEC PGM=IKJEFT01,DYNAMNBR=20,REGION=6M //STEPLIB DD DSN=SYS1.DSNDB1D.SDSNLOAD,DISP=SHR // DD DSN=SYS1.DSNDB1D.RUNLIB.LOAD,DISP=SHR //DBRMLIB DD DSN=SYS1.DSNDB1D.DBRMLIB.DATA,DISP=SHR //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSTSIN DD * PAGE 1 DSN SYSTEM(DB1D) ***INPUT STATEMENT: RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) SELECT CD_AGE, NM_AGE LIB('SYS1.DSNDB1D.RUNLIB.LOAD') – FROM DB2T.ZZZ100_CADAGE PARMS('/ALIGN(MID)') WHERE CD_AGE > 20 AND CD_AGE < 100; END //SYSIN DD * +----------------------------------+ SELECT CD_AGE, NM_AGE | CD_AGE | NM_AGE | FROM DB2T.ZZZ100_CADAGE +----------------------------------+ WHERE CD_AGE > 20 AND CD_AGE < 100; 1_| 30 | BARUERI | 2_| 40 | S.JOSE R.PRETO | 3_| 50 | SAO CARLOS | 4_| 60 | PINHEIROS | 5_| 70 | PERDIZES | 6_| 80 | MARAMBAIA | 7_| 90 | JAGUARETE | +----------------------------------+ Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 115 JOB – Commands Commands Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 116 JCL - Comandos There are 3 main JCL commands: JOB, EXEC and DD Let’s see them. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 117 JOB JOB Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 118 JOB Sintax : //jobname JOB positional_parameters,keyword_parameters Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 119 JOB Example : //PDR001P2 JOB (B281),ALBERTO,MSGCLASS=X,CLASS=R 2 positional parameters Summary Prev.Pg. 2 keyword parameters Alberto Romano Schiesari – www.profars.com 120 JOB Positional parameters Generally they have information about job submitter and accounting. The sequence is mandatory, and the installation’ standards must be followed. //PDR001P2 JOB (B281),ALBERTO,MSGCLASS=X,CLASS=R 2 positional parameters Summary Prev.Pg. 2 keyword parameters Alberto Romano Schiesari – www.profars.com 121 JOB Keyword parameters Information about the job, given by means of keywords; therefore, they can be specified at any sequence. //PDR001P2 JOB (B281),ALBERTO,MSGCLASS=X,CLASS=R 2 positional parameters Summary Prev.Pg. 2 keyword parameters Alberto Romano Schiesari – www.profars.com 122 JOB Keyword parameters CLASS= Specify the job execution class. Each class is served by 1 (or more) initiator. The amount of initiators and the classes each one serves is determined by support and production people. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 123 JOB Keyword parameters TIME= Summary indicates the maximum amount of CPU usage allowed for the JOB; 1440 = specifies that there’s no CPU limit Prev.Pg. Alberto Romano Schiesari – www.profars.com 124 JOB Keyword parameters MSGCLASS= Summary Specifies the sysout class for the messages related to the JOB (as specified in MSGLEVEL) Prev.Pg. Alberto Romano Schiesari – www.profars.com 125 JOB Keyword parameters MSGVEVEL= Summary Specifies what has to be printed. Syntax: MSGLEVEL=(a,b) where a : JCL messages 0 = only JOB statement 1 = everything must be printed: submitted JCL statements + generated JCL statements 2 = only submitted JCL statements b : allocation messages 0 = do not print 1 = print Prev.Pg. Alberto Romano Schiesari – www.profars.com 126 JOB Keyword parameters NOTIFY= Specifies TSO userid to be notified at the job termination REGION= Specifies the size of the region to be allocated to the JOB RESTART= Specifies the stepname for the JOB to be restarted TYPRUN= Specifies the type of submission. SCAN = submit, validate JCL, but do not execute the job (it is finished after interpreter validation process; no INIT services done) HOLD = the JOB remains in wait state, until selected for execution by an initiator Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 127 EXEC EXEC Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 128 EXEC Sintax : //stepname EXEC positional_parameter,keyword_parameters Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 129 EXEC Example : //VERIFY EXEC P756,COND=EVEN,PARM.S1=‘T=YES’ 1 positional parameter Summary Prev.Pg. 2 parameters keyword Alberto Romano Schiesari – www.profars.com 130 EXEC Positional parameter only 1: procname It is a name, specifying the name of the PROC to be executed. If specified, keyword parameters PROC= and PGM= cannot be used. //STPR1 EXEC PD001 1 parâmetro posicional Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 131 EXEC Keyword parameters Information related to the step, specified via keywords; they can be specified in any sequence. //ST01 EXEC PGM=LISTABND,COND=ONLY 2 keyword parameters Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 132 EXEC COND= Specifies the execution conditions the step must be executed or flushed. COND=EVEN step is executed even if any previous step is cancelled COND=ONLY step is executed only if any previous step cancelled COND=(n,cond) step is NOT EXECUTED if n satisfies the specified condition, in any previous step COND=(n,cond,step) step is NOT EXECUTED if n satisfies the condition specified in the step with the specified name Cond may be specified as : LT or GT or EQ or NE Examples.: COND=(4,LT) if 4 is less than the return code of any previous step, STEP IS NOT EXECUTED in other words: if any previous step emitted a return code greater than 4, STEP IS NOT EXECUTED COND=((4,LT,COMP),(4,LT,LKED)) (if 4 is less than the return code emitted by step COMP AND if 4 is less than the return code emitted by step LKED) THEN STEP IS NOT EXECUTED in other words: (if step COMP had a return code > 4 OR if step LKED had a return code > 4) THEN STEP IS NOT EXECUTED Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 133 EXEC PARM= Summary Data to be passed as parameters (arguments) to the called program. Ex.: PARM='NOSEQ,QUOTE,OFFSET,LIB' PARM='JAN/2003' Prev.Pg. Alberto Romano Schiesari – www.profars.com 134 EXEC PGM= Specifies the name of the program to be executed PROC= Specifies the name of the proc(edure) to be executed. If no PGM= nor PROC= specified, then PROC= is assumed Examples : //STEP1 EXEC TST01 //STEP2 EXEC PROC=TST01 //STEP1 EXEC PGM=TST01 Summary Prev.Pg. executes PROC named TST01 executes PROC named TST01 executes program named TST01 Alberto Romano Schiesari – www.profars.com 135 DD DD (Data Definition) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 136 DD Sintax : //filename DD positional_parameters,keyword_parameters Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 137 DD Example : //INFILE DD *,DCB=(LRECL=80) 1 positional parameter Summary Prev.Pg. 1 keyword parameter Alberto Romano Schiesari – www.profars.com 138 DD Positional parameters There are 3, and they are mutually exclusives. Only 1 positional parameter is allowed. //FIL1 //FIL2 //FIL3 DD DD DD * DATA DUMMY 1 positional parameter Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 139 DD Positional parameters: DD * Specifies that the record(s) from the following one are one (in-stream) dataset. The last record is the record before the next with // in positions 1-2. //FILE1 DD * DATA RECORD 1 DATA RECORD 2 Arquivo in-stream com ddname ARQ1 DATA RECORD 3 //FILE2 DD Summary DSN=WFILE.TESTX,DISP=SHR Prev.Pg. Alberto Romano Schiesari – www.profars.com 140 DD Positional parameters: DD * Examples: //FILE1 DD * DATA RECORD 1 In-stream dataset (ddname = FILE1) DATA RECORD 2 DATA RECORD 3 //FILE2 DD * DATA RECORD 1 In-stream dataset (ddname = FILE2) DATA RECORD 2 DATA RECORD 3 //FILE3 DD DATA RECORD 1 DATA RECORD 2 * In-stream dataset (ddname = FILE3) DATA RECORD 3 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 141 DD Positional parameters: DD * Examples: //* FOLLOWING DATASET = TODAY’S TRANSACTIONS //FILE4 DD * DATA RECORD 1 In-stream dataset (ddname FILE4) DATA RECORD 2 DATA RECORD 3 //* FOLLOWIN DATASET = CONTROL DATA //FILE5 DD JUL/2009 Summary Prev.Pg. * In-stream dataset (ddname FILE5) Alberto Romano Schiesari – www.profars.com 142 DD Positional parameters: DD * Examples: //FILE4 DD * //* FOLLOWING DATASET = TODAY’S TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATSET = CONTROL DATA JUL/2009 Summary Prev.Pg. For Operating System is OK, but... It’s WRONG! Alberto Romano Schiesari – www.profars.com 143 DD Positional parameters: DD * Examples: //FILE4 DD * //* FOLLOWING DATASET = TODAY’s TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATASET = CONTROL DATA WHY ? JUL/2009 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 144 DD Positional parameters: DD Examples: In-stream data starting here //FILE4 DD * This statement (it has //) is understood by the system as end of FILE4 in-stream file (zero records); it is a “normal” JCL statement, a comment * //* FOLLOWING DATASET = TRANSACTION FILE First line is identified as a non-JCL statement (it doesn’t have // at position 1-2); it is meant to be the first record of an in-stream file, whose ddname is assumed to be SYSIN DATA RECORD 1 DATA RECORD 2 Another in-stream data file starting here DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATASET = CONTROL FILE JUL/2009 Summary This statement (it has //) is understood by the system as end of FILE5 in-stream file (zero records); it is a “normal” JCL statement, a comment This record is identified as a non-JCL statement (it doesn’t have // at position 1-2); it is meant to be the first record of an in-stream file, whose ddname is assumed to be SYSIN (it overrides the previous SYSIN dataset) Prev.Pg. Alberto Romano Schiesari – www.profars.com 145 DD Positional parameters: DD * THEN: This //FILE4 DD * //* FOLLOWING DATASET = TODAY’S TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATASET = CONTROL DATA JUL/2009 the system understands this way: FILE4 FILE5 SYSIN = (dataset with zero records) = (dataset with zero records) = dataset with 1 record (JUL/2009) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 146 DD Positional parameters: DD DATA Similar to DD *. Specifies that the statements that follow the DD DATA statement are an in-stream dataset. Last record of this dataset is the one contents is equal to the delimiter declared in the DLM keyword parameter. //FILE1 DD DATA,DLM=‘EOF*’ DATA RECORD 1 DATA RECORD 2 In-stream records for ARQ1 ddname dataset DATA RECORD 3 // THIS ISN’T A JCL STATEMENT ! EOF* //FILE2 DD Summary DSN=FILEWORK.TESTX,DISP=SHR Prev.Pg. Alberto Romano Schiesari – www.profars.com 147 DD Positional parameters: DD DUMMY Just for input files; specifies that the dataset does not exist (phisically – only logically). System pretends to the access method (when dataset is opened, read, or closed) that the dataset exists, but has no records (empty dataset). In other words: it is correctly opened, with no problems, at the 1st read the end-offile condition is triggered, it is correctly closed. It is a good alternative when program opens, reads and closes the dataset, even if dataset does not exist (the data won’t be used). Example: a program that reads 2 files: FILEA with transactions from the current month, and FILEB with transaction from past months of the year. In january (there is no past months in the year), FILEB can be a DD DUMMY file. //FILEB DD DUMMY //FILEA DD DSN=CURMONFI.TESTEX,DISP=SHR Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 148 DD Keyword Parameters Information related to the step, specified by keywords; so, they can be specified in any sequence. //ST01 EXEC PGM=LISTABND,COND=ONLY 2 keyword parameters Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 149 DD DSN Data Set Name = specifies the dataset external name, the dataset name for the operating system (its name for the program is the ddname) Ex.: //F1 DD DSN=ALB.WRK.FIL,DISP=SHR Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 150 DD DCB Summary Specifies the characteristics of the dataset. Some sub-parameters are: DSORG= (Data Set ORGanization) specifies the dataset organization. Main options: PO (Partitioned Organization = Partitioned Data Set = PDS) PS (Physical Sequential = Sequencial) EXPDT= (EXPiration DaTe) = specifies the date the datset may be deleted RETPD= (RETention PerioD) specifies the period in which the dataset, although expired, cannot be deleted LRECL= (Logical RECord Length) specifies the length, in bytes, og the logical record RECFM= (RECord ForMat) specifies the dataset records’ format. Main options : FB = Fixed Blocked F = Fixed (Unblocked) FBA = Fixed Blocked Asa FA = Fixed (Unblocked) Asa V = Variable (Unblocked) VB = Variable blocked U = Undefined BLKSIZE= (BLocKSIZE) specifies the length, in bytes, of the physical record (block) Ex.: //SYSIN DD DUMMY,DCB=(LRECL=80,RECFM=FB,BLKSIZE=800) Prev.Pg. Alberto Romano Schiesari – www.profars.com 151 DD LRECL Specifies the logical record length RECFM Specifies the logical record format: F (fixed), FB (fixed blocked), V (variable), VB (variable blocked) BLKSIZE Specifies the length of the physical records (blocks) DSORG EXPDT RETPD Summary Specifies the dataset organization: OS (physical sequential), PO (partitioned organization) Specifies the dataset expiration date Specifies the dataset retention period (in which it is not expired) Prev.Pg. Alberto Romano Schiesari – www.profars.com 152 DD DISP Disposition DISP=(a,b,c) specifies the action to be done with the dataset a = NEW (dataset must be created) or OLD (dataset is already exists; exclusive use) or SHR (shared – dataset already exists; shared use) or MOD (modify – dataset already exists; it will be extended) b = CATLG (dataset will be cataloged at the normal end of the program, if the program terminates normally) or UNCATLG (dataset will be uncataloged at the normal end of the program, if the program terminates normally) or DELETE (dataset will be deleted at the normal end of the program, if the program terminates normally) KEEP (dataset will be kept at the normal end of the program, if the program terminates normally) PASS (temporary dataset; it will be passed to the further steps) c = CATLG (dataset will be cataloged at the abnormal end of the program, if the program terminates abnormally) or UNCATLG (dataset will be uncataloged at the abnormal end of the program, if program terminates abnormally) or DELETE (dataset will be deleted at the abnormal end of the program, if the program terminates abnormally) KEEP (dataset will be kept at the abnormal end of the program, if the program terminates abnormally) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 153 DD UNIT Specifies where the dataset must be allocated. Generally (in development environments) : SYSDA or 3390 SYSOUT SYSOUT=class SYSOUT=(class,,formsname) SYSOUT=(class,writername,formsname) SYSOUT=(class,writername) SYSOUT=(class,INTRDR) Ex.: //SYSOUT DD SYSOUT=* Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 154 DD SPACE Summary SPACE= (a,(b,c),RLSE) or SPACE= (d,(b,c),RLSE) Specifies the amount of disk space to be allocated to the datase. a = TRK or CYL or ABSTR allocation unit : tracks, cylinders, or logical record length b = primary area amount c = secondary area amount (optional) d = logical record length RLSE = (ReLeaSE) (optional) specifies that if there is space left in the primary area after closing the file, this space must be released Prev.Pg. Alberto Romano Schiesari – www.profars.com 155 DD KEYOFF= KEY OFFset = specifies the key offset in the logical record (for VSAM KSDS datasets) KEYLEN= KEY LENgth = specifies the key length (for VSAM KSDS datsets) RECORG= RECord ORGanization = specifies the VSAM type: KS (KSDS), ES (ESDS), RR (RRDS) or LS (Linear Space) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 156 DD Examples : //OUTFIL // // DD DSN=ATAAABPS.EPC.SE62, DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(100,50)), UNIT=SYSDA,DCB=LRECL=83 //INFIL DD DSN=ATAAABPS.EPC.SLB005,DISP=SHR //EPCASLBS DD // // // // DSN=ATAAABPS.EPC.SE64(+1), DISP=(NEW,CATLG,DELETE), SPACE=(TRK,(100,50)), UNIT=SYSDA, DCB=LRECL=83 //EPCASLBS DD // // // // DSN=ATAAABPS.EPC.SE64(+1), DISP=(NEW,CATLG,DELETE), SPACE=(TRK,(100,50)), UNIT=SYSDA, DCB=(LRECL=83,BLKSIZE=830) //VKSDS1 DD DSN=DSVAABVS.LSG.A889.ALBERTO,DISP=(,CATLG,DELETE), // SPACE=(CYL,(10,10)),LRECL=100,KEYOFF=10, // KEYLEN=12,RECORG=KS Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 157 Library search Library search Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 158 Busca em bibliotecas There are in the system lists of libraries that must be searched when a member must be found. Some of these lists refer to: Executable programs JCL Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 159 Load module search Executable programs (load modules) search Operating system libraries SYS1.LINKLIB User libraries Ex.: SYS9.LINKLIB SYS9.EMPLK01 SYS8.USRRHLIB SYS7.EASYLIB etc Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 160 Load module search Load module search Normally the operating system libraries are automatically searched SYS1.LINKLIB etc The user libraries are searched if: - They are in the automatic search list - They are specified in the JOBLIB or STEPLIB statements Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 161 Load module search Load module search JOBLIB / STEPLIB These are special DDs that specify that na automatic search must be made in the libraries they refer. JOBLIB must be specified at the beginning of the JOB, and is by all EXECs of the job STEPLIB must be specified just after the EXEC statement, and the search in the library it refers to is made just for the step Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 162 Load module search Load module search JOBLIB example //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=A //JOBLIB DD DSN=SYS9.MYLIB,DISP=SHR //STEPX1 EXEC PGM=PGTST01 //ENTRADA DD DSN=ARQUIVOX,DISP=SHR //SAIDA DD SYSOUT=A //STEPX2 EXEC PGM=PGTST02 //DD1 DD DSN=ARQUIVOX,DISP=SHR //SYSOUT DD SYSOUT=A //STEPX3 EXEC PGM=PGTST03 //SYSIN DD DSN=ARQUIVOX,DISP=SHR //RELAT DD SYSOUT=A Summary Prev.Pg. - Programs PGTST01, PGTST02 and PGTST03 are searched at SYS9.MYLIB Alberto Romano Schiesari – www.profars.com 163 Load module search Load module search STEPLIB example //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=A //STEPX1 EXEC PGM=PGTST01 //STEPLIB DD DSN=SYS8.MYLIBX,DISP=SHR //ENTRADA DD DSN=ARQUIVOX,DISP=SHR //SAIDA DD SYSOUT=A //STEPX2 EXEC PGM=PGTST02 //STEPLIB DD DSN=SYS8.MYLIBY,DISP=SHR //DD1 DD DSN=ARQUIVOX,DISP=SHR //SYSOUT DD SYSOUT=A //STEPX3 EXEC PGM=PGTST03 //STEPLIB DD DSN=SYS8.MYLIBZ,DISP=SHR //SYSIN DD DSN=ARQUIVOX,DISP=SHR //RELAT DD SYSOUT=A Summary Prev.Pg. - Program PGTST01 is searched at SYS8.MYLIBX - Program PGTST02 is serached at SYS8.MYLIBY - Program PGTST03 is searched at SYS8.MYLIBZ Alberto Romano Schiesari – www.profars.com 164 JCL search JCL search Operating system libraries SYS1.PROCLIB User libraries Ex.: SYS9.PROCLIB SYS9.EMPROC1 SYS8.USRPROCL SYS7.PRODPROC etc Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 165 JCL search JCL search Normally the operating system libraries are automatically searched SYS1.PROCLIB The user libraries are searched if: - They are in the automatic search - They are specified in the JCLLIB statement Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 166 JCL search JCL search (procedures – PROCS) JCLLIB / INCLUDE It is a special DD that specifies that it must have search in the specified libraries. JCLLIB must be specified in the beginning of the JOB. To insert the JCL statements from a library (specified in the JCLLIB) member into the stream of JCL statement being built (by the reader / interpreter) use INCLUDE statement. See following example: Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 167 JCL search JCL search (procedures) JCLLIB / INCLUDE: example //LSG#@ARS JOB ('ALBERTO'),'ALBERTO',CLASS=1,MSGCLASS=X // JCLLIB ORDER=(JCL.SIST.SRC) // INCLUDE MEMBER=BIBPROD //*------------------------------------//STEP1 EXEC PGM=P001 //STEP2 EXEC PGM=P003 //STEP3 EXEC PGM=P004 If BIBPROD member of JCL.SIST.SRC dataset has the statement //STEPAUX EXEC PGM=SHOWTIME the submetted JCL is: //LSG#@ARS JOB ('ALBERTO'),'ALBERTO',CLASS=1,MSGCLASS=X //* JCLLIB ORDER=(JCL.SIST.SRC) //STEPAUX EXEC PGM=SHOWTIME //*------------------------------------//STEP1 EXEC PGM=P001 //STEP2 EXEC PGM=P003 //STEP3 EXEC PGM=P004 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 168 JCL search JCL search (procedures) JCLLIB / INCLUDE: another example //LSG#@ARS JOB ('ALBERTO'),'ALBERTO',CLASS=1,MSGCLASS=X // JCLLIB ORDER=(JCL.SIST.SRC) // INCLUDE MEMBER=BIBDESEN //*------------------------------------//STEP1 EXEC PGM=P001 //STEP2 EXEC PGM=P003 //STEP3 EXEC PGM=P004 If BIBDESEN member of JCL.SIST.SRC dataset has the statement //STEPAUX EXEC PGM=IEFBR14 the submitted JCL is: //LSG#@ARS JOB ('ALBERTO'),'ALBERTO',CLASS=1,MSGCLASS=X //* JCLLIB ORDER=(JCL.SIST.SRC) //STEPAUX EXEC PGM=IEFBR14 //*------------------------------------//STEP1 EXEC PGM=P001 //STEP2 EXEC PGM=P003 //STEP3 EXEC PGM=P004 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 169 PROCS PROCS Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 170 PROCS Procs = procedures = set of non-JOB and non-data statements. There are 2 types: q CATALOGED q IN-STREAM Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 171 PROCS q Summary CATALOGED procedures Prev.Pg. Alberto Romano Schiesari – www.profars.com 172 PROCS Cataloged procedures are those: - prepared - cataloged (as a member) in a PROCLIB so that they can be called for execution in the jobs - They cannot have JOB statement - Start with PROC statement - End with PEND statement - They cannot have in-stream data (but they can be inserted via override) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 173 PROCS Preparing the proc: - Edit with Roscoe / TSO and save it. Ex. //PROCDEMO PROC //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A // PEND - It is an “almost normal” JCL! - No JOB statement is allowed - Begins with PROC statement - Ends with PEND statement - No in-stream data allowed This proc has 3 steps (STEPX1, STEPX2 & STEPX3) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 174 PROCS Cataloging the proc: - Copy to a proclib. Ex. //CATAL //SAIDA //ENTRA EXEC PGM=IEBCOPY DD DSN=SYS9.PROCLIB(PROCDEMO) DD DATA,DLM=‘FINAL’ //PROCDEMO PROC //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A // PEND - Simple copy to a proclib member FINAL Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 175 PROCS Executing the proc: - Calling for execution. Ex. //ARSARS01 JOB (1234),’ALBERTO’,CLASS=T,MSGCLASS=R //S1 EXEC PROC=PROCDEMO 1ST CALL //S2 EXEC PROCDEMO 2ND CALL //STEPX1.INFILE DD * in-stream data (INFILE dataset, STEPX1 step, proc PROCDEMO) //S3 EXEC PROCDEMO 3RD CALL - Reader / interpreter finds PROCDEMO in a proclib to know how to expand it Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 176 PROCS q Summary IN-STREAM procs Prev.Pg. Alberto Romano Schiesari – www.profars.com 177 PROCS They are - declared at the beginning of the JOB - called for execution in the same JOB - JOB statement is not allowed - Must begin with a PROC statement - Must end with a PEND statement - In-stream data are not allowed Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 178 PROCS Declaring the Proc - Declared at the beginning of the JOB. Ex. //ARSARS01 JOB (1234),’ALBERTO’,CLASS=T,MSGCLASS=R //PROCDEMO PROC //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A - PROC declared at the //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR beginning of the JOB //OUFILE DD SYSOUT=A //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A // PEND //S1 EXEC PROC=PROCDEMO //* 1ST CALL //S2 EXEC PROCDEMO //* 2ND CALL //STEPX1.INFILE DD * in-stream data (INFILE dataset, STEPX1 step, proc PROCDEMO) //S3 EXEC PROCDEMO //* 3RD CALL Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 179 PROCS Calling the proc - Called for execution at the same job. Ex. //ARSARS01 JOB (1234),’ALBERTO’,CLASS=T,MSGCLASS=R //PROCDEMO PROC //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR - Reader / Interpreter DOES //OUFILE DD SYSOUT=A NOT GO to any PROCLIB in //STEPX1 EXEC PGM=PGTST01 order to expand the PROC; //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A - Expansion is done “inquiring” //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR the PROC-PEND block at the //OUFILE DD SYSOUT=A same job where it is referred to // PEND //S1 EXEC PROC=PROCDEMO //* 1ST CALL //S2 EXEC PROCDEMO //* 2ND CALL - PROC is called in the same job //STEPX1.ENTRADA DD * in-stream data (INFILE dataset, where it is declared STEPX1 step, proc PROCDEMO) //S3 EXEC PROCDEMO //* 3RD CALL Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 180 PROCs – symbolic parameters Symbolic parameters Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 181 PROCs – symbolic parameters In the following PROC : //SSSPRO1 //STEPA //DD1 //REPORT1 //STEPB //REPORT2 //STEPC //REPORT3 // PROC EXEC DD DD EXEC DD EXEC DD PEND PGM=PPPX1 DSN=ARQALB.DATA.DISP=SHR SYSOUT=A PGM=PPPX2 SYSOUT=A PGM=PPPX3 SYSOUT=A Everytime it is called, reports with ddname REPORT, REPORT2 & REPORT3 are class A output. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 182 PROCs – symbolic parameters To provide flexibility, one may leave the class able to be modified when PROC is invoked. This is possible via symbolic parameters: //SSSPRO1 //STEPA //DD1 //REPORT1 //STEPB //REPORT2 //STEPC //REPORT3 // PROC EXEC DD DD EXEC DD EXEC DD PEND PGM=PPPX1 DSN=ARQALB.DATA.DISP=SHR SYSOUT=&REPCLA PGM=PPPX2 SYSOUT=&REPCLA PGM=PPPX3 SYSOUT=&REPCLA This way the class is NOT specified. - CLASS must have a default value or - CLASS must be specified when PROC is invoked (if not specified, default value is assumed) Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 183 PROCs – symbolic parameters If there isn’t default value: JCL error. When this in-stream PROC is expanded //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=B //SSSPRO1 PROC //STEPA EXEC PGM=PPPX1 //DD1 DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=&REPCLA // PEND //* //S1 EXEC SSSPR01 the system won’t know what class must me associated to reports DD’s REPORT1, REPORT2 & REPORT3 in STEP S1. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 184 PROCs – symbolic parameters One alternative to specify the default value is via PROC statement. //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=B //SSSPRO1 PROC REPCLA=* //STEPA EXEC PGM=PPPX1 //DD1 DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=&REPCLA // PEND //* //S1 EXEC SSSPR01 System knows that the 3 DD’s are SYSOUT=*, due to the default specification at PROC statement. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 185 PROCs – symbolic parameters (to override it) To change the default value : One must specify the new value when PROC is invoked. //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=B //SSSPRO1 PROC REPCLA=* //STEPA EXEC PGM=PPPX1 //DD1 DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=&REPCLA // PEND //* //S1 EXEC SSSPR01,REPCLA=A System knows that the 3 DDs are SYSOUT=A, due to the override Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 186 PROCs – symbolic parameters (override) In this case //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=B //SSSPRO1 PROC REPCLA=* //STEPA EXEC PGM=PPPX1 //DD1 DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=&REPCLA // PEND //* //S1 EXEC SSSPR01,RELCLA=A //S2 EXEC SSSPR01 System knows that the 3 step S1 DDs are SYSOUT=A and the 3 step S2 DD’s are SYSOUT=* Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 187 PROCs – symbolic parameters (override) One can alter only the desired DDs: //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=B //SSSPRO1 PROC REPCLA=* //STEPA EXEC PGM=PPPX1 //DD1 DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=&REPCLA // PEND //* //S1 EXEC SSSPR01,REPCLA.STEPA=A,REPCLA.STEPC=R //S2 EXEC SSSPR01,REPCLA.STEPB=X System knows that: REPORT1, STEPA, procstep REPORT1, STEPB, procstep REPORT1, STEPC, procstep REPORT1, STEPA, procstep REPORT1, STEPB, procstep REPORT1, STEPC, procstep Summary Prev.Pg. S1 S1 S1 S2 S2 S2 : : : : : : SYSOUT=A SYSOUT=* SYSOUT=R SYSOUT=* SYSOUT=X SYSOUT=* Alberto Romano Schiesari – www.profars.com 188 PROCs – symbolic parameters To override symbolic parameters default values, one must specify the new value in when proc is invoked. : . ddname step_name=xxx Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 189 PROCs – symbolic parameters Another way to change default, valid for the whole or part of the job, is via SET command: Syntax : //[name] SET symbolic_variable=[value] //SSSPRO1 PROC //STEPA EXEC PGM=PPPX1 //DD1 DD DSN=... //SYSPRINT DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //SYSPRINT DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //SYSPRINT DD SYSOUT=&REPCLA // PEND // SET REPCLA=A //STEP1 EXEC SSSPR01 //STEP2 EXEC SSSPR01 //STEP3 EXEC SSSPR01 //STEP4 EXEC SSSPR01 //STEP5 EXEC SSSPR01 // SET REPCLA=B //STEP6 EXEC SSSPR01 //STEP7 EXEC SSSPR01 //STEP8 EXEC SSSPR01 //STEP9 EXEC SSSPR01 //STEP10 EXEC SSSPR01 Steps 01, 02, 03, 04 and 05 have REPCLA value A Steps 06, 07, 08, 09 and 10 have RELCLA value B Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 190 PROCs – including DD in the proc Including DD in the proc Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 191 PROCS – including DD in the proc If you need to include a DD (there is no such DD in the PROC, it must be included to the step’s DDs) : . //stepname ddname DD parameters Ex.: //S2 EXEC SSSPR01,REPCLA.STEPB=X //STEPB.REPOTHER DD SYSOUT=* Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 192 PROCS – including datasets in the proc Including datasets Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 193 PROCs – includind datasets Additional dataset: If it is necessary to include a dataset (there is no such DD in the PROC, it must be included to the step’s DDs): . //stepname ddname DD parameters Ex.: //S2 EXEC SSSPR01,REPCLA.STEPB=X //STEPB.REPOTHER DD SYSOUT=* Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 194 PROCs – including datasets To include one more dataset in a concatenation sequence: To include one additional dataset (to concatenate) in na existing DD: specify 1 DD for each existant DD, without parameters, and add the desired one as the last DD. //stepnameddname DD // DD // DD new_dataset Example : //STEP1 EXEC PROCX1 //STEPA.DD2 DD // DD // DD DSN=TST.ARQUIVOX... Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 195 PROCs – changing EXEC parameters Changing EXEC parameters Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 196 PROCs – changing EXEC paameters When invoking the PROC, specify the parameter and stepname you wish to change: //stepname EXEC PROC=xxx,parameter.stepname=value Ex.: //S2 EXEC SSSPR01,RELCLA.STEPB=X,PARM.STEPB=‘YES’ //STEPB.RELOUTRO DD SYSOUT=* Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 197 JCL – IF / THEN / ELSE / ENDIF IF / THEN / ELSE / ENDIF Commands Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 198 JCL – IF / THEN / ELSE / ENDIF These commands coan be used rather than COND (and they’re easyer to understand...). Syntax : // IF (condition) THEN statements to execute if condition is TRUE // ENDIF or // IF (condition) THEN statements to execute if condition is TRUE // ELSE statements to execute if condition is FALSE // ENDIF Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 199 JCL – IF / THEN / ELSE / ENDIF Condition = indicates that the statements below THEN must be executed if condition is TRUE. The tests may be as follows: Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 200 JCL – IF / THEN / ELSE / ENDIF To test the previous’ step return code: [stepname.]RC [stepname.]RC [stepname.]RC [stepname.]RC [stepname.]RC [stepname.]RC [stepname.]RC [stepname.]RC Summary Prev.Pg. EQ GT LT NE NL NG GE LE return_code return_code return_code return_code return_code return_code return_code return_code or or or or or or or Alberto Romano Schiesari – www.profars.com 201 JCL – IF / THEN / ELSE / ENDIF To test whether a previous step was executed or not (not flushed or flushed) : [stepname.]RUN EQ TRUE ou [stepname.]RUN EQ FALSE [stepname.]RUN EQ TRUE ou [stepname.]RUN EQ FALSE Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 202 JCL – IF / THEN / ELSE / ENDIF To test whether a previous step has abended or not: [stepname.]ABEND EQ TRUE [stepname.]ABEND EQ FALSE or [stepname.]ABEND EQ TRUE or [stepname.]ABEND EQ FALSE Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 203 JCL – IF / THEN / ELSE / ENDIF To test a previous’ step Completion Code (system or user) : [stepname.]ABENDCC EQ Snnn or [stepname.]ABENDCC EQ Unnnn [stepname.]ABENDCC EQ Snnn [stepname.]ABENDCC EQ Unnnn Summary Prev.Pg. or Alberto Romano Schiesari – www.profars.com 204 JCL – IF / THEN / ELSE / ENDIF Multiple contitions: Use parenthesis to specify test priority and sequence. Use & for and Use | for or Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 205 JCL – IF / THEN / ELSE / ENDIF ENDIF is mandatory to specify the end of the set of commands to be executed, with or withot ELSE. ELSE is optional. IMPORTANT : Use of COND + IF / THEN / ELSE / ENDIF together is extremely confusing. DON’T DO THAT! Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 206 JCL – IF / THEN / ELSE / ENDIF Example : //ARSARS01 JOB (1234),'ROMANO',CLASS=1,MSGCLASS=X //*-----------------------------------------------------------//STEP01 EXEC PGM=IEFBR14 //STEP02 EXEC PGM=IEFBR14 // IF (STEP01.RC NG 0) THEN //STEP03 EXEC PGM=IEFBR14 // ENDIF //*-----------------------------------------------------------//STEP04 EXEC PGM=IEFBR14 // IF ((STEP01.RC EQ 0)) THEN //STEP05 EXEC PGM=IEFBR14 // ELSE //STEP06 EXEC PGM=IEFBR14 // ENDIF //*-----------------------------------------------------------//STEP07 EXEC PGM=IEFBR14 // IF ((STEP01.RUN EQ TRUE)) THEN //STEP08 EXEC PGM=IEFBR14 // ENDIF // IF ((STEP01.RUN EQ FALSE)) THEN //STEP09 EXEC PGM=IEFBR14 // ENDIF The execution of this JCL results in: Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 207 JCL – IF / THEN / ELSE / ENDIF Example : $HASP373 LSG#@ARS STARTED - INIT 2 IEF403I LSG#@ARS - STARTED - TIME=14.52.18 # # JOBNAME STEPNAME PROCSTEP PROGRAM RC # LSG#@ARS STEP01 IEFBR14 00 # LSG#@ARS STEP02 IEFBR14 00 # LSG#@ARS STEP03 IEFBR14 00 # LSG#@ARS STEP04 IEFBR14 00 # LSG#@ARS STEP05 IEFBR14 00 # LSG#@ARS STEP06 IEFBR14 FLUSH # LSG#@ARS STEP07 IEFBR14 00 # LSG#@ARS STEP08 IEFBR14 00 # LSG#@ARS STEP09 IEFBR14 FLUSH IEF404I LSG#@ARS - ENDED - TIME=14.52.19 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 208 Appendix - CONTROL’s – BMC Software Produto Função Control-M Automated Production Control and Scheduling System Manages and automates the setup, scheduling and execution of jobs in the data center. Control-M / Restart Restart Management System Automates the activities that must be performed when restarting failed jobs, including the scratching and uncataloging of datasets created by failed jobs. Control-M / Tape Removable Media Management System Increases utilization of removable media and controls retention periods. Prevents misuse of media, and provides tape library and vault control. Control-M / Analyser Automated Information Integrity System Performs in-stream validation, accuracy, and reasonability checks on information used by data center production tasks (for example, reports, databases). Control-D Output Management System Automatically schedules and controls every aspect of report processing and distribution, including report decollating, bundling, printing, online viewing, and archiving. Control-V Quick Access Archive Viewing System Provides online access to archived reports and documents by indexed data retrieval Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 209 CONTROL’s – BMC Software Produto Função Control-D / Page on demand Report Retrieval and Display System Enables end users to retrieve and view pages of reports that reside on mainframe storage in real time. Indexed reports can be retrieved by index name and value. AFP and XEROX reports can also be retrieved and displayed using CONTROL-D/Web Access Server or CONTROL-D/Page On Demand API. Control-D / Image Image Output Management System Enables output from commercial imaging equipment to be imported into either CONTROL-D or CONTROL-V for decollation, distribution and viewing, and into CONTROL-V for archiving and indexed retrieval. Control-O Console Automation System and Desired State Monitoring System Monitors and automatically responds to messages, commands, and dataset events, as well as various other system events. The CONTROL-O/COSMOS feature allows for status monitoring while maintaining all critical system objects in a desired and ideal status. Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 210 THE END Summary Prev.Pg. Alberto Romano Schiesari – www.profars.com 211