Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS JCL concepts.

Similar presentations


Presentation on theme: "1 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS JCL concepts."— Presentation transcript:

1 1 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS JCL concepts

2 2 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Presentation Thanks for using this presentation. You are free to use it. I appreciate if you refer to the author when using it. Im sorry about the language errors; my english isnt so good; Ill 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 arschiesari@yahoo.com

3 3 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 - CONTROLs

4 4 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Concepts IBM main operating systems see http://publib.boulder.ibm.com/infocenter/zos/basics/index.jsp

5 5 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Concepts – IBM main operating systems IBM main operating systems DOS or VSE line DOS (1966) DOS/VS (1972) DOS/VSE (80s) VSE/ESA (1991) z/VSE (2005)

6 6 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com IBM main operating systems VM line VM/370 (1972) VM/SP (1980) VM/XA (1988) VM/ESA (1990) z/VM (2000) Concepts – IBM main operating systems

7 7 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Conceitos IBM main operating systems Real-time (transactional) line ACP (1969) TPF (1979) z/TPF (2005) Concepts – IBM main operating systems

8 8 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Conceitos IBM main operating systems Unix-like line UTS (1981) AIX/370 (1990) AIX/ESA (1991) LINUX (1999) Open Solaris (2008) Concepts – IBM main operating systems

9 9 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Conceitos MVS line MFT (1966) ; OS/VS1 (1972) (end) MVT (1967) Concepts – IBM main operating systems 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) IBM main operating systems

10 10 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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) Concepts – IBM main operating systems

11 11 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Conceitos Curiosity: example of a DOS (PCs) 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 Concepts – IBM main operating systems

12 12 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 Concepts – IBM main operating systems

13 13 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 Concepts – IBM main operating systems

14 14 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 Concepts – IBM main operating systems

15 15 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS line – executing services demand Executing services demand

16 16 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS line – executing services demand BE CAREFUL! ACHTUNG! Everything youre gonna see/read/listen is OK for BACTH applications !

17 17 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS line – executing services demand BE CAREFUL! ACHTUNG! Everything youre gonna see/read/listen is OK for BACTH applications !

18 18 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS line – general flow General flow System Service Input (execution order) Result Output basically: print (paper or terminal)

19 19 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS line – general flow General flow SYSTEM Service Input (execution order) ? How do services get into the system?

20 20 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS line – general flow General flow SYSTEM Result Output basically: print (paper or terminal) ? How do results get out of the system?

21 21 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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)

22 22 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Therefore: Service Input (execution order) Result Output (basically: print on paper or terminal) JES2 JES2 components that receive the inputs JES2 components that send the results out

23 23 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com z/OS Operating system JES2 In other words: Service Input (execution order) Component 1... Component 2... JES2 Component n... Application 1 Application 2... Apllication n (ex.:CICS)... Application x (ex.: DB2)... Application z... Result Output (basically: print on paper or terminal)

24 24 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 For example: Services input via terminal (sub command ) Results output browse via terminal (job sysout browse) z/OS Operating system Component 1... Component 2... JES2 Component n... Application 1 Application 2... Apllication n (ex.:CICS)... Application x (ex.: DB2)... Application z...

25 25 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 But... We have to remember that: Terminals for SUB (they MUST be associated to an application program !!!) z/OS Operating system Component 1... Component 2... JES2 Component n... Application 1 Application 2... Apllication n (ex.:CICS)... Application x (ex.: DB2)... Application z... Terminals for BROWSE (they MUST be associated to an application program !!!)

26 26 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 What is (are) this (these) application program(s)? What is the application program responsible for this terminal? z/OS Operating system Component 1... Component 2... JES2 Component n... Application 1 Application 2... Apllication n (ex.:CICS)... Application x (ex.: DB2)... Application z... What is the application program responsible for this terminal?

27 27 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 It may be Roscoe... Roscoe sends the services to the JES2 ROSCOE Roscoe gets the results from JES2

28 28 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Or TSO... TSO TSO sends the services to the JES2 TSO gets the results from JES2

29 29 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 But, even either Roscoe or TSO... The terminal is just a visual interface Roscoe or TSO The terminal is just a visual interface

