Sample Sort/Merge Exit Routines

The IBM® DFSORT Program Product can, during various phases of processing, pass control to routines designed and written to perform specific functions. SYS1.SAMPLIB has two sample routines that receive control from exits E15 and E35 of this sort/merge program. The sample E15 exit routine, called SMFE15, extracts all SMF records without a job log identification (job name, time, and date that the reader recognized the JOB card) from the SMF dump data set. The SMFE15 exit routine retains the dump header and dump trailer records (types 2 and 3) in the temporary data set HDRDATA. It retains all other system-oriented records (records without a job log identification) in the temporary data set SORDATA.

The sample E35 exit routine, called SMFE35, places all the records extracted by the SMFE15 routine in the sort output data set. These records are inserted in the data set as follows: dump header records, dump trailer records, all other system-oriented records, and the sorted job-oriented records.

Note: If tape work devices are used, the minimum block length the IBM Sort/Merge Program Product can sort is 18 bytes. Otherwise, the minimum is one byte. The sample routines SMFE15 and SMFE35 use SMF record types 0 through 13 for input; the minimum length of these SMF records is 18 bytes.
Figure 1 shows sample JCL for obtaining a listing of the SMFE15 and SMFE35 exit routines from SYS1.SAMPLIB. Figure 1 also shows sample JCL for obtaining a listing of the SYS1.SAMPLIB member named SMFSORT. SMFSORT contains sample JCL for running the IBM DFSORT Program Product.
Figure 1. Sample JCL for Obtaining a Listing of Sample Sort Exit Routines
//PRINT     JOB     123456,SMITH
//          EXEC    PGM=IEBPTPCH
//SYSPRINT  DD      SYSOUT=A
//SYSUT1    DD      DSNAME=SYS1.SAMPLIB,DISP=(OLD,KEEP),
//                  UNIT=xxxx,VOLUME=SER=xxxxxx1
//SYSUT2    DD      SYSOUT=A
//SYSIN     DD      *
            PRINT   TYPORG=PO,MAXNAME=4,MAXFLDS=4
            MEMBER  NAME=SMFSORT
            RECORD  FIELD=(80)
            MEMBER  NAME=SMFE15
            RECORD  FIELD=(80)
            MEMBER  NAME=SMFE35
            RECORD  FIELD=(80)
/*

1
The volume and unit parameters depend on your installation's request.

To include the sample exit routines in your sort application, you must first assemble and link-edit them before running the sort/merge program. Figure 2 shows sample JCL for this procedure, including one possible sort application. In this example, SMF records are to be sorted first on the job log identification (major control field), and then on the time and date portions of the time stamp (minor control fields). Displacements of these fields (shown in the record formats in SMF records) are 14, 6, and 2. However, you must add four bytes for the record descriptor word (RDW) and one byte for the sort procedures (initial count of 1) to these displacements. Hence, displacements 19, 11, and 7 are shown in the SORT FIELDS=statement in Figure 2.
Figure 2. Sample JCL for Running a Sort Procedure
//SMFSORT          JOB     MSGLEVEL=1
//STEP1            EXEC    ASMFCL1
//ASM,SYSIN        DD      *
  (E15 Source Deck)
/*
//LKED.SYSLMOD     DD      DSNAME=SMF1.EXITS,UNIT=SYSDA,2
//                         DISP=(NEW,KEEP),SPACE=(TRK,(10,5,1)),
//                         VOL=SER=xxxxxx
//LKED.SYSIN       DD      *
                   NAME    E15(R)3
/*
//STEP2            EXEC    ASMFCL1
//ASM,SYSIN        DD      *
  (E35 Source Deck)
/*
//LKED.SYSLMOD     DD      DSNAME=SMF1.EXITS,DISP=(OLD,KEEP),2
//                         UNIT=SYSDA,VOL=SER=xxxxxx
//LKED.SYSIN       DD      *
                   NAME    E35(R)3
/*
//SORTSTEP         EXEC    PGM=SORT,REGION=100K4
//SYSOUT           DD      SYSOUT=A
//SORTLIB          DD      DSNAME=SYS1,SORTLIB,DISP=SHR
//EXITLIB          DD      DSNAME=SMF1,EXITS,DISP=(OLD,KEEP),5
//                         UNIT=SYSDA,VOL=SER=xxxxxx
//SORTIN           DD      UNIT=3480,VOL=SER=SYSMAN,DISP=OLD,6
//                 LABEL=(,SL),DCB=(RECFM=VBS,LRECL=600,BLKSIZE=200)7
//SORTWK01         DD      UNIT=SYSDA,SPACE=(CYL,(50),,CONTIG)8
//SORTWK02         DD      UNIT=SYSDA,SPACE=(CYL,(50),,CONTIG)8
//SORTWK03         DD      UNIT=SYSDA,SPACE=(CYL,(50),,CONTIG)8
//SORTOUT          DD      UNIT=3480,DSNAME=SMF1,SORTOUT,LABEL=(,SL),9
//                 DISP=(KEEP),DCB=(RECFM=VBS,LRECL=600,BLKSIZE=200)7
//SORDATA          DD      UNIT=SYSDA,SPACE=(CYL,(1,1)),10
//                         DCB=(RECFM=VBS,LRECL=600,BLKSIZE=200)7
//HDRDATA          DD      UNIT=SYSDA,SPACE=(TRK,(5,5)),10
//                         DCB=(RECFM=VBS,LRECL=600,BLKSIZE=200)7
//SYSIN            DD      *
  SORT                     FIELDS=(19,16,A,11,4,A,7,4,A),FORMAT=BI,SIZE=E400011
  MODS                     E15=(E15,700,EXITLIB,N),E35=(E35,1500,EXITLIB,N)11
  END
/*
Notes:
1
EXEC statement for catalogued procedure ASMFCL (assemble and link-edit). (For a description of the ASMFCL procedure, see IBM High Level Assembler/MVS & VM & VSE Programmer's Guide.)
2
The sample sort exit routines will be link-edited into data set SMF1.EXITS.
3
Link-edit control statements specifying that E15 and E35 will be the load module names of the exit routines.
4
EXEC statement for the sort/merge program.
5
Data set SMF1.EXITS is specified as the library in which sort exit routines can be found.
6
Input to the sort program is the SMF dump data set, contained on a tape having a volume serial number of SYSMAN.
7
The LRECL value can be larger than the BLKSIZE value because records might be segmented. The LRECL value must be as large as the longest SMF record being created plus four bytes for the RDW. Modify these parameters according to the longest record to be collected.
8
Three sort work units are defined as being direct access devices.
9
The sort output data set is to be written on tape.
10
Two data sets required by the sample sort exit routines are defined on direct access devices.
11
The sort/merge control statements define the sort control fields and exit routines to be used in this sort application.