MAINFRAME - TIP OF THE DAY :
When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file
Programmers Voted for below topics. Please Vote for good Posts.
Thank You! for your feedback. Connecting to the server. Please Wait...
Posted: Mon Nov 09, 2015 8:09 pm Post subject: 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 _________________ Logically yours,
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! _________________ Logically yours,
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.
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
Cobol Tutorial This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial This Tutorial covers all important aspects of DFSORT. Has more SORT examples