Presentation is loading. Please wait.

Presentation is loading. Please wait.

MVS JCL concepts.

Similar presentations


Presentation on theme: "MVS JCL concepts."— Presentation transcript:

1 MVS JCL concepts

2 Presentation Thanks for using this presentation. You are free to use it. I appreciate if you refer to the author when using it. I’m sorry about the language errors; my english isn’t so good; I’ll appreciate if you send me any corrections and suggestions to optimize the comprehension to the reader. The same is valid for any technical error; please help me to make this an error-free text. Alberto Romano Schiesari – São Paulo - Brazil

3 Summary IBM main operating systems MVS line Executing services demand
General flow JES2 Input spool and Output spool Input spool Job submission - Roscoe Stacking jobs at input spool Contents of each job in the input spool Initiators Output spool JCL JOB EXEC DD Library search PROCS Apendix - CONTROL’s

4 Concepts IBM main operating systems see

5 Concepts – IBM main operating systems
IBM main operating systems “DOS” or “VSE” line DOS (1966) DOS/VS (1972) DOS/VSE (80’s) VSE/ESA (1991) z/VSE (2005)

6 Concepts – IBM main operating systems
IBM main operating systems “VM” line VM/370 (1972) VM/SP (1980) VM/XA (1988) VM/ESA (1990) z/VM (2000)

7 Concepts – IBM main operating systems
Conceitos Concepts – IBM main operating systems IBM main operating systems “Real-time” (transactional) line ACP (1969) TPF (1979) z/TPF (2005)

8 Concepts – IBM main operating systems
Conceitos Concepts – IBM main operating systems IBM main operating systems Unix-like line UTS (1981) AIX/370 (1990) AIX/ESA (1991) LINUX (1999) Open Solaris (2008)

9 Concepts – IBM main operating systems
Conceitos Concepts – IBM main operating systems IBM main operating systems MVS line MFT (1966) ; OS/VS1 (1972) (end) MVT (1967) OS/VS2 R1 (SVS) (1972) 24-bit addressing; Single Address Space MVS (OSVS2 R2) (1974) 24-bit addressing; Multiple Address Spaces MVS/370 (1981) . MVS/XA (83) Extended Architecture MVS/ESA (1988) Enterprise System Architeture; 31-bit addressing OS/390 (1995) . z/OS (2000) ; 24-, bit addressing z/OS 1.10 (Sep 2008)

10 Concepts – IBM main operating systems
Conceitos Concepts – IBM main operating systems 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)

11 Concepts – IBM main operating systems
Conceitos Concepts – IBM main operating systems Curiosity: example of a DOS (PC’s) JCL (.bat files) @echo off cls :a ECHO Compiling %1 IF EXIST %1.OBJ DEL %1.OBJ COBOL %1; ANIM COPYLIST > %1.LST IF ERRORLEVEL 1 ECHO *** Error LINK %1+%COBDIR%\ADIS+%COBDIR%\ADISKEY+%COBDIR%\ADISINIT; >> %1.LST rem TYPE %1.LST shift if not "%1" == "" goto a @ECHO

12 Concepts – IBM main operating systems
Conceitos Concepts – IBM main operating systems 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 fi \mv -f $FILE.txt $FILE else echo " No transactions today." exit 0 fi

13 Concepts – IBM main operating systems
Conceitos Concepts – IBM main operating systems 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= // TLBL FILEB,'T047,U' // EXEC EASYTREV INCLUDE EZBKVSES D047 VS VB UNLOAD /* /& * $$ EOJ

