JCL programs

What is a JCL?

                JCL is job control language which is use to run any programs in mainframes and jcl is act as interact between user program and operating system of mainframes.
 
JCL uses :

  1. Identification of name of the program.
  2. Identification which is input and output datasets.
  3. Identification hardware to print output.
JCL syntax:
  1. JOB.----------------IDENTIFICATION THE BEGINNING OF JOB.
  2. EXEC--------------IDENTIFICATION THE NAME OF PROGRAM OR PROCEDURE.                                                                              (max we can write 255 EXEC statement).
  3. DD-----------------IDENTIFICATION THE DATASETS.(max we can write 3273 DD                                                                                                    statement).
What are IBM utility?

                  IBM provides some of utility which are use to create,delete,merge of dataset.

List of important of utility?
  1. IEFBR14.
  2. IEBGENER.
  3. IEBCOPY.
  4. IEBEDIT.
  5. SORT OR ICEMAN.

IEFBR14:

           IEFBR14 is a dummy program, normally inserted to JCL when the only desired action is allocation or deletion of datasets.

An example of IEFBR14:

//KC03P884   JOB  123,'RAVI',NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//DD1 DD DSN=KC03P884.SAMPLE.PS,DISP=(NEW,CATLG,DELETE),
//                       SPACE=(TRK,(10,15,0)),
//                       DCB=(LRECL=30,RECFM=80,BLKSIZE=80,DSORG=PS)
//SYSPRINT DD  SYSOUT=*
//SYSIN DD DUMMY=*

NOTE: For  physical dataset ------DSORG=ps, DIRECTORY block=0.
           For  partition dataset--------DSORG=PD,DIRECTORY block= 1 or more than 1. 

IEBGENER:

                   IEBGENER copies records from a sequential dataset, to  a partitioned dataset(member) or vice versa. 
Some of the tasks that IEBGENER can perform include the following:
  1. Creating a backup of a sequential data set or a member of a PDS.
  2. Changing the physical block size or logical record length of a sequential data set.
  3. Creating an edited data set.
  4. Printing a sequential data set or a member of a PDS.
  5. Creating partitioned output data set from sequential input data set.                
                   
An example of an IEBGENER program to copy one dataset to another:

//KC03P884   JOB  123,'RAVI',NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSUT1 DD DSN=KC03P884.SAMPLE.PS,DISP=SHR
//SYSUT2 DD DSN=KC03P884.SAMPLE.PS1,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSIN DD DUMMY=*

NOTE:     SYSUT1------------------input dataset.        SYSUT2-----------------------output dataset .
DD name are predefined.

IEBCOPY:

                 IEBCOPY copies, compresses and merges partitioned data sets. It can also select or exclude specified members during the copy operation, and rename or replace members.

Some of the tasks that IEBCOPY can perform include the following:
  1. Creating a backup of a partitioned data set (PDS)
  2. Copying a PDS in place to reclaim the unused space from deleted members; Also called compressing a PDS.
  3. Copying selected members to another PDS.
  4. Renaming selected members of a PDS.
  5. Merging multiple partitioned data sets into a single PDS.
  6. Altering, copying and reblocking load modules
COPY PARTICLE MEMBER FOR PDS TO PDS
//KC03P884   JOB  123,'RAVI',NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//MYDD1 DD DSN=KC03P884.SAMPLE.PDS1,DISP=SHR,
//MYDD2 DD DSN=KC03P884.SAMPLE.PDS2,DISP=SHR
//SYSIN DD *
                 COPY INDD=MYDD1,OUTDD=MYDD2