30 30 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Where are, in fact, the data? Where is the stream we built and submitted? Roscoe or TSO Where is the sysout being accessed to browse?

31 31 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 In disk ! In the spool areas ! Roscoe or TSO INPUT spool area Output spool area

32 32 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 JOB input Lets see some details about spool input process Roscoe or TSO Input spool area

33 33 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Roscoe LIBs (proprietary data organization) (SAVE or UPDATE) JOB input – TSO/ROSCOE NOTE : use of ROSCOE (data manipulation via AWS)... Roscoe Roscoe work area (AWS) (create / FETCH/ATTACH)

34 34 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Sequential dataset JOB input – TSO/ROSCOE NOTE :... or TSO (data manipulation directly in the normal datsets areas) TSO Partitioned dataset member

35 35 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Edited data To be submitted JOB input – TSO/ROSCOE NOTE : well refer to data manipulation using Roscoe or TSO using this figure TSO/Roscoe

36 36 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input – TSO/ROSCOE Step 1 = edit data to be submitted TSO/Roscoe Edited data To be submitted

37 37 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input – TSO/ROSCOE Step 1 = edit data to be submitted TSO/Roscoe //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---------*

38 38 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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)

39 39 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input – TSO/ROSCOE A c-a-r-e-f-u-l analysys of the data to be submitted... TSO/Roscoe //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---------*

40 40 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

41 41 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 * Red = JCL Blue = data Step C, SYSIN dataset data Step G, AGENCIAS dataset data

42 42 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input – TSO/ROSCOE Getting back to the relationship between Roscoe and JES... TSO/Roscoe //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---------*

43 43 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 JOB input – TSO/ROSCOE TSO/Roscoe Input spool area Edited data Roscoe submits (delivers) the stream that came from AWS to JES... SUB

44 44 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 JOB input – TSO/ROSCOE TSO/Roscoe Input spool area AWS The JES component that reads the things somebody (Roscoe, TSO...) submitted is (are) the READER(s) / INTERPRETER(s) SUB Reader

45 45 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com AWS JES2 JOB input – TSO/ROSCOE Input spool area 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 (thats because the interpreter) Readers TSO Roscoe SUB SUB Normal datasets

46 46 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com AWS JES2 JOB input Input spool area Lets see better the input spool area Readers TSO Roscoe SUB SUB Normal datasets

47 47 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input Input spool area : the archieving unit is the JOB JOB0001 JOB0002JOB0003 JOB0004JOB0005 JOB0006 JOB0007 JOB0008 Etc...

48 48 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 JOB0002JOB0003 JOB0004JOB0005 JOB0006 JOB0007 JOB0008 Etc...

49 49 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input The JOBS remains in the queue awaiting execution. JOB0001 JOB0002JOB0003 JOB0004JOB0005 JOB0006 JOB0007 JOB0008 Etc...

50 50 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input Lets see some details about how the Jobs are stored. Lets detail one of them (JOB0001): JOB0001 ALL JCL records (statements) (one single dataset) For each in-stream dataset in the submitted stream, is created a file identified with stepname + DDname

51 51 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

52 52 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input The input spool data related to JOB0001 is as follows: 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 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=TOT=YES' //STEP2 EXEC PGM=PGTST02

53 53 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input Example: if this stream is submitted (ref. JOB0002) //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=TOT=YES' //STEP2 EXEC PGM=PGTST02 //STEP3 EXEC PGM=IDCAMS //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE DES.ALB.A001 PURGE /* DELETE DATASET */

54 54 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input The input spool related to JOB0002 is as follows: JOB0002 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=TOT=YES' //STEP2 EXEC PGM=PGTST02 //STEP3 EXEC PGM=IDCAMS //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD * Step=STEP3 ; DD=SYSIN DELETE DES.ALB.A001 PURGE /* DELETA DATASET */ //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=TOT=YES' //STEP2 EXEC PGM=PGTST02 //STEP3 EXEC PGM=IDCAMS //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE DES.ALB.A001 PURGE /* DELETA DATASET */

55 55 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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---------*

56 56 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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---------*