14 Concepts – IBM main operating systems
Conceitos Concepts – IBM main operating systems 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 UNLOAD SORT FIELDS=COPY RECORD TYPE=V,LENGTH=750 /* //

15 MVS line – executing services demand

16 MVS line – executing services demand
BE CAREFUL! ACHTUNG! Everything you’re gonna see/read/listen is OK for BACTH applications !

17 MVS line – executing services demand
BE CAREFUL! ACHTUNG! Everything you’re gonna see/read/listen is OK for BACTH applications !

18 Service Input (execution order) basically: print (paper or “terminal”)
MVS line – general flow General flow System Service Input (execution order) Result Output basically: print (paper or “terminal”)

19 Service Input (execution order)
MVS line – general flow ? How do services get into the system? General flow SYSTEM Service Input (execution order)

20 basically: print (paper or “terminal”)
MVS line – general flow ? How do results get out of the system? General flow SYSTEM Result Output basically: print (paper or “terminal”)

21 It is JES2. (Job Entry Subsystem)
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 Therefore: JES2 JES2 Service Input (execution order) Result Output
JES2 components that receive the inputs JES2 components that send the results out Service Input (execution order) Result Output (basically: print on paper or “terminal”)

23 JES2 In other words: Service Input (execution order) Result Output
z/OS Operating system Component 1 ... Component 2 ... JES2 Component n ... Application 1 Service Input (execution order) Result Output (basically: print on paper or “terminal”) Application 2 ... Apllication n (ex.:CICS) ... Application x (ex.: DB2) ... Application z ...

24 JES2 For example: z/OS Operating system Component 1 ... Component 2 ... JES2 Component n ... Application 1 Services input via terminal (“sub” command ) Results output browse via terminal (job sysout browse) Application 2 ... Apllication n (ex.:CICS) ... Application x (ex.: DB2) ... Application z ...

25   JES2 But... We have to remember that: z/OS Operating system
Component 1 ... Component 2 ... JES2 Component n ... Application 1 Application 2 ... Apllication n (ex.:CICS) ... Terminals for SUB (they MUST be associated to an application program !!!) Application x (ex.: DB2) ... Terminals for BROWSE (they MUST be associated to an application program !!!) Application z ...

26   JES2 What is (are) this (these) application program(s)? z/OS
Operating system Component 1 ... Component 2 ... JES2 Component n ... Application 1 Application 2 ... Apllication n (ex.:CICS) ... What is the application program responsible for this terminal? Application x (ex.: DB2) ... What is the application program responsible for this terminal? Application z ...

27   JES2 It may be Roscoe... JES2 ROSCOE
Roscoe sends the services to the JES2 Roscoe gets the results from JES2

28 TSO sends the services to the JES2 TSO gets the results from JES2
Or TSO... JES2 TSO TSO sends the services to the JES2 TSO gets the results from JES2

29   JES2 But, even either Roscoe or TSO... JES2 Roscoe or TSO
The terminal is just a visual interface The terminal is just a visual interface

30   JES2 Where are, in fact, the data? JES2 Roscoe or TSO
Where is the stream we built and submitted? Where is the sysout being accessed to browse?

31 In disk ! In the spool areas !
JES2 In disk ! In the spool areas ! JES2 Roscoe or TSO Output spool area INPUT spool area

32 Let’s see some details about spool input process
JOB input Let’s see some details about spool input process JES2 Input spool area Roscoe or TSO

33  JOB input – TSO/ROSCOE
NOTE : use of ROSCOE (data manipulation via AWS)... Roscoe work area (AWS) (create / FETCH/ATTACH) Roscoe Roscoe LIB’s (proprietary data organization) (SAVE or UPDATE)

34  JOB input – TSO/ROSCOE
NOTE : ... or TSO (data manipulation directly in the “normal” datsets areas) Partitioned dataset member TSO Sequential dataset

35  JOB input – TSO/ROSCOE
NOTE : we’ll refer to data manipulation using Roscoe or TSO using this figure Edited data To be submitted TSO/Roscoe

36 Step 1 = edit data to be submitted
JOB input – TSO/ROSCOE Step 1 = edit data to be submitted Edited data To be submitted TSO/Roscoe

37 Step 1 = edit data to be submitted
JOB input – TSO/ROSCOE Step 1 = edit data to be submitted //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,* 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 RESTAURA ENDERECO VOLTA BR R VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,* SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG RESTAURA ENDERECO 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 CL AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA * 0002NOME DA AGENCIA * 0003NOME DA AGENCIA * 0004NOME DA AGENCIA * TSO/Roscoe

38  JOB input – TSO/ROSCOE Another sight... JOB Statement
1st step components (assembly = execution of Assembler program) 2nd step components (linkedit = execution of linkeditor program) 3rd step components (my program)

39 A c-a-r-e-f-u-l analysys of the data to be submitted...
JOB input – TSO/ROSCOE A c-a-r-e-f-u-l analysys of the data to be submitted... //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,* 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 RESTAURA ENDERECO VOLTA BR R VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,* SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG RESTAURA ENDERECO 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 CL AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA * 0002NOME DA AGENCIA * 0003NOME DA AGENCIA * 0004NOME DA AGENCIA * TSO/Roscoe

40 Another sight, the stream as a whole ...
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 Another way to view the data ...
JOB input – TSO/ROSCOE Another way to view the data ... TSO/Roscoe //PSTARS3T JOB (1234),‘ALBERTO', // CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * Step C, SYSIN dataset data Step G, AGENCIAS dataset data Red = JCL Blue = data

42 Getting back to the relationship between Roscoe and JES...
JOB input – TSO/ROSCOE Getting back to the relationship between Roscoe and JES... //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,* 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 RESTAURA ENDERECO VOLTA BR R VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,* SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG RESTAURA ENDERECO 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 CL AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA * 0002NOME DA AGENCIA * 0003NOME DA AGENCIA * 0004NOME DA AGENCIA * TSO/Roscoe

43 Roscoe submits (delivers) the stream that came from AWS to JES...
JOB input – TSO/ROSCOE Roscoe submits (delivers) the stream that came from AWS to JES... JES2 Input spool area Edited data TSO/Roscoe SUB

44  JOB input – TSO/ROSCOE
The JES component that reads the things somebody (Roscoe, TSO...) submitted is (are) the READER(s) / INTERPRETER(s) JES2 Input spool area Reader TSO/Roscoe SUB AWS

45   JOB input – TSO/ROSCOE
There are several READER/INTERPRETER(s); they get the records from the submitted JOBs; while reading, they validate some information before send to the spool (that’s because the “interpreter”) JES2 Input spool area Readers “Normal” datasets TSO Roscoe AWS SUB SUB

46 Let’s see better the input spool area
JOB input Let’s see better the input spool area JES2 Input spool area Readers “Normal” datasets TSO Roscoe AWS SUB SUB

47 Input spool area : the archieving unit is the JOB
JOB input Input spool area : the archieving unit is the JOB JOB0001 JOB0002 JOB0003 JOB0004 JOB0005 JOB0006 JOB0007 JOB0008 Etc...

48 JOB input The JOBS are queued based on the entry sequence; each Job receive an Id #, that will follow it throughout its whole life. JOB0001 JOB0002 JOB0003 JOB0004 JOB0005 JOB0006 JOB0007 JOB0008 Etc...

49 The JOBS remains in the queue awaiting execution.
JOB input The JOBS remains in the queue awaiting execution. JOB0001 JOB0002 JOB0003 JOB0004 JOB0005 JOB0006 JOB0007 JOB0008 Etc...

50 ALL JCL records (statements)
JOB input Let’s see some details about how the Jobs are stored. Let’s detail one of them (JOB0001): JOB0001 ALL JCL records (statements) (one single dataset) For each in-stream dataset in the submitted stream, is created a file identified with stepname + DDname

51 Example: if this stream (ref. JOB0001) is submitted
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 The input spool data related to JOB0001 is as follows:
JOB input The input spool data related to JOB0001 is as follows: //PSTARS3T JOB (1234),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=‘TOT=YES' //STEP2 EXEC PGM=PGTST02 JOB0001 //PSTARS3T JOB (123),'ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC PGM=PGTST01,PARM=‘TOT=YES‘ //STEP2 EXEC PGM=PGTST02 There is no datasets related to in-stream data, because there is no in-stream data

53 Example: if this stream is submitted (ref. JOB0002)
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 The input spool related to JOB0002 is as follows:
JOB input The input spool related to JOB0002 is as follows: //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 */ 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 */

