How to sort a variable length file, with multiple record types

5 pts.
Tags:
z/OS
12345     101xxxxxxxx

12345     201xxxxxxxx1

12345     201xxxxxxxx2

12346     104xxxxxxxx

12346     204xxxxxxxx1

12347     101xxxxxxxx

12347     201xxxxxxxx1

 

Above is an example of a file I am trying to sort.  I want to sort by the 2nd and 3rd characters, of the right table (01, 04, etc).  The first character in the right table is a record type (1 or 2)  The last character in the right table is a sequence number, which only applies to the 2 type records.  For each 1 type record, there are up to 6 corresponding and related 2 type records, which must follow the type 1 records, in sequence order, (1-6)  The sort field (01, 04, etc) is common to both types of records, and in the same byte locations, but come in a file where they are not sequentially ordered.  How can I sort this, so that the sort field I want is in ascending order, but yet the type 2 records that correspond are kept in sequential order, below each type 1 type record?



Software/Hardware used:
IBM Z/OS DFsort utility
ASKED: November 25, 2009  6:35 PM
UPDATED: June 8, 2012  5:45 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

you want to SORT two “tables” together –

I do not understand what you are asking. tables? as in DB2 tables? Or you asking about sort as in SYNCSORT? I

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Priyanshu
    //STEP1 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=SAB67D.G4662V00.TEST,DISP=SHR //SORTOUT DD DSN=DFG37D.DFG0GF.TEST, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,10),RLSE), // DCB=*.SORTIN //SYSIN DD * OPTION VLSHRT SORT FIELDS=(2,2,CH,A)
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following