Hi,
I have a file which can have numbers as a record
Numbers can be from 1 to 9999999 in sorted order.
I want to write output file with numbers which are not present in the input file.
Sample input file:
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
You could create a file which has a record for all the possible numbers and concatenate to your 'real' file as input to DFSORT. DFSORT job would use SUM FIELDS=(NONE) to drop duplicates. That way you get the unmatched records in your output.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
sambhaji,
You don't have to generate the seqnum every time you run the job. Create it once and you can always concatenate it to your input. Here is the job will which will give you the desired results
Code:
//*************************************************************
//* RUN THIS STEP ONLY ONCE WHICH WILL GENERATE THE BATCH *
//* NUMBERS FROM 1 THRU 9999999. *
//*************************************************************
//RUN1TIME EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DUMMY RECORD
//SORTOUT DD DSN=your constant num file,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(60,20),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REPEAT=9999999,BUILD=(SEQNUM,4,PD)
//*
This should be the only step in your regular job stream
Code:
//*************************************************************
//* CONCATENATE THE FULL NUMBER FILE CREATED IN RUN1TIME *
//* (RUN THAT STEP ONLY ONCE) AND YOUR INPUT FILE. *
//* ANY MATCHING NUMBER IN YOUR INPUT WILL BE A DUPLICATE *
//* SO USING A SELECT OPERATOR WE PICK THE NODUPS WHICH ARE *
//* THE MISSING NUMBERS. *
//*************************************************************
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=your constant num file,DISP=SHR
// DD DSN=your input,DISP=SHR
//OUT DD DSN=your missing num file,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(60,20),RLSE)
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,4,PD) NODUPS USING(CTL1)
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,4,PD,M11,LENGTH=7)
/*