55 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,* 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 RESTAURA ENDERECO VOLTA BR R VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,* SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG RESTAURA ENDERECO 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 CL AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA * 0002NOME DA AGENCIA * 0003NOME DA AGENCIA * 0004NOME DA AGENCIA *

56 It has JCL and in-stream data
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,* 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 RESTAURA ENDERECO VOLTA BR R VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,* SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG RESTAURA ENDERECO 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 CL AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * 0001NOME DA AGENCIA * 0002NOME DA AGENCIA * 0003NOME DA AGENCIA * 0004NOME DA AGENCIA *

57 The input spool related to JOB1234 is (almost...) as follows:
JOB input The input spool related to JOB1234 is (almost...) as follows: JOB1234 //PSTARS3T JOB (1234),‘ALBERTO',CLASS=T,MSGCLASS=O //STEP1 EXEC ASMACLG //C.SYSIN DD * //G.SYSPRINT DD SYSOUT=* //G.SYSOUT DD SYSOUT=* //G.AGENCIAS DD * Step=C ; DD=SYSIN PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,* 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 RESTAURA ENDERECO VOLTA BR R VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,* SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG RESTAURA ENDERECO 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 CL AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE Step=G ; DD=AGENCIAS 0001NOME DA AGENCIA * 0002NOME DA AGENCIA * 0003NOME DA AGENCIA * 0004NOME DA AGENCIA *

58 In fact, JCL is already EXPANDED (details when we’ll see PROCs)
JOB input In fact, JCL is already EXPANDED (details when we’ll 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), 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 FINALLY !!! JOB1234 “final” format is:
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), 15 XXSYSPRINT DD SYSOUT=* 16 XXG EXEC PGM=*.L.SYSLMOD,COND=((8,LT,C),(8,LT,L)) 17 //G.SYSPRINT DD SYSOUT=* 18 //G.SYSOUT DD SYSOUT=* 19 //G.AGENCIAS DD * Step=C ; DD=SYSIN PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,* 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 RESTAURA ENDERECO VOLTA BR R VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,* SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG RESTAURA ENDERECO 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 CL AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE Step=G ; DD=AGENCIAS 0001NOME DA AGENCIA * 0002NOME DA AGENCIA * 0003NOME DA AGENCIA * 0004NOME DA AGENCIA *

60 OK? No doubts? We’ll talk about that again soon...
JOB input OK? No doubts? We’ll 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 JOB input Getting back to the matter, there was a queue of JOBs waiting for execution... JOB0001 JOB0002 JOB0003 JOB0004 JOB0005 JOB0006 JOB0007 JOB0008 Etc...

62 JOB input For job execution, there are other system components: the INITIATORs z/OS Operating System Input spool area JOBS Component 1 ... Selection for execution Initiator’s JES2 Component n ... Application program 1 Application program o 2 ... Application program n (ex.:CICS) ... Application program x (ex.: DB2) ... Application program z ...

63 Execution They (the INITIATORs) do the selection (pick up 1 at a time) of the “waiting-for-execution” job(s) and begin their execution. Input spool Area JOBS Initiator’s Selection for execution What is the criteria for the selection? The JOB class.

64 Job queue (jobs waiting for execution)
Each initiator deals with some pre-defined classes. Ex. INIT 1 = jobs classes A, B and C INIT 2 = jobs classes D, E and F Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc... INIT 1 : server for jobs class A, B and C; in the example, this INIT will select the jobs 0001 e 0002. 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 won’t be executed (selected for execution)

65 Example: see the list of INITs as shown by Roscoe’ DIS INIT command:
Execution Example: see the list of INITs as shown by Roscoe’ DIS INIT command: > APPLID(EMPROSCD) USER(OB3,ARS243) > INIT 1 ACTIVE JOB00716 ADP#6IA (1) PVAG :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) STEP :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) STEP :06:13 C=W

66 Selection priority: basically FIFO
Execution Ex.: INIT 1 = serves jobs with classes A, B and C. The SELECTION PRIORITY is basically FIFO. Then, JOB0001 is selected first, and JOB0002 is selected after JOB0001 Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc... 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)

67 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... INIT 1 : selected JOB0001 for execution

68 Job queue (jobs waiting for execution)
INIT 1 pick up the information related to each step (program execution order [EXEC] + information about the datasets the program uses [DD] ) to do some things. Input spool: Job queue (jobs waiting for execution) JOB0001 (class A) JOB0002 (class B) JOB0003 (class R) JOB0004 (class D) JOB0005 (class E) JOB0006 (class T) Etc... Process each STEP

69 Execution 1st. step : - Identify which program must be executed (PGM=xxxxxxxx) - Verify DISP of each DD: -- IF DISP=OLD or DISP=SHR or DISP=MOD, verify whether the dataset already exists, whether it is reserved / locked for another user, etc If DISP=NEW, create the dataset (does it exist? Is there enough room? etc...) - Ask LOADER to fetch program from the right library (is there STEPLIB? Is there JOBLIB?) Let everything set up so that OPEN can go smoothly... (*) (*) unless the program uses DYNALLOC... As CICS does...

70 Execution ( Starting parenthesis...

71 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 Execution ) Ending parenthesis...

73 Execution 1st. step : Everything OK? Then you can call the program for execution. Order LOADER to fetch program and transfer control (remember PSW? remember entry-point?) to the program’s 1st instruction. In other words, (talking in assemblish...): INIT orders the BALR 14,15 to transfer control to the program.

