SORT card needed to exclude record set
Moderators: Frank Yaeger, Moderator Group
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
SORT card needed to exclude record set
Here is how my input records look like -
A1 00 ABC XYZ -> header
A2 10 XXX PQR -> detail record 1
A3 20 GHI STU -> detail record 2
A4 99 KKK RRR -> trailer
I want to check whenever we have XXX at this position, then I would want to exclude the entire record set (i.e. all rows from 00 (header) to 99 (trailer).
Please suggest SORT card for the same
A1 00 ABC XYZ -> header
A2 10 XXX PQR -> detail record 1
A3 20 GHI STU -> detail record 2
A4 99 KKK RRR -> trailer
I want to check whenever we have XXX at this position, then I would want to exclude the entire record set (i.e. all rows from 00 (header) to 99 (trailer).
Please suggest SORT card for the same
Logically yours,
GRS
GRS
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
JOINKEYS with the same dataset for both inputs. Specofy the key as the first byte (ie will be A) and use a JOIN UNPAIRED,F1,ONLY
In JNF2CNTL, INCLUDE for that value at that position and also a data-record.
If there are no records to include, your entire main file will be "unmatched", meaning you want it. If matched, meaning you don't want it, you won't get any output from the JOINKEYS.
In JNF2CNTL, INCLUDE for that value at that position and also a data-record.
If there are no records to include, your entire main file will be "unmatched", meaning you want it. If matched, meaning you don't want it, you won't get any output from the JOINKEYS.
this would be very easy with File-Aid MVS.William Collins wrote:JOINKEYS with the same dataset for both inputs. Specofy the key as the first byte (ie will be A) and use a JOIN UNPAIRED,F1,ONLY
In JNF2CNTL, INCLUDE for that value at that position and also a data-record.
If there are no records to include, your entire main file will be "unmatched", meaning you want it. If matched, meaning you don't want it, you won't get any output from the JOINKEYS.
reply here if your interested.
Chuck Haatvedt
email --> clastnameatcharterdotnet
(replace lastname, at, dot with appropriate
characters)
email --> clastnameatcharterdotnet
(replace lastname, at, dot with appropriate
characters)
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
Bill,
I tried the one suggested by you, it didn't work.
Here is my requirement -
input file -
output file should look like this -
So, whenever 200 is at 7th byte in input file, I want those records (along with header = 00 at 4th byte & trailer = 99 at 4th byte) in the o/p file.
Please assist
I tried the one suggested by you, it didn't work.
Here is my requirement -
input file -
Code: Select all
B2 00 GGG MISC_ORDER
B2 10 001 C
B2 20 001 C
B2 99 GLO 20151027 163020 0000002
B2 00 HHH MISC_ORDER
B2 10 200 200
B2 20 200 200
B2 10 200 200
B2 20 200 200
B2 99 GLO 20151027 163020 0000008
output file should look like this -
Code: Select all
B2 00 HHH MISC_ORDER
B2 10 200 200
B2 20 200 200
B2 10 200 200
B2 20 200 200
B2 99 GLO 20151027 163020 0000008
So, whenever 200 is at 7th byte in input file, I want those records (along with header = 00 at 4th byte & trailer = 99 at 4th byte) in the o/p file.
Please assist
Logically yours,
GRS
GRS
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
I only know of how to extract detail records (which even every Mainframe newcomer can do).
But I have no clue of how to extract corresponding header & trailer record for those detail records all together.
Tried checking in SORT manuals but could not get anything.
Hence seeking experts' guidance here!
But I have no clue of how to extract corresponding header & trailer record for those detail records all together.
Tried checking in SORT manuals but could not get anything.
Hence seeking experts' guidance here!
Logically yours,
GRS
GRS
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
You use JOINKEYS, with the same dataset for both inputs.
In JNF1CNTL, you use INREC with WHEN=GROUP to PUSH an ID to a temporary extension to the record. This ID field will be your key for the first JOINKEYS statement, where you also specify SORTED,NOSEQCK.
In JNF2CNTL you using INCLUDE to identify the data that you want, and also to include all headers. Use WHEN=GROUP to do the same thing as in JNF1CNTL. Use IFTHEN=(WHEN=(logicalexpression) to identify the headers, and to set the extended ID to, for instance, binary zero. Use SUM FIELDS=NONE to avoid duplicate keys. Specify the extended ID as the second JOINKEYS key.
Don't use a JOIN statement, so you only get the matched records.
Specify your entire F1 only on the REFORMAT statement.
You should be around about there, then.
You can deal with duplicate keys in a different way. If you have many, many groups of records you may want to do it differently.
In JNF1CNTL, you use INREC with WHEN=GROUP to PUSH an ID to a temporary extension to the record. This ID field will be your key for the first JOINKEYS statement, where you also specify SORTED,NOSEQCK.
In JNF2CNTL you using INCLUDE to identify the data that you want, and also to include all headers. Use WHEN=GROUP to do the same thing as in JNF1CNTL. Use IFTHEN=(WHEN=(logicalexpression) to identify the headers, and to set the extended ID to, for instance, binary zero. Use SUM FIELDS=NONE to avoid duplicate keys. Specify the extended ID as the second JOINKEYS key.
Don't use a JOIN statement, so you only get the matched records.
Specify your entire F1 only on the REFORMAT statement.
You should be around about there, then.
You can deal with duplicate keys in a different way. If you have many, many groups of records you may want to do it differently.
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
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