57 57 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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=G ; DD=AGENCIAS 0001NOME DA AGENCIA 0001---------* 0002NOME DA AGENCIA 0002---------* 0003NOME DA AGENCIA 0003---------* 0004NOME DA AGENCIA 0004---------* 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

58 58 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input In fact, JCL is already EXPANDED (details when well see PROCs) JOB1234 1 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O 2 //STEP1 EXEC ASMACLG 3 XXASMACLG PROC 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=* 18 //G.SYSOUT DD SYSOUT=* 19 //G.AGENCIAS DD *

59 59 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input FINALLY !!! JOB1234 final format is: JOB1234 1 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O 2 //STEP1 EXEC ASMACLG 3 XXASMACLG PROC 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=* 18 //G.SYSOUT DD SYSOUT=* 19 //G.AGENCIAS DD * Step=G ; DD=AGENCIAS 0001NOME DA AGENCIA 0001---------* 0002NOME DA AGENCIA 0002---------* 0003NOME DA AGENCIA 0003---------* 0004NOME DA AGENCIA 0004---------* 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

60 60 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input OK? No doubts? Well talk about that again soon... JOB1234 1 dataset with all JCL, already expanded Step=ssssssss ; DD=dddddddd 1 dataset for each in-stream dataset

61 61 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB input Getting back to the matter, there was a queue of JOBs waiting for execution... JOB0001 JOB0002JOB0003 JOB0004JOB0005 JOB0006 JOB0007 JOB0008 Etc...

62 62 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com z/OS Operating System JOB input For job execution, there are other system components: the INITIATORs Component 1... Initiators JES2 Component n... Application program 1 Application program o 2... Application program n (ex.:CICS)... Application program x (ex.: DB2)... Application program z... Input spool area JOBS Selection for execution

63 63 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution They (the INITIATORs) do the selection (pick up 1 at a time) of the waiting-for-execution job(s) and begin their execution. Initiators Input spool Area JOBS Selection for execution What is the criteria for the selection? The JOB class.

64 64 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 INIT 1 : server for jobs class A, B and C; in the example, this INIT will select the jobs 0001 e 0002. Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc... INIT 2 : server for jobs class D, E and F; in the example, this INIT will select the jobs 0004 e 0005. While there is no INIT serving classes R and/or T, the jobs 0003 and 0006 wont be executed (selected for execution)

65 65 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

66 66 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 INIT 1 : serves jobs with classes A, B and C; in the example, INIT 1 will select jobs 0001 and 0002. Selection priority: basically FIFO (First In First Out) Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc...

67 67 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution INIT 1 selected JOB0001 INIT 1 : selected JOB0001 for execution Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc...

68 68 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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. Process each STEP Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc...

69 69 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution 1 st. 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...

70 70 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution ( Starting parenthesis...

71 71 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

72 72 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution ) Ending parenthesis...

73 73 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution 1 st. 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 programs 1st instruction. In other words, (talking in assemblish...): INIT orders the BALR 14,15 to transfer control to the program.

74 74 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution 1 st. 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. Thats 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.

75 75 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution 1 st. 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.

76 76 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution JOB1234 1 //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O 2 //STEP1 EXEC ASMACLG 3 XXASMACLG PROC 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=* 18 //G.SYSOUT DD SYSOUT=* 19 //G.AGENCIAS DD * Step=G ; DD=AGENCIAS 0001NOME DA AGENCIA 0001---------* 0002NOME DA AGENCIA 0002---------* 0003NOME DA AGENCIA 0003---------* 0004NOME DA AGENCIA 0004---------* 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 Program reads directly from here 1 st. step :

77 77 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution 1 st. 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.

78 78 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution 2 nd. 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...

79 79 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution OK? Job input OK?

80 80 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Execution Time to start understanding output spooling system

81 81 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Result output (reports) A bunch of people access data from the output spool. Roscoe (CA software) or TSO (IBM software) Output spool area Control (BMC softwares)

82 82 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Result output (reports) Who writes on the output spool? Application programs Output spool area Operating System and its components (including JES2)

83 83 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Result output (reports) Everybody prints something... Application programs and operating system. Application programs Output spool area Operating System and its components (including JES2)