74 Execution 1st. step : Our program is executed. What does it mean? It means that CPU executes its instructions. But... There are dozens of other programs that need to use the CPU time, dreaming of CPU executing its instructions. That’s when the dispatching priority comes. It determines the privileges (or none) my program has in the algorithm that determines how much time each cuncurrent program get from CPU.

75 Execution 1st. step : What if a dataset is read, and the dataset is available via DD * ? When OPEN is issued, the access method receives information (set up by JES2) that the dataset is awaiting at the input job spool (identified by its stepname and ddname). Therefore our program is going to read data directly from input spool area.

76 Program reads directly from here
Execution 1st. step : 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), 15 XXSYSPRINT DD SYSOUT=* 16 XXG EXEC PGM=*.L.SYSLMOD,COND=((8,LT,C),(8,LT,L)) 17 //G.SYSPRINT DD SYSOUT=* 18 //G.SYSOUT DD SYSOUT=* 19 //G.AGENCIAS DD * Step=C ; DD=SYSIN PROGRAMA START 0 ENTRAR BAL R14,ROTMAIN PROG PROPRIAMENTE DITO SAIR DC A(0) SAVEAREA DO ENDERECO VOLTA ROTMAIN ST R14,* 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 RESTAURA ENDERECO VOLTA BR R VOLTA DC A(0) SAVEAREA DO ENDERECO DE VOLTA LEREG ST R14,* SALVA ENDERECO DE VOLTA B SAILER VAI PARA SAIDA FIMAG MVI FLAGFIM,C'Y' MARCA QUE ARQUIVO ACABOU SAILER L R14,LEREG RESTAURA ENDERECO 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 CL AREA PARA LEITURA ARQUIVO END , ULTIMO STMT FONTE Program reads directly from here Step=G ; DD=AGENCIAS 0001NOME DA AGENCIA * 0002NOME DA AGENCIA * 0003NOME DA AGENCIA * 0004NOME DA AGENCIA *

77 Execution 1st. step : Our program finishes. Talking in “assemblish”, on the last BR 14, control is returned to initiator; especifically to a little-sub-component called terminator: it verifies the end-of-execution type (normal, abnormal), Return Code, closes the non-closed datasets, etc.

78 Execution 2nd. step and so on: Process is repeated for all JOB steps, including the Return Code test (COND...), to know whether or not the step must be executed, flushed, etc...

79 Execution OK? Job input OK?

80 Time to start understanding output spooling system
Execution Time to start understanding output spooling system

81 Result output (reports)
A bunch of people access data from the output spool. Output spool area JES2 Roscoe (CA software) or TSO (IBM software) Control (BMC softwares)

82 Result output (reports)
Who “writes” on the output spool? JES2 Output spool area Application programs Operating System and its components (including JES2)

83 Result output (reports)
Everybody “prints” something... Application programs and operating system. JES2 Output spool area Application programs Operating System and its components (including JES2)

84 Result output (reports)
But... In fact, only JES2 really writes. Do you know why? JES2 Output spool area Application Programs Operating System and its components (including JES2)

85 Result output (reports)
Because everybody “printing” is intercepted by JES, and JES redirects those lines to the output spool area. JES is its administrator. This is done naturally if output is specified as SYSOUT=xxx JES2 Output spool area Application programs Operating System and its components (including JES2)

86 Result output (reports)
What about the operating system outputs? They are redirected to where especified at MSGCLASS=xxx JES2 Output spool area Operating system and its components (including JES2)

87 Result output (reports)
What about the application programs’ output? They are redirected to where especified at SYSOUT=xxx JES2 Output spool area Application programs

88 Result output (reports)
But what is that xxx? JES2 ? Application programs Operating Systems and its components (including JES2)

89 Result output (reports)
It is the output class. JES2 There is n datsets for each job, Each one has an associated class Application Programs Opertating System and its components (including JES2)

90 Result output (reports)
Unless otherwise specified at MSGLEVEL, system generates 3 reports about the JCL processing: JES2.JESMSGLG = job events log (start, end, etc) JES2.JESJCL = expanded JCL JES2.JESYSMSG = initiator / terminator messages JOB1234 , file JES2.JESMSGLG, class R Line 1 file 1 ... Etc... JOB JOB1234 , file JES2.JESJCL, class R Line 1 Relat1 ... Etc... JOB1234 , file JES2.JESYSMSG, class R Line 1 Relat2 ... Etc...

91 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 -- JOB FRIDAY, AUG JOB IRR010I USERID D IS ASSIGNED TO THIS JOB. JOB ******* PSTARS3T * Sepro-41* JOB IEF196I ******* PSTARS3T * Se JOB ******* PSTARS3T * IEFUJV PROCESSING COMPLETE * JOB IEF196I ******* PSTARS3T * IEFUJV PROCESSING COMPLETE JOB IEF677I WARNING MESSAGE(S) FOR JOB PSTARS3T ISSUED JOB ICH70001I D LAST ACCESS AT 15:42:05 ON FRIDAY, JOB $HASP373 PSTARS3T STARTED - INIT CLASS T - SYS JOB IEF403I PSTARS3T - STARTED - TIME= JOB IEF285I SYS1.MACLIB JOB IEF285I VOL SER NOS= D1T900. JOB TIMINGS (M JOB JOBNAME STEPNAME PROCSTEP RC EXCP CPU SRB JOB PSTARS3T STEP1 C JOB PSTARS3T STEP1 L JOB IEF285I SYS09240.T RA000.PSTARS3T.GOSET.H06 JOB PSTARS3T STEP1 G JOB IEF404I PSTARS3T - ENDED - TIME= JOB PSTARS3T ENDED. NAME-JAGUA #4 ALBERTO TOTAL CPU JOB $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 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. 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), 15 XXSYSPRINT DD SYSOUT=* 16 XXG EXEC PGM=*.L.SYSLMOD,COND=((8,LT,C),(8,LT,L)) 17 //G.SYSPRINT DD SYSOUT=*

93 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 D 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.T 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.T RA000.PSTARS3T.OBJ.H ) 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.T RA000.PSTARS3T.SYSUT1.H06 DELETED, DDNAME=SY IEF285I D PSTARS3T.JOB04227.D ? SYSOUT IGD106I SYS09240.T RA000.PSTARS3T.OBJ.H PASSED, DDNAME=SY IEF285I D PSTARS3T.JOB04227.D ? SYSIN IEF373I STEP/C /START IEF374I STEP/C /STOP 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.T RA000.PSTARS3T.GOSET.H06 ) Continua na próxima página

