View previous topic :: View next topic
Author
Message
Uday Kumar R New User Joined: 07 Nov 2007Posts: 27 Location: Mumbai
Hi,
I have file with LRECL=25 (files is of big size aroung 40Million lines). out of these 25 coloumns first 5 digits give a number. the next 10 coloumns represent the date. rest is about some other information. Is it possible to verify the date present in the file is correct or not? for example..
File:
1111104/28/2009xxxxxxxx
1111102/30/2009xxxxxxxx
2222209/20/2009xxxxxxxx
2222208/20/2009xxxxxxxx
2222210/21/2009xxxxxxxx
now what i am looing is i need to check if the date parameter from 15-25th position is wrong (like 2nd entry) then i need move all entries into a new file whose value at 1-5 position are equall.
So my output would be:
File1:
1111104/28/2009xxxxxxxx
1111102/30/2009xxxxxxxx
File2:
2222209/20/2009xxxxxxxx
2222208/20/2009xxxxxxxx
2222210/21/2009xxxxxxxx
Any idea is it possible to perfrom this task thru Fileaid or sort utilities?
Thank you for any suggestion on this.
Thanks
Uday
Back to top
Escapa Senior Member Joined: 16 Feb 2007Posts: 1399 Location: IL, USA
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10872 Location: italy
the second link refers to a db2 environment
The TS asked about a ICETOOL/DFSORT solution
the link posted satisfies only partially the requirement...
if I understand correctly
the TS wants to <discard> all the records with the same key if any one of them has a wrong date
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Uday kumar,
The following DFSORT JCL will give you the desired results
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input fb 25 byte file,DISP=SHR
//VALID DD SYSOUT=*
//INVALID DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(26:6,10,UFF,EDIT=(TTTTTTTT))),
IFTHEN=(WHEN=INIT,OVERLAY=(35:30,4,ZD,MOD,+4,EDIT=(T),
36:30,4,ZD,MOD,+100,EDIT=(TTT),
39:30,4,ZD,MOD,+400,EDIT=(TTT),
43:C'V')),
IFTHEN=(WHEN=(39,3,ZD,EQ,0,OR,(35,1,ZD,EQ,0,AND,36,3,ZD,GT,0)),
OVERLAY=(42:C'L'),HIT=NEXT),
IFTHEN=(WHEN=(26,2,ZD,EQ,0,OR,28,2,ZD,EQ,0,OR,30,04,ZD,EQ,0),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,2,ZD,GT,12),OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,01,AND,28,02,ZD,GT,31),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(42,1,CH,EQ,C' ',AND,26,02,ZD,EQ,02,AND,
028,02,ZD,GT,28),OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(42,1,CH,EQ,C'L',AND,26,02,ZD,EQ,02,AND,
028,02,ZD,GT,29),OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,03,AND,28,02,ZD,GT,31),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,04,AND,28,02,ZD,GT,30),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,05,AND,28,02,ZD,GT,31),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,06,AND,28,02,ZD,GT,30),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,07,AND,28,02,ZD,GT,31),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,08,AND,28,02,ZD,GT,31),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,09,AND,28,02,ZD,GT,30),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,10,AND,28,02,ZD,GT,31),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,11,AND,28,02,ZD,GT,30),
OVERLAY=(43:C'I'),HIT=NEXT),
IFTHEN=(WHEN=(26,02,ZD,EQ,12,AND,28,02,ZD,GT,31),
OVERLAY=(43:C'I'),HIT=NEXT)
SORT FIELDS=(1,5,CH,A,43,1,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(45:SEQNUM,8,ZD,RESTART=(1,5))),
IFTHEN=(WHEN=GROUP,BEGIN=(45,8,ZD,EQ,1),PUSH=(44:43,1))
OUTFIL FNAMES=INVALID,INCLUDE=(43,2,SS,EQ,C'I'),BUILD=(1,25)
OUTFIL FNAMES=VALID,SAVE,BUILD=(1,25)
/*
Back to top
Uday Kumar R New User Joined: 07 Nov 2007Posts: 27 Location: Mumbai
Hi all,
Thanks for all your valuable suggestion and explanations for my request and your time.
Thanks,
Uday
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707, you can use the new date conversion functions to validate a date like shown below to get the desired results
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input fb 25 byte file,DISP=SHR
//VALID DD SYSOUT=*
//INVALID DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(26:6,10,UFF,EDIT=(TTTTTTTT))),
IFTHEN=(WHEN=INIT,OVERLAY=(34:26,8,Y4W,TOJUL=Y4W))
SORT FIELDS=(1,5,CH,A,34,1,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(41:SEQNUM,8,ZD,RESTART=(1,5))),
IFTHEN=(WHEN=GROUP,BEGIN=(41,8,ZD,EQ,1),PUSH=(34:34,1))
OUTFIL FNAMES=INVALID,INCLUDE=(34,1,CH,EQ,C'*'),BUILD=(1,25)
OUTFIL FNAMES=VALID,SAVE,BUILD=(1,25)
//*
For complete details on date conversion functions and the other new functions available with the Nov, 2009 DFSORT PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
Back to top
Please enable JavaScript!