84 84 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Result output (reports) But... In fact, only JES2 really writes. Do you know why? Application Programs Output spool area Operating System and its components (including JES2)

85 85 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 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 Application programs Output spool area Operating System and its components (including JES2)

86 86 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Result output (reports) What about the operating system outputs? They are redirected to where especified at MSGCLASS=xxx Output spool area Operating system and its components (including JES2)

87 87 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Result output (reports) What about the application programs output? They are redirected to where especified at SYSOUT=xxx Output spool area Application programs

88 88 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Result output (reports) But what is that xxx? Application programs ? Operating Systems and its components (including JES2)

89 89 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JES2 Result output (reports) It is the output class. Application Programs There is n datsets for each job, Each one has an associated class Opertating System and its components (including JES2)

90 90 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB 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.JESJCL, class R Line 1 Relat1... Etc... JOB1234, file JES2.JESYSMSG, class R Line 1 Relat2... Etc... JOB1234, file JES2.JESMSGLG, class R Line 1 file 1... Etc...

91 91 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

92 92 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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=*

93 93 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 Continua na próxima página

94 94 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Result output (reports) 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 Continuação JES2.JESYSMSG example (truncated at right)

95 95 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Application Program (my program) Result output (reports) Lets 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, 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... JOB1234, JES2.JESMSGLG, class R JOB1234, JES2.JESJCL, class R JOB1234, JES2.JESMSGLG, class R Operating System

96 96 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Writer serves B class datasets Writer serves R class datasets 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, 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... JOB1234, JES2.JESMSGLG, class R JOB1234, JES2.JESJCL, class R JOB1234, JES2.JESMSGLG, class R

97 97 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Writer serves B class datasets Writer serves R class datasets 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. Thats what happen when we access sysouts Roscoe, TSO or CONTROL-V. 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... JOB1234, JES2.JESMSGLG, class R JOB1234, JES2.JESJCL, class R JOB1234, JES2.JESMSGLG, class R

98 98 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL Its JCL time

99 99 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL JCL = Job Control Language = language to ask operating system to execute services/tasks

100 100 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL All languages must have its commands. In JCL, there are 3 main commands: JOB, EXEC and DD Before starting with the details, lets see some basics

101 101 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax Basic syntax

102 102 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax Always: // at positions 1-2 Comments: //* at positions 1-3

103 103 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax · 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) Continuation statements

104 104 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax Example (first 2 lines are rulers to use as a reference to the statement positions) : Continuation statements. 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

105 105 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax Most common problems Continuation statements. 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA DD DSN=SYS5.LINKLIB // DISP=SHR BIBLIOTECA DE UTILITARIOS HOME MADE Here there is no comma after; therefore DISP=SHR wasnt 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).

106 106 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax Most common problems Continuation statements. 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA DD DSN=SYS5.LINKLIB, // DISP=SHR COMENTARIO Continuation begins at position 17; its wrong (maximum allowed for the beginning is position 16)

107 107 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax. 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA DD DSN=SYS5.LINKLIB, //DISP=SHR COMENTARIO Continuation at position 3 (wrong: minimum is position 4) Most common problems Continuation statements

108 108 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax. 1 2 3 4 5 6 7.. 123456789012345678901234567890123456789012345678901234567890123456789012 //ENTRADA DD DSN=SYS5.LINKLIB, DISP=SHR Continuation statement (second statement) hasnt // 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) Most common problems Continuation statements

109 109 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – Basic sintax Summary – statement syntax 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) 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 Parameter(s); it/they may be of two types: posicional : depend on the position (sequence of specification) or keyword : followed by = sign If there is only positional parameter(s), they must be specified in the correct sequence If there is only keyword parameter(s), they may be specified in any sequence If there is both positional and keyword operands, the positional (in the correct sequence) must be specified before the keyword ones (in any sequence) Comments; it must have at least one blank after the operand(s) specification, before comments

110 110 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com O JOB as a whole - overwiew JOB as a whole – overview

111 111 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com O JOB as a whole - overwiew Overview

