1. Job Processing - Job Entry System / Job
Queuing / Job Execution / Purging – JCL is submitted to JES (Job Entry System)
/ JES2 & JES3 (Subsystem part of OS, manages Batch Jobs & SYSOUT)
2.
8 JCL
Statements - JOB / EXEC
/ DD / PROC / PEND / COMMENT / DELIMETER / 'NULL' ending statement
//NAME JOB Parameter
//* Comment
/* End of data stream
// Null statement, all lines coded after this will not
be executed.
3. Job Parameters Types -
Positional-param / Keyword-param
4.
JOB
Statement - //Job-name
JOB Positional-param, Keyword-param
Positional-parm - Account
information/ Programmer name
Keyword-parm - CLASS=0
to 9 | A to Z / PRTY = 0 to 15 / NOTIFY='userid| &SYSUID' / MSGCLASS= A to
Z 0 to 9 / MSGLEVEL= (ST, MSG) / TYPRUN =SCAN|HOLD / TIME = (mm,ss) or TIME =
ss/ REGION = nk | nM or 0K | 0M / Miscellaneous Parameters – ADDRSPC / COND and
RESTART / USER / PASSWORD
Note – Positional parameter are always preceded by
Keyword parameter.
5.
EXEC
Statement
//Step-name EXEC Positional-parm, Keyword-parm
Positional-parm – PGM /
PROC
Keyword-parm - PARM /
ADDRSPC = VIRT|REAL / ACCT= (userid)
Common
Keyword Parameter of EXEC and JOB Statement – ADDRSPC / TIME / REGION /
COND
6.
DD
Statements - //DD-Name DD Parameters
Parameters -
DSN=Physical Dataset Name/ DSN=&name (Temporary dataset) / DSN=
*.stepname.ddname(Backward Referencing).
DISP= (status, normal-disposition,
abnormal-disposition) / Status - NEW/OLD/SHR/MOD / normal-disposition /
abnormal-disposition - CATLG, UNCATLG, DELETE, PASS and KEEP DCB= LRECL / RECFM
- FB, V, VB / BLKSIZE / DSORG - PS, PO (Partitioned Organization), DA (Direct
Organization)
DCB=*.stepname.ddname
UNIT = DASD (Direct Access Storage Device) / SYSDA
(System Direct Access)
VOL = SER= (v1,v2) / VOL= REF=*.DDNAME(Backward
Reference)
SYSOUT= class (A -printer/ * output to same
destination MSGCLASS)
//INFILE DD DSN=SED.GLOB.DES (Name field – optnl field
start at col ‘3’, max length ‘8’)
DISP = (NEW,CATLG,DELETE)
UNIT = DISP
SPACE = (CYL,(1,5),RLSE)
DCB=(RECFM=FB,LRECL=20,BLKSIZE=200)
DDNAME – JOBLIB, JOBCAT, SYSABEND, SYSIN, SYSCHK,
STEPLIB, STEPCAT, SYSDUMP, SYSOUT, SYSOUD, SYSDBOUT.
//INFILE DD SYSOUT=A
7.
JOBLIB /
STEPLIB
BASE Library = Partitioned Dataset = Load Module
JOBLIB - //JOBLIB DD DSN=dsnname,DISP=SHR
STEPLIB - //STEPLIB DD DSN=dsnname,DISP=SHR
INCLUDE - //name INCLUDE MEMBER=member-name
JCLLIB - //name JCLLIB ORDER=(library1,library2...)
8.
Procedure
a) JCL
Procedure - //step-name EXEC procedure name
b)
INSTREAM Procedure - //INSTPORC PROC //PEND / DSNAME
& DATAC - SYMBOLIC Parameters
c) CATALOGED Procedure
- //CATLPROC PROC PROG=, BASELIB=MYCOBOL.BASE.LIB1 / PROG & BASELB -
SYMBOLIC Parameters
d) NESTED
Procedure - Calling a procedure from within a procedure / SET Statement -
Symbolic across job steps or procedure.
e)
SYMBOLIC Parameter – Same PROC to be reused &
called by many Jobs.
//IN1 DD DSN=&ID.URMI,DISP=SHR
ID=X1 (Coded in Job 1) / ID=X2 (Coded
in Job2 ) and so on.
f)
SET Statement
//Name SET Symbolic-Parameter= values
g) INCLUDE
Statement
//Name
INCLUDE Member= Name <- Containing JCL Statement
9.
JCL -
Conditional Processing
Return Code
- 0 (successful execution) to 4095 (non-zero shows error condition) / 0,
4, 8, 12 & 16
COND
Parameter - COND= (Comparison Code, logical-operator, Step name,
EVEN/ONLY) COND = EVEN (even if any previous step terminates) /ONLY (only if any
previous step terminates).
Logical operator – GT / GE / EQ / LT / LE / NE. Condition
true then step bypassed COND in JOB then check for each step. COND in EXEC then
check in that step. //IF1 IF STP01.RC = 0 THEN
RESTART
Processing – Automated (RD Parameter – R/RNC/NR/NC) / Manual
(RESTART parameter).
Setting
Checkpoint –
//SYSCKEOV DD DSNAME=SAMPLE.CHK, DISP=MOD
//IN1 DD DSN=SAMPLE.IN,
DISP=SHR
//OUT1 DD
DSN=SAMPLE.OUT, DISP= (, CATLG, CATLG)
// CHKPT=EOV, LRECL=80,RECFM=FB - A checkpoint is
written in dataset SAMPLE.CHK at the end of each volume of the output dataset
SAMPLE.OUT.
RESTART can be accompanied with a check id, which is
the checkpoint written in the dataset coded in the SYSCKEOV DD statement.
//CHKSAMP JOB CLASS=6, NOTIFY=&SYSUID, RESTART= (STP01,
chk5)
//SYSCHK DD
DSN=SAMPLE.CHK, DISP=OLD
//STP01 EXEC
PGM=MYCOBB
//IN1 DD DSN=SAMPLE.IN,
DISP=SHR
//OUT1 DD
DSN=SAMPLE.OUT, DISP= (, CATLG, CATLG)
//
CHKPT=EOV, LRECL=80, RECFM=FB
Note – When COND is coded in JOB statement, the
condition is tested for every job step. When condition is true at particular
job step, it is bypassed along with the job steps following it. EXEC time will
override JOB Time (Whichever less). JOB REGION will override EXEC region. JOB
condition overrides EXEC COND.
10.
JCL –
Defining Datasets
DSN=&name | *.stepname.ddname
a) Temporary Datasets - DSN=&name
b) Concatenating
Datasets – All datasets must be of same type. Max of
255 sequential datasets can be concatenated together. Max 16 portioned datasets
can be concatenated together.
//SORTIN DD DSN=SAMPLE.INPUT1, DISP=SHR
// DD DSN=SAMPLE.INPUT2, DISP=SHR
// DD DSN=SAMPLE.INPUT3, DISP=SHR
c) Overriding Datasets –
//JSTEP1 EXEC CATLPROC, PROG=CATPRC1,
DSNME=MYDATA.URMI. INPUT
//STEP1.IN1
DD DSN=MYDATA.OVER. INPUT, DISP=SHR <-- Here it will override in
statement(IN1) of CATLPROC
//CATLPROC
PROC PROG=, BASELB=MYCOBOL.BASE.LIB1
//IN1 DD DSN=MYDATA.URMI. INPUT, DISP=SHR
11. Generation Data Group (GDG) – Group of chronologically or functionally related datasets
related to each other by a common name. GDG base (common name).
Latest version – X(0) / previous version – X(-1) /
next version – X(+1)
DEFINE GDG(NAME(MYDATA.URMI.SAMPLE.GDG) - LIMIT(7)
- EMPTY / NOEMPTY – SCRATCH / NOSCRATCH)
– (TO DATE / FOR DAYS)
SCRATCH - Physically deletes the generation when it is
uncatalogued.
EMPTY - uncatalogued all the generations when the
LIMIT is reached.
DELETE GDG –
DELETE(X) GDG FORCE/PURGE (FORCE – don’t delete dataset yet to expire / PURGE –
delete GDG versions & the GDG base irrespective of expiration date).
12. INPUT/OUTPUT Methods - INSTREAM
DATA
//STEP10 EXEC PGM=MYPROG
//SYSIN DD *
//CUST1 1000 ß here CUST1
value is passed to program MYPROG.
(Also, through file - //SYSIN DD DSN=
SAMPLE.SYSIN.DATA, DISP=SHR)
Output in a JCL can be catalogued into a dataset or
passed to the SYSOUT. SYSOUT=* redirects the output to the same
class as mentioned in the MSGCLASS. Specifying MSGCLASS=Y saves
the job log in the JMR (Job log Management and Retrieval).
Job logs can also be saved into a dataset by SYSOUT
and SYSPRINT.
//OUT1 DD
SYSOUT=*
//SYSOUT DD DSN=MYDATA.URMI.
SYSOUT, DISP=SHR
//SYSPRINT DD DSN=MYDATA.URMI. SYSPRINT, DISP=SHR
13.
Running
COBOL Programs –
Compiling –
//STEP1 EXEC IGYCRCTL,PARM=RMODE,DYNAM,SSRANGE
//SYSIN DD DSN= MYDATA.URMI.SOURCES(MYCOBB),DISP=SHR <- COBOL Pgm
//SYSLIB DD DSN= MYDATA.URMI.COPYBOOK(MYCOPY),DISP=SHR
//SYSLMOD DD DSN=MYDATA.URMI.LOAD(MYCOBB), DISP=SHR
<- Load Module
RUNNING –
//STEP10 EXEC
PGM=MYPROG,PARM=ACCT5000
//STEPLIB DD
DSN=MYDATA.URMI.LOADLIB,DISP=SHR
//INPUT1 DD
DSN=MYDATA.URMI.INPUT,DISP=SHR
//OUT1 DD
SYSOUT=* <- producing one output
file written to spool
//SYSTIN DD*
DSN SYSTEM(GRT1)
RUN PROGRAM(DSNSTEP2) PLAN(DSNSTEP2)
LIB(‘DB2P.RUNLIB.LOAD’)
//END
Running
COBOL-DB2 Program - DBRM is bound to the DB2 region (environment) in which
the COBOL will run using the IKJEFT01. COBOL-DB2 program is run using IKJEFT01
with the load library and DBRM library as the input.
//STEP001 EXEC
PGM=IKJEFT01
//STEPLIB DD
DSN= MYDATA.URMI.DBRMLIB, DISP=SHR DSN
SYSTEM(SSID) RUN PROGRAM(MYCOBB)
PLAN(PLANNAME) PARM(parameters to COBOL program) - LIB('MYDATA.URMI.LOADLIB') END
14.
Passing
data from JCL to COBOL
a) Through file, referred in the program using the DD name INPUT1.
b) via PARM (PARM parameter, data received in
the LINKAGE section of program in its defined variable.
LINKAGE
SECTION
01
PARM-BUFFER
05
PARM-LENGTH PIC S9(4) COMP.ß 2 bytes binary value specfy length data string
05
PARM-NAME PIC X(100).ß Max length
that can be passed via PARM is 100 bytes
JCL
//MYJOB
EXEC PGM=COBPROG, PARM=RAMESH
c) via SYSIN (ACCEPT statement reads one whole record into a working
storage variable defined in the program).
//SYSIN
DD*
23052014
COBOL
PROCEDURE
DIVISION
ACCEPT
EMP-NUMBER
15. IBM Datasets Utilities –
a)
DSNHPC Utiliity – Precompilation
b)
IGYCRCTL - Compiler
c)
IEWL – Link Edit.
d)
IKJEFT01 – BIND / Unload table (Image copy) / Issue
TSO Commands
e)
IEBGENER – Copy one sequential file to another
f)
IEBCOPY –Copy partitioned dataset(loading / unloading)
.
g)
IEHPROGM –catalog / uncatalog / rename datasets.
h)
IEBCOMPR – Compare two sequential/partitioned
datasets.
i)
IEFBR14 – Null pgm/execute single statement specify
end of program / Dummy utility/ create empty dataset or delete an existing
dataset.
j)
DSNUTILB – Unload auxiliary table(image copy).
k)
DFSORT/SORT – Sort file
l)
IDCAMS – VSAM dataset creation/REPRO – load VSAM
dataset
m)
DSNUPROC – Load Tables / REORG / RUNSTATS
n)
IKFCBLOO – Compiler Pgm
o)
IFASMFDP - SMF Dump Pgm
p)
A11RMS/U11RMS – Rerun job multiple Times, restart from
abended step, existing file in catalog deleted & recreated.
q)
DB2TSOB – Stop / Start database & start in utility
mode from R/W status / REORG
r)
DSNTAUL -Unload / Image copy
s)
NDMSEND – NDM
t)
DSNTEP2 – Create table
u)
UCC11RMS – Delete Step
v)
IEBEDIT – to include / exclude JCL steps
w) IEHMOVE -
x) IEBGENER
(SYSUT1 – read input dataset / SYSUT2 – write the data / SYSIN – Special
instructions / SYSPRINT – write report what it IEBGENER did)
16.
JCL – Basic
Sort Tricks –
//STEP10 EXEC PGM=SORT, REGION=1024K,PARM=Parameter
//SYSOUT DD SYSOUT=* ß OUT Msg from Sort
//SORTIN DD DSN=..,DISP=SHR ß INPUT FILE
//SORTOUT DD DSN=.., ß OUTUT FILE
//SORTFXX DD DSN=.., ß OUTPUT dataset
//SORTWKnn DD UNIT = SYSDA ß Work file
if SORT request
//SYSIN DD*
SORT CONTROL
STATEMENT
//
a) SORT a given file
SORT FIELD = (1,3,CH,A,9,3,CH,A) [ 1 - first position, 3 –
Length , CH – Character, A – Ascending
order]
b) Eliminate Duplicates
SORT FIELDS=(1,15,ZD,A) SUM FIELDS=NONE <- output file will
contain unique employee numbers sorted in ascending order.
c) Split file into two or three files depends on
condition
SORT FIELDS = COPY
OUTFIL FILES = 01, INCLUDE= (1,6,CH, EQ,(‘MOHANK’))
OUTFIL FILES = 02, INCLUDE= (1,6,CH, EQ,(‘SURESH’))
OUTFIL FILES = 01, ENDREC= 100
OUTFILE FILES=02, STARTREC = 101, ENDREC=200
OUTFILE FILES=02, STARTREC = 200
STARTREC and ENDREC – Splitting file into 3 parts
d) COPY Eliminate duplicates into another file
SORT FIELDS=(1,3,CH,A)
SUM FIELDS = NONE,XSUM ß Copy to another data set defined in SORT XSUM Step.
e) COPY records depending on condition
SORT FIELDS = COPY
INCLUDE COND = (1,6,CH,EQ,(‘SURESH’)
f) Formatting a file using INREC
SORT FIELDS = COPY
INREC FIELDS= (7:2,5,20:10,3) ß Data at 2nd
position of input file with length 5 copied to 7th position of
output file.
INREC( Reformat fields before records are sorted or merged)
/OUTREC (After) / SKIPREC = n (Sort skip n records in input file) / STOPAFT = n
(Sort stop after n records)
g) Adding Sequence no. To file
SORT FIELDS = COPY
BUILD = (1:1,5,10:SEQNUM,4,ZD,START=1000,INCR=2)
h) Adding Header/Trailer to output file
SORT FIELDS = COPY
HEADER=(1’HDR’,10:X’020110131C’)
TRAILER=(1L’TRL’,TOT=(10,9,PD,TO=PD,LENGTH=9)
i)
File
Comparison (//MAIN DD* & //LOOKUP DD*)
JOIN KEYS – Fields on which two files are compared.
JOIN KEYS F1= MAIN, FIELD=(1,4,A)
JOIN KEYS F1= LOOKUP, FIELD=(1,4,A)
JOIN UNPAIRED – does a full outer join on two files.
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS – Place match record in MATCH file
& unmatched records in NOMATCH1, NOMATCH2
//SYSIN DD
* OPTION COPY INREC OVERLAY=(47:1,6) <- the content
in position 1,6 is overwritten to the positio47,6 and then copied to the output
file.
j)
Backing up a file - IEBGENER
copies the file in SYSUT1 to file in SYSUT2.
k) ICETOOL
//JSTEP020 EXEC PGM=ICETOOL
//TOOLIN DD
* COPY FROM(IN1) TO(OUT1)
USING(CTL1)
//CTL1CNTL DD * OPTION
STOPAFT=10 ß Only first
10 records to write to output file.
17.
Common JCL Abends
a) JCL Error –
File attribute don’t match; For example, I have given RECFM=VB RECLEN is same
as that specified in FD section. Why do I get this error? For variable record
format files, you should add 4 bytes to record length in DCB in JCL (LRECL =
404 i.e. 4 Length more)
b) S322 –
Timed out, try changing job class.
c) S806 – Load
module not found. Check library specified in Joblib.
d) S913 –
Insufficient authority. Check if you have specified access to dataset.
e) S878 –
Region size is not enough. Increase the
value you have specified in region parameter of Job statement or in Exec step.
Or you can give Region=0M; in this case, the system will allocate the maximum
size available.
f) S522 – Job
cancelled by either user or operator.
g) SOC4 –
Storage related problem. Check your linkage, table definition, and FD section.
h) S013 – A
file open error.
i)
S722 – The Sysout or spool is full, your program is
writing too many things to sysout. Increase job’s Sysout limit by specifying
‘LINES=(150,WARNING)’ option in job statement and then retry. This will
increase your Sysout limit to ‘150’ thousand lines.
j)
SOC7 – Invalid character in COMP/COMP-3 numeric field
– Check all COMP/COMP-3 numeric fields and arithmetic operations / Data
exception error.
k) SOC7 Abend
– occurs when an invalid character is present in COMP/COMP-3 numeric field and
you tried to manipulate that field by some arithmetic expressions.
l)
SB37 – Space issue (in create VSAM, recreate VSAM)
m) SOC4E – Space
Issue
n) SOC1 - Misspelt
DD Name / Read write unopened dataset.
Note – Many
times for SOC7 is an un-initialized numeric item. Examine that possibility
first, Examine Dump, they provide OFFSET of last instruction where abend
occurs. Check in compilation output, XREF listing to get the VERB and the line
no. of source code at this offset. Define datasets ‘SYSABOUT’ in JCL to capture
runtime dumps.
18.
Restore
file from Tape to DASD
a) IDCAMS (REPRO)
//INPUT
DD DSN=FILE.ON.DASD
//OUTPUT
DD DSN=FILE.ON.TAPE
//SYSIN
DD*
REPRO
INFILE(INPUT) OUTFILE(OUTPUT)
b) IEBGENER
19.
Copy ESDS file
to KSDS
a) REPRO
INFILE(KSDS) - OUTFILE(ESDS) -SKIP(100) -COUNT(100)
b) IEBGENER
Copy
PS to PDS or vice versa
FROMKEY,
TOKEY
20. SDSF – JESJCL (Expanded JCL,PROC or Expandable step) /
JESYSMSG (dataset related errors) / SYSOUT (consists of output msg which
generated in JCL) / JESMSGLG ( Time of
submission system resources consumed, id job requires some dataset).
21. SYSTEM Libraries – SYS1.LPALIIB (execution
modules) / SYS1.PARMLIB (control parameter for Z/OS) / SYS1.PROCLIB (JCL
Procedure) / SYS1.CMDLIB (Implement TSO commands).
22. Run Selected Steps –
a) Condition
Codes – True (Step Skipped) / False (Step Executed)
Cond
= (0,GT) – Always false / Cond=(0,LE) – Always True, Cond = EVEN / ONLY
b) IEBEDIT –
//SYSIN
DD*
EDIT TYPE = INCLUDE, STEPNAME= (Step2,Step4)
/*
23.
JCL Dumps – Coded
after EXEC statement, to check error when pgm abends.
SYSDUMP / SYSABEND / SYSMDUMP
//SYSDUMP DD SYSOUT=*
24.
Restart in
IF-Else loop step
//Step01 EXEC PROC1
IF MAXCC = 0
// Step02 EXEC PROC2
ELSE
// Step03 EXEC PROC3
Ans – Restart = Step02 (Compiler ignore If- Else)
25. REFERBACKS – Backward reference is used
to copy information from a previous DD statement (within same Job). Also
applied to pgm parameter on EXEC statement. Can be applied to 3 parameters (DSN
/ VOL /DCB).
Parameter = *.stepname.DDname
PGM = *.stepname.SYSLMOD
DSN = *.step010.DD1
Note – If points in same step than can omit stepname.
26. Error Checking (OFFSET) – Compiler listing (SCLMTFS.LISTING.PGMNAME)
Then find the variable and check in C-DUMP there it
will show the last record for that variable.
27. Create a
dataset in a JCL with same file organization as that of another dataset.
Ans – IEBGENER / Pass existing file in SYSUT1, new in
SYSUT2 & mention DCB=*.SYSUT1
28. PS &PDS (PDS – Folder, portioned
dataset, each member can be read as sequential file / PS – Sequential file,
contain PGM, JCL etc)
29. Next
(period) / Continue (Delimiter)
30. Overriding
a file ‘FILE1’ in JCL – in step02 of a PROC called in JCL.
//Step01 EXEC PROC1 à PROC1 //STEP02 EXEC PROC2 //INFILE DSN = “FILE1”.
31. INPUT File
HCL TECHNOLOGIES !@#$
IBM MAINFRAMES %&A*
OUTPUT
TECHNOLOGIES
MAINFARMES
ANS – a) By using SORT b) By using COBOL Pgm c) By
using SELCOPY
32. INPUT File
MAINFRAME
JAVA
QC
SQL
OUTPUT File
MAINFRAM IBM
JAVA
TCS
QC
HP
SQL
ORACLE
ANS – a) By using SORT b) By using COBOL Pgm
33. There are 3
duplicates records in a file. How to remove 2 duplicates records and copy only
one using JOB control language?
Ans – SORT the PS using JCL utility & update the
PS file. Find the duplicates using XSUM. Write the duplicates alone in a
separate PS. Take the separate PS and give the control condition inside SYSIN
DD* as, sort fields with SKIPREC (3), since only 3rd one is needed
to copy.
34. //INFILE DD
DSN=&&TEMP ß Created
during JOB & deleted at end of JOB.
35. How do you
restart a program from step 2?
Ans – RESTART from Step 2 / IEBEDIT
36. If file is
empty & open in Input mode or output mode. What will happen?
Ans: VSAM file
open in INPUT à -160 Error
/ Output – Unavailable
37. How to
include bind in JCL?
No comments:
Post a Comment