/*
//

COPY  PARTICLE MEMBER
//KC03P884   JOB  123,'RAVI',NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//MYDD1 DD DSN=KC03P884.SAMPLE.PDS1,DISP=SHR,
//MYDD2 DD DSN=KC03P884.SAMPLE.PDS2,DISP=SHR
//SYSIN DD *
                 COPY INDD=MYDD1,OUTDD=MYDD2
                  SELECT MEMBER=(M1,M2)/EXECLUDE MEMBER=(M1,M2)
/*
//
COMPRESS
//KC03P884   JOB  123,'RAVI',NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//MYDD1 DD DSN=KC03P884.SAMPLE.PDS1,DISP=SHR,
//SYSIN DD *
                 COPY INDD=MYDD1,OUTDD=MYDD1
 /*
//
RENAME
//KC03P884   JOB  123,'RAVI',NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//MYDD1 DD DSN=KC03P884.SAMPLE.PDS1,DISP=SHR,
//MYDD2 DD DSN=KC03P884.SAMPLE.PDS2,DISP=SHR
//SYSIN DD *
                 COPY INDD=MYDD1,OUTDD=MYDD2
                  SELECT MEMBER=EM2,((MEM1,DAY1,R),(MEM2,R))
/*
//
MERGE
//KC03P884   JOB  123,'RAVI',NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//MYDD1 DD DSN=KC03P884.SAMPLE.PDS1,DISP=SHR,
//MYDD2 DD DSN=KC03P884.SAMPLE.PDS2,DISP=SHR
//MYDD3 DD DSN=KC03P884.SAMPLE.PDS3
//SYSIN DD *
                 COPY INDD=(MYDD1,MYDD2),OUTDD=MYDD3
                
/*
//


SORT:
              The Sort/Merge utility is program to sort records in a file into a specified order, or merge pre-sorted files. It is very frequently used; often the most commonly used application program in mainframe shop. Modern sort/merge programs also can select or omit certain records, summarize records, remove duplicates, reformat records, and produce simple reports. 


/STEP1  EXEC PGM=SORT,REGION=1024K,PARM=parameters
//SYSOUT DD SYSOUT=* --------------------------Output messages from SORT
//SORTIN DD DSN=...,DISP=SHR---------------- Input if SORT request
//SORTOUT DD DSN=...---------------------------- Output for SORT request
//SORTOFxx DD DSN=... OUTFILE----------------Output data sets
//SORTXSUM DD DSN=... ---------------------------Output eliminated by the SUM stm
//SORTWKnn DD UNIT=SYSDA, -------------------Work files if SORT request
//SYSIN DD * --------------------------------------------Control statement input data set
                 sort control statements
/*
.1---------------------------------------
//SYSIN DD *
SORT FIELDS=(1,3,CH,A,9,3,CH,A)

/*

EXPLANATION
Above syntax of SORT sorted the recrods, depends
on keys we have provided
(we have provided two keys in FIELDS parameter)
FIRST KEY
1,3,CH,A ‐ first key started at col 1 , its length is 3
SECOND KEY
9,3,CH,A ‐ second key started at col 9, its length is 3
In the above example,
CH‐ means character we may use BI for binary
A ‐ Ascending order

ELEMINATE DUPLICATES

//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=NONE

/*

EXPLANATION

if we give SUM FIELDS=NONE it will eliminate duplicates

SPLIT FILE INTO TWO OR THREE FILES DEPENDS ON

CONDITIONS

.../
/SORTOF01 DD DSN=dataset1,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SORTOF02 DD DSN=dataset2,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SORTOF03 DD DSN=dataset3,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
...
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(1,6,CH,EQ,C'MOHANK')
OUTFIL FILES=02,INCLUDE=(1,6,CH,EQ,C'SURESH')
OUTFIL FILES=03,INCLUDE=(1,6,CH,EQ,C'KRISHN')

/*


EXPLANATION
1. SORT FIELDS=COPY ‐ indicate , it for copy of records, not for sort
2. OUTFIL FILES=01,INCLUDE=(1,6,CH,EQ,C'MOHANK')
OUTFIL FILES=02,INCLUDE=(1,6,CH,EQ,C'SURESH')
OUTFIL FILES=03,INCLUDE=(1,6,CH,EQ,C'KRISHN')
‐ SYNCSORT will take data from 1st positioon to 6th position of input
file and it will compare that data with MOHANK or SURESH or KRISHN
‐ If data equals to MOHANK then that recorrd will copies to dataset defined
in SORTOF01 step. ( because we defined FILES=01 in second condition )
‐ If data equals to SURESH then that recorrd will pass to dataset defined
in SORTOF02 step. ( because we defined FILES=02 in second condition )
‐ If data equals to KRISHN then that recorrd will copied to dataset difned

in SORTOF03 step. ( because we defined FILES=03 in third condition )

COPY ELIMINATED DUPLICATES INTO ANOTHER FILE ‐ SAMPLE

JCL

../
/SORTXSUM DD DSN=datasetname,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=NONE,XSUM
/*

EXPLANATION
1. SORT FIELDS=(1,3,CH,A)
Input file will be sorted depending up on the key specified above
1,3,CH,A ‐ key starting position is 1 and length 3, comparing type
character, sorting is don in ascending order
2. SUM FIELDS=NONE,XSUM
SUM FIELDS=NONE means it will eliminate duplicates
XSUM options will copy all records eliminated in sort
process will copy to another data set defined in
SORTXSUM step


COPY RECORDS DEPENDING UPON CONDITION

//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,6,CH,EQ,C'SURESH')
/*


EXPLANATION
above card is to copy records from input file which
contains SURESH at 1st position


FORMATING A FILE (USING INREC)

//SYSIN DD *
SORT FIELDS=COPY
INREC FIELDS=(7:2,5,20:10,3)

/*


EXPLANATION
1. SORT FIELDS=COPY
It is for copy records to output file
2. INREC FIELDS=(7:2,5,20:10,3) (for formatting)
Here we have two formattings,
1. 7:2,5 ‐ data at 2nd position of input file with length 5
copied to 7th position of output file
2. 20:10,3 ‐ data at 10th position of input file with length 3
copied to 20th position of output file.

IEBEDIT

  To excited a particle step in a jcl.

//IEBEDITJ JOB ACCT,'',CLASS=P,MSGCLASS=T,MSGLEVEL=(1,1),NOTIFY=&SYSUID
//STEP0001 EXEC PGM=IEBEDIT
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=xxxxx.yyyyy.zzzzz,DISP=SHR
//SYSUT2   DD SYSOUT=(*,INTRDR)
//SYSIN    DD *
    EDIT TYPE=INCLUDE,STEPNAME=(STEP10,STEP5,STEP15)
/*
//

In this example, data set xxxxx.yyyyy.zzzzz should contain sample JCL job(s) (which should include steps named STEP5, STEP10, and STEP15). This IEBEDIT routine copies the selected steps of the sample job onto the SYSUT2 output file (in this example, the internal read execution queue
TYPE={POSITION|INCLUDE|EXCLUDE} specifies the contents of the output data set
POSITION specifies that the output is to consist of a JOB statement, the job step specified in the STEPNAME parameter, and all steps that follow that job step. All job steps preceding the specified step are omitted from the operation. POSITION is the default.
INCLUDE specifies that the output data set is to contain a JOB statement and all job steps specified in the STEPNAME parameter.
EXCLUDE specifies that the output data set is to contain a JOB statement and all job steps belonging to the job except those steps specified in the STEPNAME parameter.

NOTE:

SYSIN--------------------------- TO PASSING A PARAMETER
SYSUT1--------------------------INPUT FILE
SYSUT2--------------------------OUTPUTFILE
SYSPRINT-----------------------TO PRINT SYSTEM GENERATED MESSAGE
                                                  (LIKE CONDITION  CODES,RECORDS PROCESSOR)
SYSOUT-------------------------OUTPUT FILE FOR MESSAGE.
SYSDUMP-----------------------OUPUT FILE FOR A SYSTEM 'DUMP' IF THE PROGRAM FAILS.

Comments

Popular posts from this blog

COBOL + DB2 complication process.

ABEND list for JCL

difference between jes2 and jes3