dfsort on file with mutiple 3 byte codes
Moderators: Frank Yaeger, Moderator Group
dfsort on file with mutiple 3 byte codes
I was given a file that has five 3 byte codes in it. For example...
xxxxx000000000222631
xxxxx000000632000222
xxxxx631999000000000
I am supposed to sort the file in ascending sequence. This input file will always contain codes of either 631, 632 or 633. Some will have ONLY one field containing either 631, 632 or 633. Other records will have codes (like 222 above) in them. I don't see any way to sort this file with the 631 and 632 and 633 codes in ascending order if sometimes another code exists.
Hope this makes sense.
xxxxx000000000222631
xxxxx000000632000222
xxxxx631999000000000
I am supposed to sort the file in ascending sequence. This input file will always contain codes of either 631, 632 or 633. Some will have ONLY one field containing either 631, 632 or 633. Other records will have codes (like 222 above) in them. I don't see any way to sort this file with the 631 and 632 and 633 codes in ascending order if sometimes another code exists.
Hope this makes sense.
-
- Member
- Posts: 6
- Joined: Thu Apr 16, 2009 5:29 pm
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Nina,
Your requirement is not clear.
Does every record have one of the three codes 631, 632 or 633 in one of those 5 fields? Or do some records not have 631, 632 or 633?
Please show a better example with more than 3 input records. Show records without any of the 3 codes if that's possible. Show the expected output records.
Also, give the RECFM and LRECL of the input file.
Do the set of 5 codes start in position 6 as shown in your example?
Your requirement is not clear.
Does every record have one of the three codes 631, 632 or 633 in one of those 5 fields? Or do some records not have 631, 632 or 633?
Please show a better example with more than 3 input records. Show records without any of the 3 codes if that's possible. Show the expected output records.
I don't understand what you mean by this. Hopefully, showing the expected output will make it clear what you want.I want to only keep codes 631 632 and 633 in the sorted file
Also, give the RECFM and LRECL of the input file.
Do the set of 5 codes start in position 6 as shown in your example?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
every record will have one of the three codes...the last 15 bytes of the sorted file below are the five 3 byte codes, but because there could be an additional code along with a 631 or 632 or 633, the 600 series codes won't always sort in ascending seq
For example, the first 2 record have additional codes along with 632 and 633. So I don't think it's possible to sort the 600 codes since another code
could be there also
20090401D2009040320090403000000041109632
20090401D2009040320090403000000041109633
20090401C2009032620090413000000000631000
20090401C2009032620090413000000631000000
20090401C2009032620090413000000631000000
20090401C2009032620090413000000631000000
20090401C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090402C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090401C2009021420090414000000632000000
20090401C2009021420090414000000633000000
20090401C2009041320090414000000633000000
For example, the first 2 record have additional codes along with 632 and 633. So I don't think it's possible to sort the 600 codes since another code
could be there also
20090401D2009040320090403000000041109632
20090401D2009040320090403000000041109633
20090401C2009032620090413000000000631000
20090401C2009032620090413000000631000000
20090401C2009032620090413000000631000000
20090401C2009032620090413000000631000000
20090401C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090402C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090401C2009021420090414000000632000000
20090401C2009021420090414000000633000000
20090401C2009041320090414000000633000000
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Please stop saying that it isn't possible. Of course it is.
Instead, give me the information I asked for so I can show you how to do what you want.
Again:
Show the expected output records.
Give the RECFM and LRECL of the input file.
What position do the "last 15 bytes" start in?
Also, you say that you want to sort on the three codes. For records that all have the same code (e.g. 631), do you want to sort them on an additional field (which one) or output them in the same order as they were input, or what?
Instead, give me the information I asked for so I can show you how to do what you want.
Again:
Show the expected output records.
Give the RECFM and LRECL of the input file.
What position do the "last 15 bytes" start in?
Also, you say that you want to sort on the three codes. For records that all have the same code (e.g. 631), do you want to sort them on an additional field (which one) or output them in the same order as they were input, or what?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT job that will do what I think you asked for:
For your input example, SORTOUT will have:
The 631 records are first, then the 632 records and then the 633 records. I kept duplicate records (e.g. all 631 records) in their original order.
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/40)
//SORTOUT DD DSN=... output file (FB/40)
//SYSIN DD *
INREC IFTHEN=(WHEN=(26,3,SS,EQ,C'631,632,633'),OVERLAY=(41:26,3)),
IFTHEN=(WHEN=(29,3,SS,EQ,C'631,632,633'),OVERLAY=(41:29,3)),
IFTHEN=(WHEN=(32,3,SS,EQ,C'631,632,633'),OVERLAY=(41:32,3)),
IFTHEN=(WHEN=(35,3,SS,EQ,C'631,632,633'),OVERLAY=(41:35,3)),
IFTHEN=(WHEN=(38,3,SS,EQ,C'631,632,633'),OVERLAY=(41:38,3))
OPTION EQUALS
SORT FIELDS=(41,3,CH,A)
OUTREC BUILD=(1,40)
/*
Code: Select all
20090401C2009032620090413000000000631000
20090401C2009032620090413000000631000000
20090401C2009032620090413000000631000000
20090401C2009032620090413000000631000000
20090401C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090402C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090401C2009041520090417000000631000000
20090401D2009040320090403000000041109632
20090401C2009021420090414000000632000000
20090401D2009040320090403000000041109633
20090401C2009021420090414000000633000000
20090401C2009041320090414000000633000000
I couldn't figure out what you mean by this so I ignored it.I don't care if the other codes OTHER than 631, 632 or 633 end up in the sorted file
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Ok, good. Try to describe your requirement more clearly in your first post next time for a faster solution.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page