112 112 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB – Overview JOB EXEC (for the 1st step) DD 1 (for the 1st step).. DD n (for the 1st step) EXEC (for the 2nd step) DD 1 (for the 2nd step).. DD n (for the 2nd step) EXEC (for the 3rd step) DD 1 (for the 3rd step).. DD n (for the 3rd step) JOB 1st Step 2nd Step 3rd Step Job start delimiter 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)

113 113 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB – Overview For the steps: Remember that DDs are opcional. If a program does not use datasets, no DDs 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.

114 114 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB – Overview //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... If, for instance, the 2nd step EXEC has na operation code error, it isnt identified as a EXEC and therefore it does not identify another new step delimiter, and therefore its DDs are considered as belonging to the 1st step DDs. As 2nd EXEC is in error, it doesnt delimits the 2nd step beginning. All blue statements are the 1st step statements The green ones are the 2nd step statements

115 115 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 * DSN SYSTEM(DB1D) RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) - LIB('SYS1.DSNDB1D.RUNLIB.LOAD') – PARMS('/ALIGN(MID)') END //SYSIN DD * SELECT CD_AGE, NM_AGE FROM DB2T.ZZZ100_CADAGE WHERE CD_AGE > 20 AND CD_AGE < 100; PAGE 1 ***INPUT STATEMENT: SELECT CD_AGE, NM_AGE FROM DB2T.ZZZ100_CADAGE WHERE CD_AGE > 20 AND CD_AGE < 100; +----------------------------------+ | CD_AGE | NM_AGE | +----------------------------------+ 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 | +----------------------------------+

116 116 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB – Commands Commands

117 117 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL - Comandos There are 3 main JCL commands: JOB, EXEC and DD Lets see them.

118 118 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB

119 119 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB Sintax : //jobname JOB positional_parameters,keyword_parameters

120 120 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB Example : //PDR001P2 JOB (B281),ALBERTO,MSGCLASS=X,CLASS=R 2 positional parameters 2 keyword parameters

121 121 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 2 keyword parameters

122 122 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 2 keyword parameters

123 123 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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.

124 124 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB TIME= indicates the maximum amount of CPU usage allowed for the JOB; 1440 = specifies that theres no CPU limit Keyword parameters

125 125 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB MSGCLASS= Specifies the sysout class for the messages related to the JOB (as specified in MSGLEVEL) Keyword parameters

126 126 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB MSGVEVEL= 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 Keyword parameters

127 127 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JOB 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 Keyword parameters

128 128 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com EXEC

129 129 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com EXEC Sintax : //stepname EXEC positional_parameter,keyword_parameters

130 130 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com EXEC Example : //VERIFY EXEC P756,COND=EVEN,PARM.S1= T=YES 1 positional parameter 2 parameters keyword

131 131 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

132 132 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

133 133 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

134 134 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com EXEC PARM= Data to be passed as parameters (arguments) to the called program. Ex.: PARM='NOSEQ,QUOTE,OFFSET,LIB' PARM= ' JAN/2003'

135 135 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 executes PROC named TST01 //STEP2 EXEC PROC=TST01 executes PROC named TST01 //STEP1 EXEC PGM=TST01 executes program named TST01

136 136 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD DD (Data Definition)

137 137 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Sintax : //filename DD positional_parameters,keyword_parameters

138 138 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Example : //INFILE DD *,DCB=(LRECL=80) 1 positional parameter 1 keyword parameter

139 139 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Positional parameters There are 3, and they are mutually exclusives. Only 1 positional parameter is allowed. //FIL1 DD * //FIL2 DD DATA //FIL3 DD DUMMY 1 positional parameter

140 140 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 DATA RECORD 3 //FILE2 DD DSN=WFILE.TESTX,DISP=SHR Arquivo in-stream com ddname ARQ1

141 141 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Positional parameters: DD * Examples: //FILE1 DD * DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE2 DD * DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE3 DD * DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 In-stream dataset (ddname = FILE1) In-stream dataset (ddname = FILE2) In-stream dataset (ddname = FILE3)

