Monday, March 8, 2010

6. UTILITY

IEFBR14 UTILITY

This Utility is commonly used to delete, allocate and to uncatalog dataset

Example 1 :

//DELETE EXEC PGM=IEFBR14
//* TO DELETE A FILE
//DD1 DD DSN=DA0001T.EMPLOYEE,
// DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA, SPACE=(TRK,0)


Example 2

//CREATE EXEC PGM=IEFBR14
//*TO ALLOCATE A NEW FILE
//DD1 DD DSN=DA0001T.EMPLOYEE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(2,1)),
// DCB=(BLKSIZE=800,LRECL=80,
// RECFM=FB,DSORG=PS)


An excerpt of a code illustrating, the deletion of a dataset, before COBRUN1 step is executed.

//DA000ITA JOB LA2719,PCS,NOTIFY=DA0001T,
// MSGCLASS=X, MSGLEVEL=(1,0)
//DELETE EXEC PGM=IEFBR14
//LOGFILE DD DSN=DA0001T.MYFILE2,
// SPACE=(TRK, (0),),UNIT=SYSDA
//COBRUN1 EXEC PGM=PROG2V1,PARM='AAAA'
//STEPLIB DD DSN=DA00021T,PVDB2.LOADLIB,
// DISP=SHR
//INFILE DD DSN=DA00021T, EMPLOYEE
DISP=OLD
//OUTFILE DD DSN=DA00021T.MYFILE2,
// DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=80, DSORG=PS,
// BLKSIZE=80, RECFM=FB),
// VOL=SER=BS3011,
// SPACE=(TRK, (45,15))
//SYSOUT DD SYSOUT=*


IEBGENER UTILITY

• This utility is commonly used to copy, concatenate and to empty sequential datasets

************************************************************************
* USING THE IEBGENER UTILITY TO COPY DATASETS
* SYSSUTI PROVIDING THE INPUT AND SYSUT2 BEING
* THE OUTPUT
************************************************************************

//DA0001TA JOB LA2719, PCS, NOTIFY=DA000IT,
// MSGCLASS=X
//CPYSTEP EXEC PGM=IEBGENER
//SYSSUT1 DD DSN=DA000IT.INDATA3, DISP=SHR
//SYSUT2 DD DSN=DA0001T.NEW,DISP=MOD
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//




************************************************************************
* USING THE IEBGENER UTILITY TO CONCATENATE DATASETS
* SYSSUT1 PROVIDING THE INPUT AND SYSUT2 BEING
* THE OUTPUT
************************************************************************
//DA0001TA JOB LA2719,PCS,NOTIFY=DA000IT,
// MSGCLASS=X
//CPYSTEP EXEC PGM=IEBGENER
//SYSUT1 DD DSN=DA000IT.INDATA1,DISP=SHR
// DD DSN=DA000IT.INDATA3,DISP=SHR
//SYSUT2 DD DSN=DA0001T.MYOUT,
// DISP=(NEW, CATLG, DELETE),
// UNIT=SYSALLDA,
// SPACE=(TRK,(5,1),RLSE)


************************************************************************
* USING THE IEBGENER UTILITY TO EMPTY EXISTING DATASET
************************************************************************
//DA0001TA JOB LA2719,PCS,NOTIFY=DA00IT,
// MSGCLASS=X
//CPYSTEP EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DUMMY, DCB=(BLKSIZE=800,
// LRECL=80, RECFM=FB)
//SYSUT2 DD DSB=DA000IT.MYOUT,
// DISP=SHR
//SYSIN DD DUMMY
//


SORT UTILITY

• The utility is commonly used to sort data, copy selective data, remove duplicates, change data throughout the file.

• This is the utility provided by MVS

USAGE : It reorders the Physical Sequential dataset as per requirement on given
field(s)
: These fields are called control fields or key fields.

WORKING : It assumes that all input records are out of sequence and it puts them in sequence you request.

Eg. Employee data is sorted in the sequence of Emp. No., Emp. Name or Salary etc.

SORT UTILITY

Syntax

Sort fields = (position, length, format, sequence) or
Sort fields = (position, length, sequence….), format = format

This syntax is used if all the fields on which the dataset to be sorted are of same type.

Position : Location of the 1st byte of the key field, in the input record

Length : Length in bytes of the key field. Sum of all key fields (their lengths) should not exceed 4092

Format : Two characters code that identifies the format (type) of the data

Sequence : A - Ascending
D - Descending

MERGE UTILITY

• This assumes that record are in proper sequence but at different locations i.e. in different files. It merges those files into one, in the given sequence.

Eg. : General ledger transactions for different months, in the sequence of a/c no. to be merged in one file.

SORT UTILITY






SORT JCL 1