94 Result output (reports)
JES2.JESYSMSG example (truncated at right) Continuação IGD101I SMS ALLOCATED TO DDNAME (SYSUT1 ) DSN (SYS09240.T 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.T RA000.PSTARS3T.OBJ.H DELETED, DDNAME=SY IGD106I SYS09240.T RA000.PSTARS3T.GOSET.H06 PASSED, DDNAME=SY IGD105I SYS09240.T RA000.PSTARS3T.SYSUT1.H06 DELETED, DDNAME=SY IEF285I D PSTARS3T.JOB04227.D ? SYSOUT IEF373I STEP/L /START IEF374I STEP/L /STOP CPU 0MIN 00.00SEC SRB 0MIN IEF236I ALLOC. FOR PSTARS3T G STEP1 IEF237I VIO ALLOCATED TO PGM=*.DD IEF142I PSTARS3T G STEP1 - STEP WAS EXECUTED - COND CODE 0000 IEF285I SYS09240.T RA000.PSTARS3T.GOSET.H06 KEPT IEF285I D PSTARS3T.JOB04227.D ? SYSOUT IEF373I STEP/G /START IEF374I STEP/G /STOP CPU 0MIN 00.00SEC SRB 0MIN IGD105I SYS09240.T RA000.PSTARS3T.GOSET.H06 DELETED, DDNAME=SY IEF375I JOB/PSTARS3T/START IEF376I JOB/PSTARS3T/STOP CPU 0MIN 00.01SEC SRB 0MIN

95 Result output (reports)
Let’s see an example of an application program that writes 2 reports: //REPORT1 DD SYSOUT=* , //REPORT2 DD SYSOUT=B and it has MSGCLASS=R parameter in the JOB statement JOB1234, JES2.JESMSGLG, class R Operating System JOB1234, JES2.JESJCL, class R JOB1234, JES2.JESMSGLG, class R JOB1234 , STEP 1, DD REPORT1, class R Line 1 Report1 Line 2 Report1 ... Etc... Application Program (my program) JOB1234 , STEP1, DD REPORT2, class B Line 1 Report2 Line 2 Report2 ... Etc...

96 Result output (reports)
Similarly as occur in the input process, there are system components to deal with the (real) print demand generated by the queued datasets at output spool area. These components are the WRITERS; they work based on SYSOUT class. They read the spool datasets in the output spool area and “print” them at some device. JOB1234, JES2.JESMSGLG, class R JOB1234, JES2.JESJCL, class R JOB1234, JES2.JESMSGLG, class R JOB1234 , STEP 1, DD REPORT1, class R Line 1 Report1 Line 2 Report1 ... Etc... Writer serves R class datasets Writer serves B class datasets JOB1234 , STEP1, DD REPORT2, class B Line 1 Report2 Line 2 Report2 ... Etc...

97 Result output (reports)
Sometimes (mostly at development activities) the output is NOT to be directed to a printer. User wants to browse it at a terminal. That’s what happen when we access sysouts Roscoe, TSO or CONTROL-V. JOB1234, JES2.JESMSGLG, class R JOB1234, JES2.JESJCL, class R JOB1234, JES2.JESMSGLG, class R Writer serves R class datasets JOB1234 , STEP 1, DD REPORT1, class R Line 1 Report1 Line 2 Report1 ... Etc... Writer serves B class datasets JOB1234 , STEP1, DD REPORT2, class B Line 1 Report2 Line 2 Report2 ... Etc...

98 JCL It’s JCL time

99 JCL JCL = Job Control Language = language to ask operating system to execute services/tasks

100 JCL All languages must have its commands. In JCL, there are 3 main commands: JOB, EXEC and DD Before starting with the details, let’s see some basics

101 JCL – Basic sintax Basic syntax

102 Always: // at positions 1-2 Comments: //* at positions 1-3
JCL – Basic sintax Always: // at positions 1-2 Comments: //* at positions 1-3

103 Continuation statements
JCL – Basic sintax Continuation statements · statement to be continued : last character must be a comma, to indicate there are more parameter(s) · following statement : // at columns 1-2, as usual, and continuation begins at any position from 4 through 16 (position 3 must be blank)

104 Continuation statements
JCL – Basic sintax Continuation statements Example (first 2 lines are “rulers” to use as a reference to the statement positions) : //ENTRADA DD DSN=SYS5.LINKLIB, // DISP=SHR BIBLIOTECA DE UTILITARIOS HOME MADE // DISP=SHR COMENTARIO // DISP=SHR COMENTARIO // DISP=SHR

105 Continuation statements
JCL – Basic sintax Continuation statements Most common problems //ENTRADA DD DSN=SYS5.LINKLIB // DISP=SHR BIBLIOTECA DE UTILITARIOS HOME MADE Here there is no comma after; therefore DISP=SHR wasn’t considered as part of DD statement, but a separated statement; note that bo JCL error is detected at //ENTRADA DD; system understands that dataset SYS5.LINKLIB must be created (there is no DISP parameter) and that following statement is wrong (DISP=SHR is na invalid operation).

106 Continuation statements
JCL – Basic sintax Continuation statements Most common problems //ENTRADA DD DSN=SYS5.LINKLIB, // DISP=SHR COMENTARIO Continuation begins at position 17; it’s wrong (maximum allowed for the beginning is position 16)

107 Continuation statements
JCL – Basic sintax Continuation statements Most common problems //ENTRADA DD DSN=SYS5.LINKLIB, //DISP=SHR COMENTARIO Continuation at position 3 (wrong: minimum is position 4)

108 Continuation statements
JCL – Basic sintax Continuation statements Most common problems //ENTRADA DD DSN=SYS5.LINKLIB, DISP=SHR “Continuation” statement (second statement) hasn’t // at positions 1-2: system understands that //ENTRADA DD DSN=SYS5.LINKLIB, will be resumed at the next line (its last character is a comma – it indicates there will be a continuation), but the next line is not a JCL line (it is recognized as the first – and only - data record of a dataset named SYSIN)

109 Summary – statement syntax
JCL – Basic sintax Summary – statement syntax q       Identification = // columns 1-2 q       Name = 1 to 8 positions, starting at posiition 3; it must have at least one blank after the name (and before the operation) q       Operation = JOB or EXEC or DD (or PROC or PEND or IF or END-IF or other); it must have at least one blank after operation name q       Parameter(s); it/they may be of two types: ü      posicional : depend on the position (sequence of specification) or ü      keyword : followed by “=“ sign v      If there is only positional parameter(s), they must be specified in the correct sequence v      If there is only keyword parameter(s), they may be specified in any sequence v      If there is both positional and keyword operands, the positional (in the correct sequence) must be specified before the keyword ones (in any sequence) q       Comments; it must have at least one blank after the operand(s) specification, before comments

110 O JOB as a whole - overwiew
JOB as a whole – overview

111 O JOB as a whole - overwiew
Overview

112 The job end delimiter is the next job begin
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 start delimiter 1st Step JOB 2nd Step 3rd Step The job end delimiter is the next job begin (in the old times, it was mandatory a statement just with // in positions 1-2 and remaining spaces)

113 Remember that DDs are opcional.
JOB – Overview For the steps: Remember that DDs are opcional. If a program does not use datasets, no DD’s are needed or If a program uses dynamic allocation for a dataset, no DD is needed to that dataset BUT : EXEC is mandatory; EXEC defines a step.

114 JOB – Overview If, for instance, the 2nd step “EXEC” has na operation code error, it isn’t identified as a EXEC and therefore it does not identify another new step delimiter, and therefore its DD’s are considered as belonging to the 1st step DD’s. //ABCARS01 JOB ... //STEP1 EXEC PGM=PGM01 //DDA1 DD //DDB1 DD //DDC1 DD //STEP2 ESEC PGM=PGM02 //DDA2 DD //DDB2 DD //DDC2 DD //STEP3 EXEC PGM=PGM03 //DDA3 DD //DDB3 DD //DDC3 DD ... As 2nd “EXEC” is in error, it doesn’t delimits the 2nd step beginning. All blue statements are the 1st step statements The green ones are the 2nd step statements

115 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_| | BARUERI | 2_| | S.JOSE R.PRETO | 3_| | SAO CARLOS | 4_| | PINHEIROS | 5_| | PERDIZES | 6_| | MARAMBAIA | 7_| | JAGUARETE |

116 JOB – Commands Commands

117 There are 3 main JCL commands: JOB, EXEC and DD Let’s see them.
JCL - Comandos There are 3 main JCL commands: JOB, EXEC and DD Let’s see them.

118 JOB JOB

119 Sintax : //jobname JOB positional_parameters,keyword_parameters

120 Example : //PDR001P2 JOB (B281),ALBERTO,MSGCLASS=X,CLASS=R
2 positional parameters 2 keyword parameters

121 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 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 Specify the job execution class.
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 indicates the maximum amount of CPU usage allowed for the JOB;
Keyword parameters TIME= indicates the maximum amount of CPU usage allowed for the JOB; 1440 = specifies that there’s no CPU limit

125 Specifies the sysout class for the messages related to the JOB
Keyword parameters MSGCLASS= Specifies the sysout class for the messages related to the JOB (as specified in MSGLEVEL)

126 JOB Keyword parameters 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

127 JOB Keyword parameters NOTIFY=
Specifies TSO userid to be notified at the job termination REGION= Specifies the size of the region to be allocated to the JOB RESTART= Specifies the stepname for the JOB to be restarted TYPRUN= Specifies the type of submission. SCAN = submit, validate JCL, but do not execute the job (it is finished after interpreter validation process; no INIT services done) HOLD = the JOB remains in wait state, until selected for execution by an initiator

128 EXEC EXEC

129 Sintax : //stepname EXEC positional_parameter,keyword_parameters

130 Example : //VERIFY EXEC P756,COND=EVEN,PARM.S1=‘T=YES’
1 positional parameter 2 parameters keyword

131 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 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 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 (if step COMP had a return code > OR if step LKED had a return code > 4)

134 EXEC PARM= Data to be passed as parameters (arguments) to the called program. Ex.: PARM='NOSEQ,QUOTE,OFFSET,LIB' PARM='JAN/2003'

135 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 TST executes PROC named TST01 //STEP2 EXEC PROC=TST01 executes PROC named TST01 //STEP1 EXEC PGM=TST executes program named TST01

136 DD DD (Data Definition)

137 Sintax : //filename DD positional_parameters,keyword_parameters

138 Example : //INFILE DD *,DCB=(LRECL=80)
1 positional parameter 1 keyword parameter

139 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 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 //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 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 DD Positional parameters: DD * Examples: //* FOLLOWING DATASET = TODAY’S 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 For Operating System is OK,
DD Positional parameters: DD * Examples: //FILE4 DD * //* FOLLOWING DATASET = TODAY’S TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATSET = CONTROL DATA JUL/2009 For Operating System is OK, but... It’s WRONG!

144 DD Positional parameters: DD * Examples: //FILE4 DD * //* FOLLOWING DATASET = TODAY’s TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATASET = CONTROL DATA JUL/2009 WHY ?

145 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 In-stream data starting here First line is identified as a non-JCL statement (it doesn’t have // at position 1-2); it is meant to be the first record of an in-stream file, whose ddname is assumed to be SYSIN Another in-stream data file 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 doesn’t have // at position 1-2); it is meant to be the first record of an in-stream file, whose ddname is assumed to be SYSIN (it overrides the previous SYSIN dataset)

146 DD Positional parameters: DD * THEN: This //FILE4 DD * //* FOLLOWING DATASET = TODAY’S TRANSACTIONS DATA RECORD 1 DATA RECORD 2 DATA RECORD 3 //FILE5 DD * //* FOLLOWING DATASET = CONTROL DATA JUL/ the system understands this way: FILE4 = (dataset with zero records) FILE5 = (dataset with zero records) SYSIN = dataset with 1 record (JUL/2009)

147 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 ISN’T A JCL STATEMENT ! EOF* //FILE2 DD DSN=FILEWORK.TESTX,DISP=SHR In-stream records for ARQ1 ddname dataset

148 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 won’t be used). Example: a program that reads 2 files: FILEA with transactions from the current month, and FILEB with transaction from past months of the year. In january (there is no past months in the year), FILEB can be a DD DUMMY file //FILEB DD DUMMY //FILEA DD DSN=CURMONFI.TESTEX,DISP=SHR

149 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 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 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 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 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 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 DD UNIT Specifies where the dataset must be allocated.
Generally (in development environments) : SYSDA or 3390 SYSOUT SYSOUT=class SYSOUT=(class,,formsname) SYSOUT=(class,writername,formsname) SYSOUT=(class,writername) SYSOUT=(class,INTRDR) Ex.: //SYSOUT DD SYSOUT=*

155 DD SPACE SPACE= (a,(b,c),RLSE) or SPACE= (d,(b,c),RLSE)
Specifies the amount of disk space to be allocated to the datase. a = TRK or CYL or ABSTR allocation unit : tracks, cylinders, or logical record length b = primary area amount c = secondary area amount (optional) d = logical record length RLSE = (ReLeaSE) (optional) specifies that if there is space left in the primary area after closing the file, this space must be released

156 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 DD Examples : //OUTFIL DD DSN=ATAAABPS.EPC.SE62,
//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 // 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 Library search Library search

159 Some of these lists refer to:
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 Executable programs (load modules) search Operating system libraries
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 Normally the operating system libraries are automatically searched
Load module search Load module search Normally the operating system libraries are automatically searched SYS1.LINKLIB etc The user libraries are searched if: They are in the automatic search list They are specified in the JOBLIB or STEPLIB statements

162 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 Load module search JOBLIB example Load module search
//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 Load module search STEPLIB example Load module search
//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 Operating system libraries SYS1.PROCLIB User libraries
JCL search JCL search Operating system libraries SYS1.PROCLIB User libraries Ex.: SYS9.PROCLIB SYS9.EMPROC1 SYS8.USRPROCL SYS7.PRODPROC etc

166 Normally the operating system libraries are automatically searched
JCL search JCL search Normally the operating system libraries are automatically searched SYS1.PROCLIB The user libraries are searched if: They are in the automatic search They are specified in the JCLLIB statement

167 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 JCL search (procedures) JCLLIB / INCLUDE: example
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: //* JCLLIB ORDER=(JCL.SIST.SRC)

169 JCL search (procedures) JCLLIB / INCLUDE: another example
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: //* JCLLIB ORDER=(JCL.SIST.SRC)

170 PROCS PROCS

171 Procs = procedures = set of non-JOB and non-data statements.
There are 2 types: q       CATALOGED q       IN-STREAM

172 q CATALOGED procedures
PROCS q       CATALOGED procedures

173 Cataloged procedures are those: prepared
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 Edit with Roscoe / TSO and save it. Ex.
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 // 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 Copy to a proclib. Ex. PROCS - Simple copy to a proclib member
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 // PEND FINAL - Simple copy to a proclib member

176 Calling for execution. Ex.
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 ND CALL //STEPX1.INFILE DD * in-stream data (INFILE dataset, STEPX1 step, proc PROCDEMO) //S3 EXEC PROCDEMO RD CALL - Reader / interpreter finds PROCDEMO in a proclib to know how to expand it

177 PROCS q       IN-STREAM procs

178 declared at the beginning of the JOB
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 Declared at the beginning of the JOB. Ex.
PROCS Declaring the Proc Declared at the beginning of the JOB. Ex. //ARSARS01 JOB (1234),’ALBERTO’,CLASS=T,MSGCLASS=R //PROCDEMO PROC //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //OUFILE DD SYSOUT=A // 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 - PROC declared at the beginning of the JOB

180 Called for execution at the same job. Ex.
PROCS Calling the proc Called for execution at the same job. Ex. //ARSARS01 JOB (1234),’ALBERTO’,CLASS=T,MSGCLASS=R //PROCDEMO PROC //STEPX1 EXEC PGM=PGTST01 //INFILE DD DSN=XFILE,DISP=SHR //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 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 - PROC is called in the same job where it is declared

181 PROCs – symbolic parameters

182 PROCs – symbolic parameters
In the following PROC : //SSSPRO1 PROC //STEPA EXEC PGM=PPPX1 //DD 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 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 //DD 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 PROCs – symbolic parameters
If there isn’t default value: JCL error. When this in-stream PROC is expanded //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=B //SSSPRO1 PROC //STEPA EXEC PGM=PPPX1 //DD DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=&REPCLA // PEND //* //S1 EXEC SSSPR01 the system won’t know what class must me associated to reports DD’s REPORT1, REPORT2 & REPORT3 in STEP S1.

185 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 //DD DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=&REPCLA // PEND //* //S1 EXEC SSSPR01 System knows that the 3 DD’s are SYSOUT=*, due to the default specification at PROC statement.

186 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 //DD 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 PROCs – symbolic parameters
(override) In this case //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=B //SSSPRO1 PROC REPCLA=* //STEPA EXEC PGM=PPPX1 //DD DD DSN=ARQALB.DATA.DISP=SHR //REPORT1 DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //REPORT2 DD SYSOUT=&REPCLA //STEPC EXEC PGM=PPPX3 //REPORT3 DD SYSOUT=&REPCLA // PEND //* //S1 EXEC SSSPR01,RELCLA=A //S2 EXEC SSSPR01 System knows that the 3 step S1 DDs are SYSOUT=A and the 3 step S2 DD’s are SYSOUT=*

188 PROCs – symbolic parameters
(override) One can alter only the desired DDs: //JOBEXEMP JOB (1234),’ALBERTO’,CLASS=B //SSSPRO1 PROC REPCLA=* //STEPA EXEC PGM=PPPX1 //DD 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 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 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 //DD DD DSN=... //SYSPRINT DD SYSOUT=&REPCLA //STEPB EXEC PGM=PPPX2 //STEPC EXEC PGM=PPPX3 // 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 PROCs – including DD in the proc

192 PROCS – including DD in the proc
If you need to include a DD (there is no such DD in the PROC, it must be included to the step’s DDs) : //stepname.ddname DD parameters Ex.: //S2 EXEC SSSPR01,REPCLA.STEPB=X //STEPB.REPOTHER DD SYSOUT=*

193 PROCS – including datasets in the proc

194 PROCs – includind datasets
Additional dataset: If it is necessary to include a dataset (there is no such DD in the PROC, it must be included to the step’s DDs): //stepname.ddname DD parameters Ex.: //S2 EXEC SSSPR01,REPCLA.STEPB=X //STEPB.REPOTHER DD SYSOUT=*

195 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 PROCs – changing EXEC parameters

197 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 JCL – IF / THEN / ELSE / ENDIF
Commands

199 JCL – IF / THEN / ELSE / ENDIF
These commands coan be used rather than COND (and they’re easyer to understand...). Syntax : // IF (condition) THEN statements to execute if condition is TRUE // ENDIF or // ELSE statements to execute if condition is FALSE

200 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 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 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 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 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 JCL – IF / THEN / ELSE / ENDIF
Multiple contitions: Use parenthesis to specify test priority and sequence. Use & for and Use | for or

206 JCL – IF / THEN / ELSE / ENDIF
ENDIF is mandatory to specify the end of the set of commands to be executed, with or withot ELSE. ELSE is optional. IMPORTANT : Use of COND + IF / THEN / ELSE / ENDIF together is extremely confusing. DON’T DO THAT!

207 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 //STEP07 EXEC PGM=IEFBR14 // IF ((STEP01.RUN EQ TRUE)) THEN //STEP08 EXEC PGM=IEFBR14 // IF ((STEP01.RUN EQ FALSE)) THEN //STEP09 EXEC PGM=IEFBR14 The execution of this JCL results in:

208 JCL – IF / THEN / ELSE / ENDIF
Example : $HASP373 STARTED - INIT 2 IEF403I - STARTED - TIME= # # JOBNAME STEPNAME PROCSTEP PROGRAM RC # STEP IEFBR # STEP IEFBR # STEP IEFBR # STEP IEFBR # STEP IEFBR # STEP IEFBR14 FLUSH # STEP IEFBR # STEP IEFBR # STEP IEFBR14 FLUSH IEF404I - ENDED - TIME=

209 Appendix - CONTROL’s – BMC Software
Produto Função Control-M Automated Production Control and Scheduling System Manages and automates the setup, scheduling and execution of jobs in the data center. Control-M / Restart Restart Management System Automates the activities that must be performed when restarting failed jobs, including the scratching and uncataloging of datasets created by failed jobs. Control-M / Tape Removable Media Management System Increases utilization of removable media and controls retention periods. Prevents misuse of media, and provides tape library and vault control. Control-M / Analyser Automated Information Integrity System Performs in-stream validation, accuracy, and reasonability checks on information used by data center production tasks (for example, reports, databases). Control-D Output Management System Automatically schedules and controls every aspect of report processing and distribution, including report decollating, bundling, printing, online viewing, and archiving. Control-V Quick Access Archive Viewing System Provides online access to archived reports and documents by indexed data retrieval

210 CONTROL’s – BMC Software
Produto Função Control-D / Page on demand Report Retrieval and Display System Enables end users to retrieve and view pages of reports that reside on mainframe storage in real time. Indexed reports can be retrieved by index name and value. AFP and XEROX reports can also be retrieved and displayed using CONTROL-D/Web Access Server or CONTROL-D/Page On Demand API. Control-D / Image Image Output Management System Enables output from commercial imaging equipment to be imported into either CONTROL-D or CONTROL-V for decollation, distribution and viewing, and into CONTROL-V for archiving and indexed retrieval. Control-O Console Automation System and Desired State Monitoring System Monitors and automatically responds to messages, commands, and dataset events, as well as various other system events. The CONTROL-O/COSMOS feature allows for status monitoring while maintaining all critical system objects in a desired and ideal status.

211 THE END


Download ppt "MVS JCL concepts."

Similar presentations


Ads by Google