142 142 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Positional parameters: DD * Examples: //* FOLLOWING DATASET = TODAYS TRANSACTIONS //FILE4 DD * DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //* FOLLOWIN DATASET = CONTROL DATA //FILE5 DD * JUL/2009 In-stream dataset (ddname FILE4) In-stream dataset (ddname FILE5)

143 143 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Positional parameters: DD * Examples: //FILE4 DD * //* FOLLOWING DATASET = TODAYS TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATSET = CONTROL DATA JUL/2009 For Operating System is OK, but... Its WRONG!

144 144 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Positional parameters: DD * Examples: //FILE4 DD * //* FOLLOWING DATASET = TODAYs TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATASET = CONTROL DATA JUL/2009 WHY ?

145 145 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Positional parameters: DD * Examples: //FILE4 DD * //* FOLLOWING DATASET = TRANSACTION FILE DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATASET = CONTROL FILE JUL/2009 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 First line is identified as a non-JCL statement (it doesnt 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 Another in-stream data file starting here In-stream data starting here 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 doesnt 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)

146 146 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD Positional parameters: DD * THEN: This //FILE4 DD * //* FOLLOWING DATASET = TODAYS TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATASET = CONTROL DATA JUL/2009 the system understands this way: FILE4 = (dataset with zero records) FILE5 = (dataset with zero records) SYSIN = dataset with 1 record (JUL/2009)

147 147 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 DATA RECORD 3 // THIS ISNT A JCL STATEMENT ! EOF* //FILE2 DD DSN=FILEWORK.TESTX,DISP=SHR In-stream records for ARQ1 ddname dataset

148 148 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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-of- file 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 wont 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

149 149 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

150 150 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

151 151 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD DCB 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)

152 152 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 Specifies the dataset organization: OS (physical sequential), PO (partitioned organization) EXPDT Specifies the dataset expiration date RETPD Specifies the dataset retention period (in which it is not expired)

153 153 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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)

154 154 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD UNIT Specifies where the dataset must be allocated. Generally (in development environments) : SYSDA or 3390 SYSOUTSYSOUT=class SYSOUT=(class,, formsname) SYSOUT=(class,writername,formsname) SYSOUT=(class,writername) SYSOUT=(class, INTRDR) Ex.: //SYSOUT DD SYSOUT=*

155 155 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com DD SPACESPACE= (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

156 156 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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)

157 157 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

158 158 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Library search

159 159 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

160 160 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

161 161 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

162 162 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

163 163 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 - Programs PGTST01, PGTST02 and PGTST03 are searched at SYS9.MYLIB

164 164 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 - Program PGTST01 is searched at SYS8.MYLIBX - Program PGTST02 is serached at SYS8.MYLIBY - Program PGTST03 is searched at SYS8.MYLIBZ

165 165 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL search Operating system libraries SYS1.PROCLIB User libraries Ex.: SYS9.PROCLIB SYS9.EMPROC1 SYS8.USRPROCL SYS7.PRODPROC etc

166 166 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

167 167 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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:

168 168 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

169 169 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

170 170 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCS

171 171 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCS Procs = procedures = set of non-JOB and non-data statements. There are 2 types: CATALOGED IN-STREAM

172 172 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCS CATALOGED procedures

173 173 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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)

174 174 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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)

175 175 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCS Cataloging the proc: - Copy to a proclib. Ex. //CATAL EXEC PGM=IEBCOPY //SAIDA DD DSN=SYS9.PROCLIB(PROCDEMO) //ENTRA 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 FINAL - Simple copy to a proclib member

176 176 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

177 177 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCS IN-STREAM procs

178 178 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

179 179 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCS - 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 //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 //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 Declaring the Proc - PROC declared at the beginning of the JOB

180 180 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCS - 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 //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 //S1 EXEC PROC=PROCDEMO //* 1ST CALL //S2 EXEC PROCDEMO //* 2ND CALL //STEPX1.ENTRADA DD * in-stream data (INFILE dataset, STEPX1 step, proc PROCDEMO) //S3 EXEC PROCDEMO //* 3RD CALL Calling the proc - PROC is called in the same job where it is declared - Reader / Interpreter DOES NOT GO to any PROCLIB in order to expand the PROC; - Expansion is done inquiring the PROC-PEND block at the same job where it is referred to

