Compare 2 files and write O/P accordingly
Posted:
Mon Aug 31, 2009 11:07 pm
by gracemanoj
I have a requirement in which I have to compare today's and previous day's file.
The file LRECL is 479
If the record is new in today's file then I need to write to a output file of the same LRECL with a CODE 'A' in the 470th position. If a record in previous day's file is not present then I need to write to the same output file with the CODE 'D' in the 470th position. Also if the record in previous day's file of the same key doesn't match with the record in today's file then the output file should be written with the Code 'C' in 470th position.
There will be no duplicates in the file. Also the keys will be the first 38 bytes
Please let me know if we can write an ICETOOL for this
Thanks in advance
Re: Compare 2 files and write O/P accordingly
Posted:
Tue Sep 01, 2009 1:38 am
by skolusu
The following DFSORT/ICETOOL JCL will give you the desired results
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DUMMY,DCB=(LRECL=479,RECFM=FB,BLKSIZE=27782)
//SORTOUT DD DSN=&&H,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,HEADER1=(C'HDR',479:X)
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=your PREV day FB 479 Lrecl file,DISP=SHR
// DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=your CURR day FB 479 Lrecl file,DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,38,CH) WITH(1,479) WITH(481,1) -
KEEPNODUPS USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(480:ID=2)),
IFTHEN=(WHEN=(480,2,ZD,EQ,1),OVERLAY=(480:C'11',39,441)),
IFTHEN=(WHEN=(480,2,ZD,EQ,2),OVERLAY=(480:C'22'))
OUTFIL FNAMES=OUT,IFOUTLEN=479,OMIT=(480,2,ZD,EQ,12,AND,
(39,256,CH,EQ,482,256,CH,AND,296,184,CH,EQ,739,184,CH)),
IFTHEN=(WHEN=(480,2,ZD,EQ,11),OVERLAY=(470:C'D')),
IFTHEN=(WHEN=(480,2,ZD,EQ,12),OVERLAY=(470:C'C')),
IFTHEN=(WHEN=(480,2,ZD,EQ,22),OVERLAY=(470:C'A'))
/*
Re: Compare 2 files and write O/P accordingly
Posted:
Tue Sep 01, 2009 10:49 am
by gracemanoj
Thanks. I'll try the code.
Is there a way to display in the sysout the number of records added, deleted and changed ?
Re: Compare 2 files and write O/P accordingly
Posted:
Thu Sep 03, 2009 3:17 pm
by gracemanoj
Getting a syntax error. Below is the DFSMSG
CTL1CNTL :
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(480:ID=2)),
*
IFTHEN=(WHEN=(480,2,ZD,EQ,1),OVERLAY=(480:C'11',39,441)),
IFTHEN=(WHEN=(480,2,ZD,EQ,2),OVERLAY=(480:C'22'))
OUTFIL FNAMES=OUT,IFOUTLEN=479,OMIT=(480,2,ZD,EQ,12,AND,
(39,256,CH,EQ,482,256,CH,AND,296,184,CH,EQ,739,184,CH)),
IFTHEN=(WHEN=(480,2,ZD,EQ,11),OVERLAY=(470:C'D')),
IFTHEN=(WHEN=(480,2,ZD,EQ,12),OVERLAY=(470:C'C')),
IFTHEN=(WHEN=(480,2,ZD,EQ,22),OVERLAY=(470:C'A'))
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
Re: Compare 2 files and write O/P accordingly
Posted:
Thu Sep 03, 2009 9:17 pm
by Frank Yaeger
The job runs fine with DFSORT. However, the WER messages indicate you're using Syncsort, not DFSORT. Kolusu and I are DFSORT developers. DFSORT and Syncsort are competitive products. We're happy to answer questions on DFSORT and DFSORT's ICETOOL, but we
don't answer questions on Syncsort.