I have got an assignment where in I need to sort records and also eliminate duplicates which have variable key length in a "|" delimited file. My data looks as below:
sreedharkonduru,
What is the LRECL and RECFM of the input file and your expected output? What is the max. length of the first field or key field on which you want to eliminate duplicates?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
sreedharkonduru,
What is the maximum length of the key?
What is the expected output?
Given that you have different lengths for the "keys", do you want to pad the shorter key on the right with blanks for sorting? Or do you want to "normalize" the keys in some other way (how)?
sreedharkonduru,
Asking again... --> What is the max. length of the first field or key field on which you want to eliminate duplicates?
However, rather than going back and forth on questions, based on sample input data,I am assuming it is 20 bytes alphanumeric field (CLCM916893A000106) , you can change it accordingly if it doesn't suit your requirement.
Thank you for quick turn around. The maximum length of the key is 90.
No padding the key on the right. There should not be any change in the record. Records should only be sorted.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
No padding the key on the right. There should not be any change in the record. Records should only be sorted.
I didn't mean permanent padding of the field. Just how you want the fields normalized for sorting. If you had given all the information asked for (such as the expected output), we wouldn't need to keep asking questions. Assuming you want trailing blanks for normalizing the sort keys, you can use these DFSORT control statements:
//VARSORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/800)
//SORTOUT DD DSN=... output file (FB/800)
//SYSIN DD *
OPTION EQUALS
INREC PARSE=(%01=(ENDBEFR=C'|',FIXLEN=20), max length of field -20
%02=(ENDBEFR=C'|',FIXLEN=12), max length of field -12
%03=(ENDBEFR=C'|',FIXLEN=50), max length of field -50
%04=(ENDBEFR=C'|',FIXLEN=20)), max length of field -20
OVERLAY=(801:%01,821:%02,833:%03,883:%04)
SORT FIELDS=(801,20,CH,A,821,12,CH,A,833,50,CH,A,883,20,CH,A)
SUM FIELDS=NONE
OUTREC BUILD=(1,800)
/*
//
Job abended with U0016 return code. The sysout is below:
Code:
SYSIN :
OPTION EQUALS
INREC PARSE=(%01=(ENDBEFR=C'|',FIXLEN=20),
*
%02=(ENDBEFR=C'|',FIXLEN=12),
%03=(ENDBEFR=C'|',FIXLEN=50),
%04=(ENDBEFR=C'|',FIXLEN=20)),
OVERLAY=(801:%01,821:%02,833:%03,883:%04)
SORT FIELDS=(801,20,CH,A,821,12,CH,A,833,50,CH,A,883,20,CH,A)
SUM FIELDS=NONE
OUTREC BUILD=(1,800)
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Please correct my code. Thanks a lot for your help in advance.
PS: My code does affects the first record. Please look into that issue also
I was not aware that DFSORT and SYNCSORT are different. Thanks for the information. Now how do I proceed on this as I think SYNCSORT is present on my Client's mainframe.
I was not aware that DFSORT and SYNCSORT are different. Thanks for the information. Now how do I proceed on this as I think SYNCSORT is present on my Client's mainframe.
Look into SYNCSORT documentation for your release..
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I was not aware that DFSORT and SYNCSORT are different.
Yes, DFSORT is IBM's sort product and Syncsort is Syncsort's sort product.
I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.