Posted: Fri Feb 20, 2009 12:33 pm Post subject: DFSORT Help - Get the latest record
Hi,
Please help me to resolve the following requirement using DFSORT.
I have a file which is having duplicates and need to remove this duplicates based on some conditions.
The COBOL layout is given below (taken from File aid)
The date field (NR-YYDDD) is in YYDDD foramt. I have to remove the duplicates based on the above fields and get the record which is having the latest date (NR-YYDDD). I mean the output file will have the latest record.
The file is FB and LRECL=338. Please help
Please note that we don't have the latest PTF available. A snap shot of the current function level of DFSORT is given below:
Code:
1ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 03:02 ON WED NOV 12, 2008 -
0 OPTION COPY 00001450
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E9-K90007 C9-BASE E5-K24705 E7-K24705
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED
ICE088I 0 QSDK7G92.STEP0100. , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6278238)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6200798,6200798)
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,RESET=Y,VSAMEMT=Y,DYNSPC=256
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERET=ABEND,MSGDDN=SYSOUT
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=FULL ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=N,DYNALOC=N ,ABCODE=MSG
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=N,STIMER=Y,COBEXIT=COB2
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=N,DSA=0
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITCK=S,PARMDDN=DFSPARM ,FSZEST=N
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMIO=N,MOSIZE=0
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN
ICE751I 1 EF-K10929 F0-Q84357 E8-K24705
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 1, OUT: 1
ICE052I 0 END OF DFSORT
Hi Kolusu,
Thanks a lot for the solution. Sorry to bother you again. Actually the file is VB and the LRECL=299. I added an offset of 4 to the control card but it's giving a return code of 16 in the
Code:
SELECT FROM(IN) TO(OUT) ON(5,20,BI) LAST USING(CTL1)
statement. Please note that I changed the CTL1 also to reflect the changes:
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Sat Feb 21, 2009 11:00 am Post subject:
The return code 16 would be accompanied by an error message in //DFSMSG. So you need to show the messages you received in //DFSMSG before we can help. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Hi Frank,
I could not get the entire DFSMSG (don't have access to the mainframe now, but kept the screen shot for the reference). I do not know whether this incomplete DFSMSG will give any input of the error message
Code:
SORT FIELDS=(05,3,PD,A,
08,2,PD,A,
10,4,PD,A,
14,5,PD,A,
19,6,PD,A,
25,3,Y2U,A)
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,
RTOUT=OUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,N
HECK
SORT FIELDS=(5,20,BI,A)
MODS E35=(ICE35DU,12288)
ICE201I F RECORD TYPE IS V - DATA STARTS IN POSITION 5
ICE168I 0 CENTURY WINDOW FOR Y2 FORMAT FIELDS IS FROM 1929 TO 2028
ICE751I 0 C5-K90014 C6- K90014 C7-BASE C8- K90014 E4-BASE C9-BASE E5-K38900
Hi Kolusu/Frank,
I totally forgot about one thing (my bad memory). When we remove the duplicates I need to update the Trailer record accordingly. The trailer is defined as follows (Fileaid view)
is taken from the existing file (NAO-MAST-TRAILER-TRANSIT will be always 99999- So it will be the last record in our output)
But the other two fields are
NAO-MAST-TRAILER-REC-CNT - This is total number of records including the trailer.
NAO-MAST-TRAILER-AMT - Sum of NR-AMT of the detail records
Is it possible to change the trailer as well? Please advise. _________________ Regds,
Somu
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Feb 23, 2009 12:06 pm Post subject:
somuk,
I assumed that you don't have any other info on the trailer record apart from the fields you mentioned. You mentioned that NAO-MAST-TRAILER-TRANSIT will be always 99999- . I assuming that it is negative 99999. If it is a positive value then just the change the '99999Dd' on trailer to '99999C'. Use the following control cards.
Thanks Kolusu.
My apologies, I think I was not clear in my earlier post. The input file is already having a trailer. I just need to update the total count of records and total amount to reflect our SORT criteria. I mean we dropped some records using the SORT so accordingly the existing trailer has to be updated to reflect the new total record count and new total amount
Sample Input Trailer:
Code:
99999 23 1000.00
Where 23: total count
1000.00: total amount
Sample Output Trailer:
Code:
99999 20 800.00
I want to preserve the first 7 bytes in the original input trailer as it is(becuase it's not advisable to hard code these first 7 bytes ) and update only the other two fields:
NAO-MAST-TRAILER-REC-CNT - This is total number of records including the trailer.
NAO-MAST-TRAILER-AMT - Sum of NR-AMT of the detail records
Also for verification purpose can I capture the removed (dropped duplicates) in a separate file. Please advise _________________ Regds,
Somu
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Feb 23, 2009 6:06 pm Post subject:
somuk,
Somuk,
If you want to preserve the original trailer then you have to have more than 1 pass of data. If you are ok with dynamically generating the trailer record then you can use this JCL
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum