Page 1 of 1

File Split

PostPosted: Sat Jun 22, 2013 2:37 am
by Vineet
Hi All,

I have a a query regarding Splitting a File. I have a sequntial File with Attributes as LRECL = 80, RECFM = FB. I want to create 2 Files. Below is the requirement.

1. Lets Consider Record 1/2.
If the Value at Position (3,1) = 1 Or 2 AND Subsequent Record is Having Value at Position (3,1) = 3, and Value from Position 5,33 (|000000613|000000011|000004088|) is same then the Record Having
Value 1 or 2 to be written to File A.

2. Lets Consider Record 4/5/6 Value at Position = 1 / 2 / 3 & there is no Susequent record then the record to be written to File B.


Record 1
8|1|000000613|000000011|000004088|Crystal Light On the Go Sticks ---> To Be Written To File A
8|3|000000613|000000011|000004088|Crystal Light On the Go Sticks

Record 2
8|2|000000614|000000011|000004089|Crystal Light On the Go Sticks ---> To Be Written To File A
8|3|000000614|000000011|000004089|Crystal Light On the Go Sticks

Record 3
8|1|000000615|000000011|000004090|Crystal Light On the Go Sticks ---> To Be Written To File A
8|3|000000615|000000011|000004090|Crystal Light On the Go Sticks

Record 4
8|1|000000616|000000011|000004091|Crystal Light On the Go Sticks ---> To Be Written To File B
No Subsequent Record, like Record 1/2/3.

Record 5
8|2|000000618|000000011|000004091|Crystal Light On the Go Sticks ---> To Be Written To File B
No Subsequent Record, like Record 1/2/3.

Record 6
8|3|000000619|000000011|000004091|Crystal Light On the Go Sticks ---> To Be Written To File B
No Subsequent Record, like Record 1/2/3.


Thanks

Re: File Split

PostPosted: Sat Jun 22, 2013 4:42 am
by BillyBoyo
Is another way of putting what you want:

I have a key at 5,9

If I have two records with that key, write to File 1
If I have one record with that key, write to File 2
There are no other possibilities

Otherwise, please amend your sample input and expected output to show any other possibilities.