Page 1 of 1

Comparing files and writing O/P accordingly

PostPosted: Thu Sep 03, 2009 6:31 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 in the current file, then I need to check the purge file which is of the same LRECL and write to the same output file with the CODE 'D' in the 470th position only if the record is not present in the history file. 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

Also I want to display in the sysout the number of records added, deleted and changed. I posted this in the DFSORT forum but the suggestion given by them using ICETOOL uses WHEN=GROUP which is not supported by SYNCSORT.

Can you please let me know if this is possible in SYNCSORT? Your help is greatly appreciated

Re: Comparing files and writing O/P accordingly

PostPosted: Fri Sep 04, 2009 12:56 am
by dick scherrer
Hello,

uses WHEN=GROUP which is not supported by SYNCSORT
WHEN=GROUP is supported by Syncsort. . .

More importantly, which sort product is in use on your system? If you post the informational messages generated by any sort execution, we can determine which product is in use.

Re: Comparing files and writing O/P accordingly

PostPosted: Fri Sep 04, 2009 10:00 am
by gracemanoj
I read in some previous message that sync sort will not support WHEN=GROUP. Below is the message which I get

SYNCSORT FOR Z/OS 1.3.0.2RI U.S. PATENTS: 4210961, 5117495 (C) 2007 SYNCS

SYNCSORT LICENSED FOR <X> LICE
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: Comparing files and writing O/P accordingly

PostPosted: Fri Sep 04, 2009 11:32 pm
by dick scherrer
Hello,

Your release of Syncsort (1.3.0) is not at the level that supports when=group. This was included in 1.3.2 if i remember correctly.

Possibly, your system support people can upgrade to the proper level.

Re: Comparing files and writing O/P accordingly

PostPosted: Sun Sep 06, 2009 10:23 pm
by gracemanoj
Is there a way to write a sync sort for the same requirement?

Re: Comparing files and writing O/P accordingly

PostPosted: Tue Sep 08, 2009 1:51 am
by dick scherrer
Hello,

Yes - upgrade the software so it is current. . .

If your organization is unwilling to upgrade, some other alternative will be needed - possibly even writing code. . .

Re: Comparing files and writing O/P accordingly

PostPosted: Tue Sep 15, 2009 12:33 am
by arcvns
Hi Dick,

I think a SyncSort JOIN would be sufficient for the above problem. I am away from office now. Will try to post a solution tomorrow.

Re: Comparing files and writing O/P accordingly

PostPosted: Tue Sep 15, 2009 1:15 am
by dick scherrer
Hi Arun,

Thank you :)

d

Re: Comparing files and writing O/P accordingly

PostPosted: Fri Sep 18, 2009 8:33 pm
by arcvns
gracemanoj,

This is untested. May be you can give this a try.

//STEP0200 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTOUT  DD SYSOUT=*                                               
//SORTJNF1 DD DSN= Previous day's file (FB/479)
//SORTJNF2 DD DSN= Current day's file  (FB/479)
//SYSIN    DD *                                             
  JOINKEYS FILE=F1,FIELDS=(1,38,A)
  JOINKEYS FILE=F2,FIELDS=(1,38,A)
  JOIN UNPAIRED
  REFORMAT FIELDS=(F1:1,479,F2:1,479)                         
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C' '),BUILD=(480,469,C'A',950,9)),
        IFTHEN=(WHEN=(480,1,CH,EQ,C' '),BUILD=(1,469,C'D',471,9)),
        IFTHEN=(WHEN=(39,256,CH,NE,518,256,CH,OR,
                     295,185,CH,NE,774,185,CH),
                BUILD=(1,469,C'C',471,9))           
  SORT FIELDS=COPY