//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T.MSGCLASS=X
//*******************************************************
//*SORT ON THE EMPLOYEE NAME IN ASCENDING ORDER
//*******************************************************
//SRTSTEP EXEC PGM = SORT
//SYSIN DD *
SORT FIELDS = (1,5,CH,A)
/*
//SORTIN DD DSN=DA0001T.EMPLOYEE,DISP=SHR
//SORTOUT DD DSN=DA0001T.OUT SORT,
// SPACE=(TRK,(3,3)), UNIT=SYSDA
//SORTWK01 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK02 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK03 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK04 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//


SORT JCL 2

//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T.MSGCLASS=X
//*******************************************************
//*SORTS ON ASCENDING DEPTNO & DESCENDING ENAME
//*******************************************************
//SRTSTEP EXEC PGM=SORT
//SYSIN DD *
SORT FIELDS = (17,2,PD,A,2,6,CH,D)
//SORTIN DD DSN=DA000IT.DEPT,DISP=SHR
//SORTOUT DD DSN=DA000IT.SORTOUT2
// DISP=NEW,CATLG,DELETE)
// SPACE=(TRK,(3,3)),UNIT = SYSDA
//SORTWK01 DD SPACE(TRK,(10,5)), UNIT=SYSALLA
//SORTWK02 DD SPACE(TRK,(10,5)), UNIT=SYSALLA
//SORTWK03 DD SPACE(TRK,(10,5)), UNIT=SYSALLA
//SORTWK04 DD SPACE(TRK,(10,5)), UNIT=SYSALLA
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//










SORT JCL 3

TO COPY SELECTIVE DATA

a) INCLUDE COND copies data that matches the condition given for e.g. in this case it will copy data where one character in 19th position equals 'M' or 'S'.

//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T.MSGCLASS=X
/***********************************************************************
* SORTS ON THE INPUT FILE ON JOB AND SELECTS JOB BEGINNING WITH M
OR S INTO A DATA SET
//**********************************************************************
//SRTSTEP EXCE PGM=SORT
//SYSIN DD *
OPTION EQUALS
SORT FIELDS = (19,6,A), FORMAT=CH
INCLUDE COND = (19,1,CH,EQ,C'M', OR, 19, 1, CH, EQ, C 'S')
/*
//SORTIN DD DSN=DA0001T.INDATA3,DISP=SHR
//SORTOUT DD DSN=DA0001T.SORTOUT3,DISP=(NEW, CATLG)
// SPACE=(TRK,(3,3)), UNIT = SYSDA,
// DCB=(BLKSIZE=800, LRECL=80, RECFM=FB,
// DSORG=PS)
//SORTWK01 DD SPACE=(TRK,(10,5)), UNIT=SYSALLDA
//SORTWK02 DD SPACE=(TRK,(10,5)), UNIT=SYSALLDA
//SORTWK03 DD SPACE=(TRK,(10,5)), UNIT=SYSALLDA
//SORTWK04 DD SPACE=(TRK,(10,5)), UNIT=SYSALLDA
//SYSOUT DD SYSOUT=*
//


SORT JCL 4 (Sorts on Job and selects Jobs beginning with M and Deptno beginning with 1)

//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T.MSGCLASS=X
//********************************************************
//*SORTS ON JOB INCLUDES JOBS BEGINNING WITH M AND DEPTNO
*BEGINNING WITH 1
//********************************************************
//SRTSTEP EXEC PGM=SORT
//SYSIN DD *
OPTION EQUALS
SORT FIELDS = (19,6,A),FORMAT=CH
INCLUDE COND=(19,1,CH,EQ,C'M',AND,51,1,CSF,EQ,1)
/*
//SORTIN DD DSN=DA0001T.INDATA3,DISP=SHR
//SORTOUT DD DSN=DA0021T.SORTOUT4,DISP=NEW,CATLG),
// SPACE=(TRK,(3,3,)), UNIT = SYSDA,
// DCB=(BLKSIZE=800, LRECL=80, RECFM=FB,
// DSORG=PS)
//SORTWK01 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK02 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK03 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SORTWK04 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA
//SYSOUT DD SYSOUT=*
//

SORT UTILITY

SORT JCL 5 (Sorts on Job and omits Jobs beginning with M or S

OMIT COND: INCLUDE and OMIT are mutually exclusive

Records which do not satisfy the condition are sorted and copies into the output dataset

//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T,MSGCLASS=X

//********************************************************
//*SORTS ON JOB *OMITS JOBS BEGINNING WITH M OR S
//********************************************************
//SRTSTEP EXEC PGM=SORT
//SYSIN DD *
OPTION EQUALS
SORT FIELDS = (19,6,A),FORMAT=CH
OMIT COND = (19,1,CH,EQ,C,'M',OR, 19,1,CH,EQ,C'S')
/*

Back to JCL Index
Back to home page

No comments: