Vous êtes sur la page 1sur 31

IBM UTILITIES

Table of Contents

1. INTRODUCTION.............................................................................................................4
Objective..........................................................................................................................................................................4

2. IEFBR14..........................................................................................................................5 3. IEBGENER......................................................................................................................6
CONTROL STATEMENTS..........................................................................................................................................7 GENERATE ...................................................................................................................................................................7 RECORD.........................................................................................................................................................................8 MEMBER........................................................................................................................................................................8

4. IEBCOPY......................................................................................................................11
Control Statements.......................................................................................................................................................12 COPY.............................................................................................................................................................................12 SELECT.........................................................................................................................................................................12 EXCLUDE.....................................................................................................................................................................13 COPYMOD...................................................................................................................................................................14 ALTERMOD.................................................................................................................................................................14

5. IEBUPDTE....................................................................................................................19
Outputs of IEBUPDTE.................................................................................................................................................19 Control Statements.......................................................................................................................................................20 FUNCTION...................................................................................................................................................................20 DETAIL.........................................................................................................................................................................21 DATA.............................................................................................................................................................................21 ALIAS............................................................................................................................................................................21 ENDUP...........................................................................................................................................................................22

6. DFSORT........................................................................................................................26
Cognizant Academy Version <Ver #> Page 2 of 31

DATA FORMATS........................................................................................................................................................27 Sorting By Multiple Fields...........................................................................................................................................27 Tailoring the Input File................................................................................................................................................27 Rules for Padding/Truncation.....................................................................................................................................27 INCLUDE & OMIT statement....................................................................................................................................29 Reformatting Records..................................................................................................................................................29 INREC & OUTREC statement...................................................................................................................................29 MERGE FILES.............................................................................................................................................................30 Processing Order of Control Statements....................................................................................................................30

7. REFERENCES..............................................................................................................31

Cognizant Academy

Version <Ver #>

Page 3 of 31

IBM Utilities

Introduction

1. Introduction
Objective
The main objective of this courseware Explain the various utilities and its functions namely IEFBR14 IEBGENER IEBCOPY IEBUPDTE DFSORT

Familiarize with data set and system related utilities Implement the utilities for basic operations

Cognizant Academy

Version <Ver #>

Page 4 of 31

IBM Utilities

IEBGENER

2. IEFBR14
IEFBR14 is an IBM utility module which performs two simple functions: Use of IEFBR14 Checks all the job control statements in the step for syntax. Allocates direct access space for data sets. Deletes Specified Data sets Performs data set dispositions. It clears the register 15, thus passing a return code of 0 It then does a branch to the address in register 14, which returns control to the system

EXAMPLE:For deleting data sets://JS20 EXEC PGM=IEFBR14 //DD1 DD DSN=MY.DATA.SET,DISP=(OLD,DELETE) For Changing the Disposition of Datasets://S1 //D1 EXEC PGM=IEFBR14 DD DSN=ABC, DISP=(SHR, KEEP)

For Allocating data sets://S1 //D3 // EXEC PGM=IEFBR14 DD DSN=SYSB, UNIT=3350,VOL=SER=335001, SPACE=(CYL,(4,2,1)),DISP=(NEW,CATLG,KEEP)

Cognizant Academy

Version <Ver #>

Page 5 of 31

IBM Utilities

IEBGENER

3. IEBGENER
What is IEBGENER? IEBGENER is a generalized copy utility used to perform the following tasks: produce a backup copy of a sequential data set, or a member of a PDS or PDSE produce a PDS or PDSE, or a member of either, from a sequential file produce an edited sequential data set, PDS, PDSE, or a member in either Expand an existing partitioned data set or PDSE by creating partitioned members and Handle double-byte character set (DBCS) data Produce printed list of either sequential data sets or PDS/PDSE members Reblock a data set or change its logical record length Provide exit or editing capabilities for label processing, input data editing, Key creation, or permanent I/O error processing. merging them into the existing data set.

Sample JCL Sample IEBGENER JCL: //JS10 EXEC PGM=IEBGENER, REGION=1024K //SYSPRINT DD SYSOUT=* (Messages) //SYSUT1 DD DSN=...,DISP=... (Seq Input File) //SYSUT2 DD DSN=...,DISP=... (Output File) //SYSIN DD * Control Statements /* EXPLANATION: SYSPRINT DD: The SYSPRINT DD statement is required and must have RECFM=FB or F. The BLKSIZE value can be any value up to 32670 that is a multiple of 121.

Cognizant Academy

Version <Ver #>

Page 6 of 31

IBM Utilities

IEBGENER

