Hi All,
I am trying to report something out via DFSORT/ICETOOL. The input file is as below:
A B C D E
1 2 3 4 5
6 7 3 9 1
5 6 6 8 2
Date: <today's date>
....
....
So A, B, C, D, E are actually headers to which the information 1, 2, 3, 4 5 correspond. Now, we will assume here that they are aligned here so that information is at the bottom of header. I can modify the code later as per the row/column position specifics.
There may be multiple rows between column header and till the time 'Date' literal is encountered.
The objective is to extract all the lines before the 'Date' literal whose value in column C is '3'.
The output should be:
A C E
1 3 5
6 3 1
Is it achievable via SORT/ICETOOL or should i just proceed with writing a COBOL program for it?
Regards
Varun
SORT query?
Moderators: Frank Yaeger, Moderator Group
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Yes.
Do you have more data after "Date"?
If not, it is an INCLUDE COND=( with an AND, to include your heading for the third column and the value you want for the third column.
The use INREC BUILD=( to format the output you want.
If there is data after "Date", you can use IFTHEN=(WHEN=GROUP with a BEGIN for the "Date" and PUSH the date field onto all the subsequent records (you don't need the records, so you can do it at position 1 without causing a problem). Then use OUTFIL OMIT= to get rid of all the records marked with "Date".
Do you have more data after "Date"?
If not, it is an INCLUDE COND=( with an AND, to include your heading for the third column and the value you want for the third column.
The use INREC BUILD=( to format the output you want.
If there is data after "Date", you can use IFTHEN=(WHEN=GROUP with a BEGIN for the "Date" and PUSH the date field onto all the subsequent records (you don't need the records, so you can do it at position 1 without causing a problem). Then use OUTFIL OMIT= to get rid of all the records marked with "Date".
-
- Member
- Posts: 3
- Joined: Wed Sep 14, 2011 7:31 pm
-
- Member
- Posts: 3
- Joined: Wed Sep 14, 2011 7:31 pm
Okay, seems like I'd need sort after all, different task though -
Input 80 byte FB file:
Hello Varun
AA BB CC DD EE
FF GG HH II JJ
Hello William
11 22 33 44 55
Desired Output:
AA Varun BB CC DD EE
FF Varun GG HH II JJ
11 William 22 33 44 55
NOTE: Values like AA, BB, 11, 22 etc may be different. Keywords 'Varun' and 'William' will remain fixed, its just that i dont know how many lines will i have under the 'Hello Varun' or 'Hello William' record.
Input 80 byte FB file:
Hello Varun
AA BB CC DD EE
FF GG HH II JJ
Hello William
11 22 33 44 55
Desired Output:
AA Varun BB CC DD EE
FF Varun GG HH II JJ
11 William 22 33 44 55
NOTE: Values like AA, BB, 11, 22 etc may be different. Keywords 'Varun' and 'William' will remain fixed, its just that i dont know how many lines will i have under the 'Hello Varun' or 'Hello William' record.
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