Search

Showing posts with label ICETOOL. Show all posts
Showing posts with label ICETOOL. Show all posts

Sunday, March 24, 2013

SYNCSORT or DFSORT - PART 3


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
//*********************************************************************

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)
/*
 ICETOOL is used here to sort on timestamp and remove dupicate timestamp records.

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)
/*
Sorted again in original file form.

Please refer PART1 and PART2 here.

Sunday, October 28, 2012

ICETOOL Example - Matching and non matching records

Create files with matching and non-matching records

There are two input files containing lists of records, as follows:

Input File1

V
F
C
H
D

Input File2

K
H
C
V
M

How can we create output files for the following?

  • The records that appear in both File1 and File2
  • The records that appear only in File1
  • The records that appear only in File2

Below is an ICETOOL job that can do this match by using the SPLICE operator. SPLICE operator in ICETOOL helps to perform various file join and match operations.