I have a Fixed block 80 byte file, and need to extract only certain column of information. COLUMN position line is for reference only.
Example of input file:
Code:
SELECT COUNTS BY BANK
THERE CAN BE MORE LINES OF SUCH TEXT
BUT FIXED COLUMN POSITIONS FOR POS1,POS2,POS3
VALUES IN POS1,2,3 COLUMNS WILL BE IN UNSORTED ORDER, BUT POS1,POS2 AND POS3
FOLLOW RULE THAT POS2 CAN HAVE DATA ONLY IF POS1 HAVE DATA
POS3 CAN HAVE DATA ONLY IF POS1 AND POS2 ARE HAVING DATA
THERE IS NO POSSIBILITY OF DUPLICATE VALUE IN POS1,POS2 AND POS3 COMBINED
THERE WILL BE ONLY NUMERICS OR SPACES IN POS1,POS2 AND POS3
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
POS1 POS2 POS3 COUNT BANK LOAD DATE BANK NAME
2000 2000 002160 8999 11-17-06 MNC NAME
3000 1000 002249 3334 11-17-06 QPR NAME
1234 1000 0200 001939 4444 11-17-06 ABC NAME
1235 1000 0300 001994 5555 11-17-06 XYZ NAME
4000 002695 4444 11-17-06 ABC NAME
5000 002660 2234 11-17-06 XYZ NAME
6666 3400 0800 002597 4433 11-17-06 MNC NAME
7777 3500 0900 002429 4444 11-17-06 QPR NAME
8888 9999 002035 8989 11-17-06 ABC NAME
9999 002507 9898 11-17-06 XYZ NAME
MORE TEXT MORE TEXT
MOR TEXT MORE TEXT
POS1 POS2 POS3 COUNT BANK LOAD DATE BANK NAME
4500 9890 004340 8999 11-17-06 MNC NAME
9984 1000 004559 3334 11-17-06 QPR NAME
3984 1000 0200 006939 4444 11-17-06 ABC NAME
Output should be Fixed Block 80 bytes with only data in POS1,POS2 , POS3 while substituting blank position with column name. Output should be sorted in order of POS1,POS2 and POS3.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I can't figure out what is part of the data and what isn't.
Is the following actually in the input file:
Code:
SELECT COUNTS BY BANK
THERE CAN BE MORE LINES OF SUCH TEXT
BUT FIXED COLUMN POSITIONS FOR POS1,POS2,POS3
VALUES IN POS1,2,3 COLUMNS WILL BE IN UNSORTED ORDER, BUT POS1,POS2 AND POS3
FOLLOW RULE THAT POS2 CAN HAVE DATA ONLY IF POS1 HAVE DATA
POS3 CAN HAVE DATA ONLY IF POS1 AND POS2 ARE HAVING DATA
THERE IS NO POSSIBILITY OF DUPLICATE VALUE IN POS1,POS2 AND POS3 COMBINED
THERE WILL BE ONLY NUMERICS OR SPACES IN POS1,POS2 AND POS3
If so, does it appear only once in the file or multiple times? Is it a fixed number of lines? How can we identify these header lines vs the details lines?
Whole part mentioned under 'input file' is part of file excluding column position line which is for reference.
Quote:
POS1 POS2 POS3 COUNT BANK LOAD DATE BANK NAME
is part of file and can appear multiple times in file. But always appears in fixed column position. Only fixed position header is this line.
Detail lines under POS1... also appear in fixed position.
Other text where i described file contents can be assumed to be part of file, as there can be variable text and this text is substituing variable text.
This text appears multiple time in file before POS1 POS2 header line. And usually is between 5 to 10 lines,
Only way to differentiate text from meaningful POS1 Header and POS1... detail lines is by checking between column position 10 - 13 for string 'POS1' or numbers, if not it is text.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's NUM function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see: