Problem
Statement
//*********************************************************************
//* I have two files.
//* FILEA contains only timestamp X(26).
//* FILEB contains Office X(3), Account X(6), timestamp X(26) and Identity number X(3)
//* I want all records of FILEB for timestamp values not present in FILEA
//* FILEA contains only timestamp X(26).
//* FILEB contains Office X(3), Account X(6), timestamp X(26) and Identity number X(3)
//* I want all records of FILEB for timestamp values not present in FILEA
//*********************************************************************
SORT JCL Used:
Step 1: Sorted FILEB with timestamp as first field.
//SORT01
EXEC PGM=SORT
//SORTIN
DD DSN= REC.FILE, ---FILE B(WITH
LAYOUT GIVEN)
//
DISP=SHR
//SORTOUT
DD DSN=OUTOUT.FILE,
//
DISP=(OLD,CATLG,DELETE),
//
SPACE=(CYL,(10,50),RLSE),VOL=(,,,40),
//
DCB=(RECFM=FB,BLKSIZE=0,LRECL=80)
//SYSOUT
DD SYSOUT=*
//SYSPRINT DD
SYSOUT=*
//SORTLIST DD
SYSOUT=*
//SYSIN
DD *
INREC
FIELDS=(10,26,1,9,36,3)
SORT
FIELDS=(1,26,CH,A)
/*
Step 2
Remove/Discard duplicates on from the sorted file and the FILE A which is
sorted on timestamp.
//SORT02 EXEC PGM=ICETOOL
//INPUT
DD DSN=OUTOUT.FILE,DISP=OLD
//
DD DSN=TMSTMP.FILE,DISP=OLD
--FILE A(TIMESTAMPS)
//OUTPUT
DD DSN=FILE.DISCARD,
//
DISP=(OLD,CATLG,DELETE),
//
SPACE=(TRK,(1,5),RLSE),
//
DCB=(RECFM=FB,BLKSIZE=0,LRECL=80)
//FINAL1
DD DSN=FINAL.FILE,
//
DISP=(OLD,CATLG,DELETE),
//
SPACE=(TRK,(1,5),RLSE),
//
DCB=(RECFM=FB,BLKSIZE=0,LRECL=80)
//TOOLMSG
DD SYSOUT=*
//DFSMSG
DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(INPUT)
TO(OUTPUT) ON(1,26,CH) ALLDUPS DISCARD(FINAL1)
/*
Step 3
Sorted as per layout in FILE B.
//SORT03
EXEC PGM=SORT
//SORTIN
DD DSN=FINAL.FILE,
//
DISP=SHR
//SORTOUT
DD DSN=FINAL1.FILE,
//
DISP=(OLD,CATLG,DELETE),
//
SPACE=(CYL,(10,50),RLSE),VOL=(,,,40),
//
DCB=(RECFM=FB,BLKSIZE=0,LRECL=80)
//SYSOUT
DD SYSOUT=*
//SYSPRINT DD
SYSOUT=*
//SORTLIST DD
SYSOUT=*
//SYSIN
DD *
INREC
FIELDS=(27,9,1,26,36,3)
SORT
FIELDS=(1,26,CH,A)