Hi All,
I am using Syncsort Z/OS 2.1.3 and my requirement is to split 1 input file into 10 output files based on certain conditions:
Input file is a Flat File (FB) of 32127 length can have thousands of records and this count can vary each day. This file has trades and markers and trades and markers.
Total number of o/p files to be written are 10.
On the position 221 and for length 1 if the character is X or Y or Z or P or R or D then write this record to Output File 1 as this is a Trade.
My requirement is i will keep reading the file, writing all the trades to o/p file 1, the moment I hit marker i have to write this another new o/p file 2. Again keep reading and write the trades after the marker to o/p file 3 and so on.
So finally, i should have
File 1 - trades
file 2 - marker
file 3 - trades
file 4 - marker
file 5 - trades
file 6 - marker
.....
file 10 - trades
I need to distribute into 10 files with no duplicates. trades before marker goes to a file, marker goes to another file, again the next set of trades goes to another file and then the next marker goes to another file and so on.
I always suggest first of all:
1) RTFM,
2) run simplified test to understand the idea(s) of required operations,
3) update the successful test to the original task
It takes no more than 1 hour as first-time-job, and no more than 10 minutes for others:
OP specified the LRECL=32127 and also condition is @ offset 221,1
Prasanth Kumar wrote:
Input file is a Flat File (FB) of 32127 length can have thousands of records and this count can vary each day. This file has trades and markers and trades and markers.
Total number of o/p files to be written are 10.
On the position 221 and for length 1 if the character is X or Y or Z or P or R or D then write this record to Output File 1 as this is a Trade.
BUILD is unnecessary here and waste of resources, we can use OVERLAY instead
Waste of resources with BUILD???!!!
OMG, what you are talking about...
magesh23586 wrote:
UNTESTED code
Code:
INREC IFTHEN=(WHEN=(221,1,SS,EQ,C'X,Y,Z,P,R,D'),
Using WHEN=(221,1,SS,EQ,C'X,Y,Z,P,R,D') - is a bad idea in general case. The character "comma" (C',') when appeared by a chance will also mark the new group.
What would be a benefit of replacing the correct value C'XYZPRD' with half-correct one C'X,Y,Z,P,R,D'?
In general, I would call all the suggested last updates as "nit-picking"
Waste of resources with BUILD???!!!
OMG, what you are talking about...
Build - you are rebuilding the entire record again.
Overlay - just overlay the record @ last position.
Building an entire record again is a waste of resources.
The OVERLAY parameter enables you to change particular columns and add fields to the end of a record without rebuilding the entire record. When using the OVERLAY parameter you only need to specify the columns you want to change. The rest of the input record remains unchanged.
sergeyken wrote:
Using WHEN=(221,1,SS,EQ,C'X,Y,Z,P,R,D') - is a bad idea in general case. The character "comma" (C',') when appeared by a chance will also mark the new group.
What would be a benefit of replacing the correct value C'XYZPRD' with half-correct one C'X,Y,Z,P,R,D'?
If ",' is there in the input, it should be avoided, it is just for clarity.
Building an entire record again is a waste of resources.
If ",' is there in the input, it should be avoided, it is just for clarity.
The record (physically) is re-built exactly in the same manner, either with BUILD, or with OVERLAY. I implemented similar operations in Assembler myself; the difference in syntax doesn't matter.