SYSUT1 DD: The SYSUT1 DD statement points to the input file for the IEBGENER operation. This file can be RECFM=F, FB, V, VS, VB, VBS, or U. The BLKSIZE must be specified in the data set label or via JCL. Variable Spanned (RECFM=VS or VBS) records cannot be copied to the output file if the output file is a PDS or PDSE.

SYSUT2 DD: The SYSUT2 DD statement points to the output file for the IEBGENER operation. This file can be RECFM=F, FB, V, VS, VB, VBS, or U. PDS or PDSE libraries cannot have a RECFM of VS or VBS. Reblocking is accomplished if the SYSUT2 BLKSIZE is a new maximum blocksize. RECFM must be specified for the SYSUT2 file if the data set is new or DUMMY. BLKSIZE must always be specified for the SYSUT2 DD statement if LRECL and RECFM are also specified.

SYSIN DD: The control statement input data set. This can be on DASD, TAPE, or instream SYSIN. The SYSIN BLKSIZE must be a multiple of 80, with a maximum allowed BLKSIZE of 32,720, and a RECFM of F or FB.

CONTROL STATEMENTS
Control statements are continued by placing a non-blank character in column 72, and continuing the statement beginning in column 16 on the next statement GENERATE MEMBER RECORD

GENERATE
The GENERATE control statement is required when: The output data set is partitioned Editing is to be performed User routines are provided and/or label processing is to be done.

Cognizant Academy

Version <Ver #>

Page 7 of 31

IBM Utilities

IEBGENER

SYNTAX: The format of the GENERATE statement is: {label} GENERATE MAXNAME=n {,MAXFLDS=n} {,MAXGPS=n} {,MAXLITS=n} {,DBCS={YES NO}} RECORD
This statement defines a record group and provides editing directions to IEBGENER. This control statement is required when: the output data set is partitioned, or editing is to be performed, or user routines are provided and/or label processing is to be done.