181 181 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCs – symbolic parameters Symbolic parameters

182 182 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCs – symbolic parameters In the following PROC : //SSSPRO1 PROC //STEPA EXEC PGM=PPPX1 //DD1 DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=A //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=A //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=A // PEND Everytime it is called, reports with ddname REPORT, REPORT2 & REPORT3 are class A output.

183 183 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 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 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)

184 184 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCs – symbolic parameters If there isnt 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 wont know what class must me associated to reports DDs REPORT1, REPORT2 & REPORT3 in STEP S1.

185 185 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 DDs are SYSOUT=*, due to the default specification at PROC statement.

186 186 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCs – symbolic parameters To change the default value (to override it) : 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

187 187 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 DDs are SYSOUT=*

188 188 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 S1 : SYSOUT=A REPORT1, STEPB, procstep S1 : SYSOUT=* REPORT1, STEPC, procstep S1 : SYSOUT=R REPORT1, STEPA, procstep S2 : SYSOUT=* REPORT1, STEPB, procstep S2 : SYSOUT=X REPORT1, STEPC, procstep S2 : SYSOUT=*

189 189 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCs – symbolic parameters To override symbolic parameters default values, one must specify the new value in when proc is invoked. : ddname. step_name=xxx

190 190 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

191 191 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCs – including DD in the proc Including DD in the proc

192 192 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 steps DDs) : // stepname. ddname DD parameters Ex.: //S2 EXEC SSSPR01,REPCLA.STEPB=X //STEPB.REPOTHER DD SYSOUT=*

193 193 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCS – including datasets in the proc Including datasets

194 194 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 steps DDs): // stepname. ddname DD parameters Ex.: //S2 EXEC SSSPR01,REPCLA.STEPB=X //STEPB.REPOTHER DD SYSOUT=*

195 195 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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. //stepname ddname DD // DD // DD new_dataset Example : //STEP1 EXEC PROCX1 //STEPA.DD2 DD // DD // DD DSN=TST.ARQUIVOX...

196 196 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com PROCs – changing EXEC parameters Changing EXEC parameters

197 197 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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=*

198 198 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – IF / THEN / ELSE / ENDIF IF / THEN / ELSE / ENDIF Commands

199 199 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – IF / THEN / ELSE / ENDIF These commands coan be used rather than COND (and theyre 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

200 200 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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:

201 201 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – IF / THEN / ELSE / ENDIF To test the previous step return code: [stepname.]RC EQ return_code or [stepname.]RC GT return_code or [stepname.]RC LT return_code or [stepname.]RC NE return_code or [stepname.]RC NL return_code or [stepname.]RC NG return_code or [stepname.]RC GE return_code or [stepname.]RC LE return_code

202 202 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

203 203 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – IF / THEN / ELSE / ENDIF To test whether a previous step has abended or not: [stepname.]ABEND EQ TRUE or [stepname.]ABEND EQ FALSE [stepname.] ABEND EQ TRUE or [stepname.] ABEND EQ FALSE

204 204 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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 or [stepname.] ABENDCC EQ Unnnn

205 205 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com JCL – IF / THEN / ELSE / ENDIF Multiple contitions: Use parenthesis to specify test priority and sequence. Use & for and Use | for or

206 206 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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. DONT DO THAT!

207 207 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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:

208 208 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com 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

209 209 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com Appendix - CONTROLs – BMC Software ProdutoFunção Control-MAutomated Production Control and Scheduling System Manages and automates the setup, scheduling and execution of jobs in the data center. Control-M / RestartRestart 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 / TapeRemovable 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-DOutput Management System Automatically schedules and controls every aspect of report processing and distribution, including report decollating, bundling, printing, online viewing, and archiving. Control-VQuick Access Archive Viewing System Provides online access to archived reports and documents by indexed data retrieval

210 210 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com CONTROLs – BMC Software ProdutoFunçã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 / ImageImage 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-OConsole 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.

211 211 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com THE END


Download ppt "1 Summary Prev.Pg. Alberto Romano Schiesari – www.profars.comwww.profars.com MVS JCL concepts."

Similar presentations


Ads by Google