SYNTAX: The format of the RECORD statement is: {label} RECORD {{IDENTIDENTG}=(length,'name',input-location)} {,FIELD=({length} {,input-location 'literal'} {,conversion} {output-location}),{FIELD=...} {,LABELS=n} MEMBER
This statement is used when the output data set is to be a PDS/PDSE. One MEMBER statement must be included for each member being created. All RECORD statements that follow a MEMBER statement refer to the member named by that statement. If a MEMBER statement is not included, the output data set will be sequential.

Cognizant Academy

Version <Ver #>

Page 8 of 31

IBM Utilities

IEBGENER

SYNTAX: The format of the MEMBER statement is: {label} MEMBER NAME=(name{,alias}...)
'name' and 'alias' are member names and aliases desired for the member Multiple aliases are allowed

Example : 1 TO PRINT A SEQUENTIAL DATA SET //PRINT /STEP1 //SYSPRINT //SYSIN //SYSUT1 // // //SYSUT2 // Example : 2 CREATE A PARTITIONED DATA SET FROM A SEQUENTIAL INPUT //TAPEDISK JOB //STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=INSET,UNIT=tape,LABEL=(,SL), // DISP=(OLD,KEEP),VOLUME=SER=001234 //SYSUT2 DD DSN=NEWSET,UNIT=disk, // DISP=(,KEEP),VOLUME=SER=111112, // SPACE=(TRK,(10,5,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=2000) //SYSIN DD * GENERATE MAXNAME=3,MAXGPS=2 MEMBER NAME=MEMBER1 GROUP1 RECORD IDENT=(8,'FIRSTMEM',1) MEMBER NAME=MEMBER2 GROUP2 RECORD IDENT=(8,'SECNDMEM',1) MEMBER NAME=MEMBER3 /* JOB EXEC PGM=IEBGENER DD SYSOUT=A DD DUMMY DD DSN=INPUT,UNIT=disk,DISP=SHR, DCB=(RECFM=F,LRECL=80,BLKSIZE=80), VOLUME=SER=111112 DD SYSOUT=A, DCB=(RECFM=F,LRECL=80,BLKSIZE=80)

Cognizant Academy

Version <Ver #>

Page 9 of 31

IBM Utilities

IEBGENER

Example 3 Edit and Copy a Sequential Input Data Set //DISKDISK JOB /STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=OLDSET,UNIT=disk,DISP=(OLD,KEEP), // VOL=SER=111112 //SYSUT2 DD DSN=NEWSET,UNIT=disk,DISP=(NEW,KEEP), // VOL=SER=111113,DCB=(RECFM=FB,LRECL=80, / BLKSIZE=640),SPACE=(TRK,(20,10)) //SYSIN DD * GENERATE MAXFLDS=4,MAXGPS=1 EXITS IOERROR=ERRORRT GRP1 RECORD IDENT=(8,'FIRSTGRP',1),FIELD=(21,80,,60),FIELD=(59,1,,1) GRP2 RECORD FIELD=(11,90,,70),FIELD=(69,1,,1) /* Example : 4 EDIT DOUBLE-BYTE CHARACTER SET DATA //DBLBYTE JOB /STEP1 EXEC PGM=IEBGENER ///SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=INPUT,DISP=(OLD,KEEP) //SYSUT2 DD DSN=OUTPUT,DISP=(NEW,CATLG), / DCB=(LRECL=80,BLKSIZE=3200,RECFM=FB), // SPACE=(TRK,(1,1)) //SYSIN DD * GENERATE MAXFLDS=4,MAXLITS=9,DBCS=YES RECORD FIELD=(20,1,,1),FIELD=(16,33,VC,21), FIELD=(30,50,VC,39),FIELD=(9,'*********',,72) /*

Cognizant Academy

Version <Ver #>

Page 10 of 31

IBM Utilities

IEBCOPY

4. IEBCOPY
IEBCOPY - what can it do IEBCOPY can perform the following functions. Copying Data Sets Merging Data Sets Unloading Data Sets Loading Data Sets Selecting members to be copied, unloaded or loaded Replacing Members in a Data Set Renaming Selected Members Excluding Members from a Copy operation Compressing a Data Set Altering, Copying and Reblocking load modules PDS to PDSE & Vice Versa

Sample JCL //JS10 EXEC PGM=IEBCOPY,REGION=1024K, // PARM='SIZE=nnnnnnnnK' (Optional PARM) //SYSPRINT DD SYSOUT=* (IEBCOPY Messages ) //DDNAME1 DD DSN=...,DISP=...(Input File) //DDNAME2 DD DSN=...,DISP=... (OUTPUT FILE) //SYSUT DD UNIT=SYSDA, // SPACE=(TRK,(30,30),RLSE) (Work file 1) /SYSUT4 DD UNIT=SYSDA, // SPACE=(TRK,(30,30),RLSE) (Work file 2) /SYSIN DD * Control Statements /*

Cognizant Academy

Version <Ver #>

Page 11 of 31

IBM Utilities

IEBCOPY

Control Statements
Copy Select Exclude Copymod Altermod

COPY
This statement indicates the beginning of a copy operation and identifies the DD statements to be used during the copy The format of the COPY control statement is:

{label} Copy Outdd=ddname, Indd=(ddname1,ddname2,(ddname3,R),...) {,LIST=NO} Examples: Example 1 - Copy all with replace. {label} COPY OUTDD=O,INDD=((I,R)) Example 2 - Copy without replace. {label} C O=TAPE,I=DASD Example 3 - Compress-in-place {label} COPY OUTDD=SYSUT1,I=SYSUT1 SELECT
This statement is used to name members to be included in a copy operation. This statement must be preceded by a COPYor COPYMOD statement, or the INDD= portion of a COPY statement. This statement may not appear in the same COPY operation as an EXCLUDE statement This statement may not be used in a compress operation. A SELECT member is only replaced in the output data set if the REPLACE option ('R') is set on the SELECT statement or on the INDD portion of the COPY statement.

Cognizant Academy

Version <Ver #>

Page 12 of 31

IBM Utilities

IEBCOPY

SYNTAX: Format 1 - Copy selected members. {label} SELECT MEMBER=name Format 2 - Copy a list of members. {label} SELECT MEMBER=(name1,name2,name3...) Format 3 - Copy a list of members and rename them. {label} SELECT MEMBER=((name1,newname1), (name2,newname2),...) Format 4 - Copy a list of members and replace them {label} SELECT MEMBER=((name1,,R),(name2,,R),...) Examples: COPY1 C O=FILEOUT,I=FILEIN SELC1 S M=((IEBGENER,MYGENER,R),MYPROG, (YOURPROG,,R)) COPY2 SELC2 SELC3 SELC4 SELC4 COPY OUTDD=SYSUT2,INDD=((SYSUT1,R)) SELECT M=(MOD1,MOD2,WRET020) S M=MEMBER30 S M=MEMBER50 S MEMBER=((WORKMOD,,R))

EXCLUDE
This statement is used to name members to be excluded from a copy operation The EXCLUDE statement must be preceded by a COPY or COPYMOD statement, or the INDD= portion of a COPY statement An EXCLUDE statement may not appear in the same COPY operation as a SELECT statement This statement cannot be used in a compress operation. The format of the SELECT control statement is:

{label} EXCLUDE MEMBER=(name1,name2,name3,...)

Cognizant Academy

Version <Ver #>

Page 13 of 31

IBM Utilities

IEBCOPY

Examples COPY1 C O=FILEOUT,I=FILEIN EXCL1 E M=(SYNCSORT,SYNCGENR) COPY2 COPY OUTDD=F,I=Z99 EXCL2 EXCLUDE MEMBER=SNOOPY EXCL3 E MEMBER=(TRY1,TRY2,WALDO) EXCL4 EXCLUDE M=(P2,P9,DFHSIP) COPYMOD
This statement is used to copy load modules, repairing damaged RLD and text records in the process. COPYMOD will also reblock load modules. COPYMOD is identical in format to the COPY statement, except that the MAXBLK and MINBLK keywords are used to establish a maximum and minimum blocksize for the output load module data set

SYNTAX: The format of the COPYMOD control statement is: {label} COPYMOD OUTDD=ddname, INDD=(ddname1,ddname2,(ddname3,R),...) {,MAXBLK={nnnnnnnK}} {,MINBLK={nnnnnnnK}} {,LIST=NO} ALTERMOD
This statement is used to insert RLD counts into RLD entries for load modules that were linked by older versions of the linkage editor. Only PDS directory entries and RLD entries are changed by this function. ALTERMOD may be performed several times on the same PDS with no cumulative effect The format of the statement is

{label} ALTERMOD OUTDD=ddname {,LIST=NO}

Cognizant Academy

Version <Ver #>

Page 14 of 31

IBM Utilities

IEBCOPY

Example : 1 COPY AN ENTIRE DATA SET //COPY JOB ... //JOBSTEP EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=DATASET5,UNIT=disk, // VOL=SER=111113, DISP=SHR //SYSUT2 DD DSNAME=DATASET4,UNIT=disk, // VOL=SER=111112,DISP=(NEW,KEEP), // SPACE=(TRK,(5,1,2)) Example : 2 Merge Four Data Sets //COPY /JOBSTEP //SYSPRINT //IN1 //IN5 //IN6 //OUT2 //SYSUT3 //SYSIN COPYOPER INDD=IN1 INDD=IN6 INDD=IN5 /* Example : 3 JOB ... EXEC PGM=IEBCOPY DD SYSOUT=A DD DSN=DATASET1,DISP=SHR DD DSN=DATASET5,DISP=OLD DD DSN=DATASET6,DISP=(OLD,DELETE) DD DSN=DATASET2,,DISP=(OLD,KEEP) DD UNIT=SYSDA,SPACE=(TRK,(1)) DD * COPY OUTDD=OUT2

Copy and Replace Selected Members of a Data Set //COPY JOB ... //JOBSTEP EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=A //IN5 DD DSN=DATASET5,DISP=(OLD,KEEP) //IN6 DD DSN=DATASET6,DISP=OLD //OUT1 DD DSN=DATASET1,DISP=(OLD,KEEP) //SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(1)) //SYSUT4 DD UNIT=SYSDA,SPACE=(TRK,(1)) //SYSIN DD *

Cognizant Academy

Version <Ver #>

Page 15 of 31

IBM Utilities

IEBCOPY

COPYOPER COPY OUTDD=OUT1 INDD=IN5,IN6 SELECT MEMBER=((B,,R),A) /* Example : 4 JCL TO UNLOAD A DATA SET //SAVE //STEP1 //SYSPRINT /SYSUT1 //SYSUT2 // //SYSUT3 // // //SYSIN Example : 5 JCL TO COMPRESS A PDS //JS10 EXEC PGM=IEBCOPY,REGION=1M //SYSPRINT DD SYSOUT=* //I1 DD DSN=MY.PDS,DISP=OLD //O1 DD DSN=MY.PDS,DISP=OLD //SYSIN DD * COMP1 C O=O1,I=((I1,R)) /* Example : 6 LOADING A DATA SET //LOAD //STEPA //SYSPRINT //SYSUT1 // //SYSUT2 // // //SYSUT3 JOB ... EXEC PGM=IEBCOPY DD SYSOUT=A DD DSN=UNLOADSET,UNIT=tape,LABEL=(,SL), VOL=SER=TAPE01,DISP=OLD DD DSN=DATASET4,UNIT=disk, VOL=SER=2222222,=(NEW,KEEP), SPACE=(CYL,(10,5,10)) DD DSN=TEMP1,UNIT=disk,VOL=SER=111111, JOB ... EXEC PGM=IEBCOPY DD SYSOUT=A DD DSN=PARTPDS,DISP=OLD DD DSN=SAVDATA, DISP=(NEW,KEEP),LABEL=(,SL) DD DSN=TEMP1,UNIT=disk, VOL=SER=111111,=(NEW,DELETE), SPACE=(80,(60,45)) DD DUMMY

Cognizant Academy

Version <Ver #>

Page 16 of 31

IBM Utilities

IEBCOPY

// //SYSIN * Example : 7

DISP=(NEW,DELETE),SPACE=(80,(15,1)) DD DUMMY

UNLOAD SELECTED MEMBERS, LOAD, COPY AND MERGE //COPY JOB ... //STEP EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=A //PDS1 DD DSN=ACCOUNTA,UNIT=disk,VOL=SER=333333,DISP=OLD /PDS2 DD DSN=ACCOUNTB,UNIT=disk,VOL=SER=333333,DISP=OLD //SEQ1 DD DSN=SAVAC,UNIT=disk,VOL=SER=333333, // DISP=(NEW,KEEP),SPACE=(CYL,(5,2)) //SEQ2 DD DSN=SAVACB,UNIT=tape,VOL=SER=T01911, // DISP=(NEW,KEEP),LABEL=(,SL) /NEWUP DD DSN=NEWACC,UNIT=tape,VOL=SER=T01219, // DISP=OLD,LABEL=(,SL) //MERGE DD DSN=ACCUPDAT,UNIT=disk, // VOL=SER=222222,DISP=OLD //SYSUT3 DD DSN=TEMP1,VOL=SER=666666,UNIT=disk, // DISP=(NEW,DELETE),SPACE=(80,(1,1)) //SYSUT4 DD DSN=TEMP2,VOL=SER=666666,UNIT=disk, // DISP=(NEW,DELETE),SPACE=(256,(1,1)),DCB=(KEYLEN=8) //SYSIN DD * COPY OUTDD=SEQ1,INDD=PDS1 EXCLUDE MEMBER=(D,C) COPY OUTDD=SEQ2,INDD=PDS2 SELECT MEMBER=(A,K) COPY OUTDD=MERGE,INDD=((NEWUP,R),PDS1,PDS2) EXCLUDE MEMBER=A /* Example : 8 ALTER LOAD MODULES IN PLACE //ALTERONE JOB ... //STEPA EXEC PGM=IEBCOPY //SYSPRIN DD SYSOUT=A //SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(5,1)) //LIBJ DD DSN=MODLIBJ,DISP=(OLD,KEEP) //LIBK DD DSN=MODLIBK,DISP=(OLD,KEEP) //LIBL DD DSN=MODLIBL,DISP=(OLD,KEEP) //SYSIN DD *

Cognizant Academy

Version <Ver #>

Page 17 of 31

IBM Utilities

IEBCOPY

ALTERMOD SELECT ALTERMOD EXCLUDE /* Example : 9

OUTDD=LIBJ MEMBER=(MODX,MODY,MODZ) OUTDD=LIBL MEMBER=(MYMACRO,MYJCL)

REPLACE A LOAD MODULE USING COPYMOD //REPLACE JOB ... //STEP1 EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=A //TESTLB DD DSN=JOHNDOE.COBOL.TESTLOAD, // DISP=SHR,UNIT=3380,VOL=SER=TEST01, // DCB=(BLKSIZE=23470) //PRODLIB DD DSN=PAYROLL.MASTER.LOADLIB, // DISP=(OLD,KEEP)UNIT=3350,VOL=SER=PROD01, // DCB=(BLKSIZE=19069) //SYSIN DD * COPYMOD OUTDD=PRODLIB,INDD=TESTLIB SELECT MEMBER=((WAGETAX,,R)) /* Example : 10 CONVERT A PDS TO PDSE //CONVERT //STEP1 //SYSPRINT //SYSUT1 // //SYSUT2 // // // JOB ... EXEC PGM=IEBCOPY DD SYSOUT=A DD DSN=PDSSET,DISP=SHR, DSNTYPE=PDS DD DSN=PDSESET, LIKE=PDSSET, DISP=(NEW,CATLG) DSNTYPE=LIBRARY

Cognizant Academy

Version <Ver #>

Page 18 of 31

IBM Utilities

DFSORT

5. IEBUPDTE
What is IEBUPDTE? IEBUPDTE is used to create or modify sequential or Partitioned Data Sets IEBUPDTE can be used to change the organization of a data set from sequential to partitioned or vice versa IEBUPDTE can be used only with the data sets containing fixed length records of no more than 80 bytes. Inputs to IEBUPDTE IEBUPDTE uses two sources of input which are an input data set containing the source data to be modified input data set Input Data set can be either Sequential or PDS

a control data set containing the statements controlling IEBUPDTE's manipulation of the

Outputs of IEBUPDTE
IEBUPDTE creates two forms of output which are an output data set which is the result of the manipulations made to the input data set O/P Data Set can be seq or PDS It can be New (Created) or Old (Modified)

a print data set containing a log of the modifications, error messages and control

statements used in the job step

Sample JCL //JS10 EXEC PGM=IEBUPDTE, // REGION=1024K,PARM='NEW|MOD' //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=...,DISP=... //SYSUT2 DD DSN=...,DISP=... //SYSIN DD * control statements... /*

IBM Utilities

DFSORT

Control Statements
Function statement Data statements ALIAS statement ENDUP statement Modifying statements Control statements are continued by placing a non blank character in column 72, and continuing the statement beginning in column 16 on the next statement All IEBUPDTE control statements (except data statements) begin with a "./" in columns 1 and 2.

FUNCTION
The function statement is used to begin the IEBUPDTE operation At least one function statement is necessary for each member or data set being processed The function keywords should be preceded by and followed by at least one blank Valid functions are : ADD CHANGE REPL REPRO output dataset specifies that a new member or data set is to be created specifies that an existing member or data set is to be updated specifies that a member or data set is to be replaced in its entirety specifies that a member or data set is to be copied without modification to the

SYNTAX: ./{label} {ADD | CHANGE | REPL | REPRO} {LIST=ALL} {,SEQFLD=ddl } {,NEW=PO | PS} {,MEMBER=cccccccc} {,COLUMN=nn | 1} {,UPDATE=INPLACE} {,NAME=cccccccc} {,LEVEL=hh} {,SOURCE=x} {,SSI=hhhhhhhh}

IBM Utilities

DFSORT

DETAIL
The detail statement is used in conjunction with a function statement to provide additional information Valid detail keywords are: NUMBER DELETE data set specifies a new sequence numbering scheme specifies the logical records that are to be removed from the member or

SYNTAX: ./{label} {NUMBER | DELETE} {SEQ1=cccccccc | ALL} {,SEQ2=cccccccc} {,NEW1=cccccccc} {,INCR=cccccccc} {,INSERT=YES} DATA
The data statement is used to supply the logical records that are used as replacement statements or new data to be merged into the output data set When used with an ADD or REPL function, a data statement contains the new data to be placed in the output dataset When used with a CHANGE function, a data statement contains the new data or the data which replaces existing logical records in the input data set The data statement does not have a fixed syntax. Each logical record begins in column 1 and must contain sequence numbers The sequence numbers must be in the same relative position in the data statement as in the existing logical records The sequence numbers are assumed to be in columns 73 though 80 until otherwise specified in a SEQFLD parameter

ALIAS
The ALIAS statement is used to create or to retain existing alias in an output data set directory Up to 16 aliases can be assigned to a single member This format of the ALIAS statement is as follows: ./{name} ALIAS NAME=cccccccc where NAME=cccccccc specifies the name of an alias for this member

IBM Utilities

DFSORT

ENDUP
The ENDUP statement indicates the end of the utility control statements This format of the ENDUP statement is as follows:

./{label} ENDUP Example 1 Place two procedures in SYS1.PROCLIB //UPDATE JOB ... //STEP1 EXEC PGM=IEBUPDTE,PARM=MOD //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=SYS1.PROCLIB,DISP=OLD //SYSUT2 DD DSNAME=SYS1.PROCLIB,DISP=OLD //SYSIN DD DATA // ADD LIST=ALL,NAME=ERASE,LEVEL=01,SOURCE=0 ./ NUMBER NEW1=10,INCR=10 //* //ERASE EXEC PGM=IEBUPDTE //DD1 DD UNIT=disk,DISP=(OLD,KEEP),VOL=SER=111111 //SYSPRINT DD SYSOUT=A .// REPL LIST=ALL,NAME=LISTPROC ./ NUMBER NEW1=10,INCR=10 /* //LIST EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=SYS1.PROCLIB(&MEMBER),DISP=SHR //SYSUT2 DD SYSOUT=A,DCB=(RECFM=F,BLKSIZE=80) Example 2 CREATE A THREE MEMBER LIBRARY //UPDATE JOB ... /STEP1 EXEC PGM=IEBUPDTE,PARM=NEW //SYSPRINT DD SYSOUT=A //SYSUT2 DD DSN=OUTLIB,UNIT=disk, // DISP=(NEW,KEEP),VOL=SER=111112,SPACE=(TRK,(50,,10)), // DCB=(RECFM=F,LRECL=80,BLKSIZE=80) //SYSIN DD DATA ./ ADD NAME=MEMB1,LEVEL=00,SOURCE=0,LIST=ALL

IBM Utilities

DFSORT

(Data statements, sequence numbers in columns 73 through 80) Cont.... ./ ADD NAME=MEMB2,LEVEL=00,SOURCE=0,LIST=ALL (Data statements, sequence numbers in columns 73 through 80) ./ ADD NAME=MEMB3,LEVEL=00,SOURCE=0,LIST=ALL (Data statements, sequence numbers in columns 73 through 80) ./ ENDUP /* Example 3 Create new library using SYS1.MACLIB as a source //UPDATE JOB ... //STEP1 EXEC PGM=IEBUPDTE,PARM=MOD //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=SYS1.MACLIB, // DISP=SHR,UNIT=disk //SYSUT2 DD DSN=<New Mac Library>, // VOL=SER=111112,DISP=(NEW,KEEP), // SPACE=(TRK,(100,,10)),UNIT=DISK // DCB=(RECFM=F,LRECL=80,BLKSIZE=80) //SYSIN DD DATA // REPRO NAME=ATTACH,LEVEL=00,SOURCE=1,LIST=ALL ./ REPRO NAME=DETACH,LEVEL=00,SOURCE=1,LIST=ALL ./ ADD NAME=EXIT,LEVEL=00,SOURCE=0,LIST=ALL ./ NUMBER NEW1=10,INCR=100 (Data records for EXIT member) ./ ENDUP /* Example 4 Update a library member //UPDATE JOB ... //STEP1 EXEC PGM=IEBUPDTE,PARM=MOD //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=PDS,UNIT=disk, // DISP=(OLD,KEEP),VOLUME=SER=111112 //SYSIN DD * ./ CHANGE NAME=MODMEMB,LIST=ALL, X ./ UPDATE=INPLACE ./ NUMBER SEQ1=ALL,NEW1=10,INCR=5 (Data statement 1, sequence number 00000020) (Data statement 2, sequence number 00000035) /*

IBM Utilities

DFSORT

Example 5 Create new master data set and delete selected records //UPDATE JOB ... //STEP1 EXEC PGM=IEBUPDTE,PARM=MOD //SYSPRINT DD SYSOUT=A /SYSUT1 DD DSN=PARTDS,UNIT=disk,DISP=(OLD,KEEP), // VOLUME=SER=111112 /SYSUT2 DD DSN=SEQDS,UNIT=tape,LABEL=(2,SL), // DISP=(,KEEP),VOLUME=SER=001234, // DCB=(RECFM=FB,LRECL=80,BLKSIZE=2000) //SYSIN DD * ./ CHANGE NEW=PS,NAME=OLDMEMB1 (Data statement 1, sequence number 00000123) ./ DELETE SEQ1=223,SEQ2=246 (Data statement 2, sequence number 00000224) /* Example 6 Create and update a member library //UPDATE JOB ... //STEP1 EXEC PGM=IEBUPDTE,PARM=MOD //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=OLDSEQDS,UNIT=tape, // DISP=(OLD,KEEP),VOLUME=SER=001234 //SYSUT2 DD DSN=NEWPART,UNIT=disk, // DISP=(,KEEP),VOLUME=SER=111112, // SPACE=(TRK,(10,5,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=80) //SYSIN DD * // CHANGE NEW=PO,MEMBER=PARMEM1,LEVEL=01, X ./ SEQFLD=605,COLUMN=40,SOURCE=0 (Data statement 1, sequence number 00020) ./ DELETE SEQ1=220,SEQ2=250 (Data statement 2, sequence number 00230) (Data statement 3, sequence number 00260) ./ ALIAS NAME=MEMB1 /*

IBM Utilities

DFSORT

Example 7 Re-number and insert records into a library MEMBER //UPDATE JOB //STEP1 EXEC PGM=IEBUPDTE,PARM=MOD //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=PDS,UNIT=disk,DISP=(OLD,KEEP), // VOLUME=SER=111112 //SYSUT2 DD DSN=PDS,UNIT=disk,DISP=(OLD,KEEP), // VOLUME=SER=111112 //SYSIN DD * ./ CHANGE NAME=RENUM,LIST=ALL,LEVL=01, X ./ SOURCE=0,SEQFLD=765 ./ NUMBER SEQ1=AA015,NEW1=AA020,INCR=5,INSERT=YES (Data statement 1) (Data statement 2) (Data statement 3) ./ NUMBER SEQ1=AA030,INSERT=YES (Data statement 4) (Data statement 5) (Data statement 6) (Data statement 7, sequence number AA035) /* Example 8 CREATE A NEW GENERATION DATA SET //NEWGDS JOB ... //STEP1 EXEC PGM=IEBUPDTE,PARM=MOD //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=A.B.C(0),DISP=OLD //SYSUT2 DD DSN=A.B.C(+1),DISP=(,CATLG), // UNIT=disk,VOLUME=SER=111111, // SPACE=(TRK,(100,10,10)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) //SYSIN DD DATA // REPRO NAME=MEM1,LEVEL=00,SOURCE=0,LIST=ALL ./ REPRO NAME=MEM2,LEVEL=00,SOURCE=0,LIST=ALL ./ REPRO NAME=MEM3,LEVEL=00,SOURCE=0,LIST=ALL ./ ADD NAME=MEM4,LEVEL=00,SOURCE=0,LIST=ALL ./ NUMBER NEW1=10,INCR=5 (Data records comprising MEM4) ./ ENDUP /*

IBM Utilities

DFSORT

6. DFSORT
What does DFSORT do? Sorts records in ascending or descending order within a dataset Merge two or more files to form a single file Select a subset of records from an input file Sum values in records Reformat records

SAMPLE JCL //JOB CARD //STEPNAME EXEC PGM=SORT //STEPLIB DD - defines the library containing the DFSORT program. If it is in system library, this statement can be omitted //SYSOUT DD -output data set for messages //SORTIN DD -INPUT DATA SET //SORTWKNN DD -defines a work storage dataset for most applications one data set is sufficient //SOROUT DD -defines the output data set //SYSIN DD Sort control statements /*
Writing a SORT statement Leave at least one blank, and write SORT Leave at least one blank, and write FIELD = Write , in parentheses, separated by commas The starting position of the key field Length, in bytes of the key field

A code for data format SORT FIELD = (110,5,CH,A) letter A for Ascending / D for Descending Order

Make sure that the statement is coded between columns 2 and 71

IBM Utilities

DFSORT

DATA FORMATS
EBCDIC Character ASCII Character BINARY ZONED DECIMAL PACKED DECIMAL ALTERNATE SEQ CH AC BI ZD PD AQ

Sorting By Multiple Fields


SORT FIELDS = (110,5,CH,A,115,5,A,1,75,CH,A) This is equivalent to SORT FIELDS = (110,10,CH,A,1,75,CH,A) First two fields being contiguous have been concatenated When all the control fields are of the same data format, just data format can be specified just once using FORMAT= parameter e.g. SORT FIELDS = (110,10,A,1,75,A),FORMAT=CH

Tailoring the Input File


INPUT File can be tailored by either: Specifying an INCLUDE control statement, for the records to be included (or) Specifying an OMIT control statement, for the records to be omitted Both INCLUDE and OMIT cannot be used together Inclusion and Omission can be done by comparing the contents of a record field with either Another Field (or) A Constant(Character string / Decimal Number / Hexadecimal String) Two or more conditions can be combined by Logical AND & OR

Rules for Padding/Truncation


In a field-to-field comparison the shorter field is padded as appropriate (with blanks or zeros) In a field-to-constant comparison the constant is padded or truncated to the length of the field

IBM Utilities Decimal Constants are padded or truncated on the left character and hexadecimal constants are padded or truncated on the right

DFSORT

IBM Utilities

DFSORT

INCLUDE & OMIT statement


To write an INCLUDE or OMIT statement Leave at least one blank and write INCLUDE or OMIT Leave at least one blank and write COND= Write in parentheses, and separated by commas The location, length and data format of the field to be compared Comparison Operator (EQ, NE, GT, GE, LT, LE) The location,length and date format of the field compared against (or) a constant

Reformatting Records
After Records are sorted they can be reformatted by using OUTREC or INREC statement Fields can be deleted Order of the fields can be rearranged Zeros or Blanks can be inserted before, between or after fields

If record length gets changed in the process of using OUTREC statement the new record length has to be specified on the SORTOUT DD statement IF Reformatting uses INREC changes the location of the key fields the new location has to be specified in SORT statement.

INREC & OUTREC statement


Leave at least one blank and write OUTREC or INREC Leave at least one blank and write FIELDS = Write in paranthesis, and separated by commas: The input location and length of the fields to appear in the desired Reformatting is performed before SORT/MERGE in the case of order (Data format is not specified) INREC & it is performed after SORT/MERGE in the case of OUTREC

IBM Utilities

DFSORT

MERGE FILES
Files to be merged should be sorted on the same set of keys on which they are being merged Do not use SORTWKnn DD statement Instead of SORTIN DD use SORTINnn DD .One SORTINnn DD statement for each input file . nn stands for 01 to 16. In Utility Control Statement MERGE replaces SORT

Processing Order of Control Statements


INCLUDE/OMIT INREC STATEMENT SORT/MERGE OUTREC STATEMENT

IBM Utilities

References

7. References
Books for reference 1. The MVS JCL Primer 2. MVS JCL 2nd edition 3. Expert MVS/SA S. Zamir Doug Lowe Mani Caranthassis and C. Ranade.

4. VSE/ ESA JCL : Utilities - H. Frank, Graubart 5. MVS control Blocks Hank Murphy

6. Expert MVS/ESA JCL guide to advanced technique 7. MVS JCL -

Mani Caranthassis Doug Lowe