Page 1 of 1

Sort help request

PostPosted: Sat Sep 27, 2014 9:43 pm
by Srini1808
Greetings!
I have a file which is 40 bytes fixed block. Most if the records contain first 20 bytes only. There are a few records which have full 40 bytes. I am trying to write out a file with 20 bytes record size, as shown. If the input file has 4 records, you can see that we will have 5 records in the output. I tried to use sort inRec with IFTHEN logic By checking byte 1 and byte 21 for non blank it did not work. I tried HIT NEXT, it too would not create 2 records Reading a single record. Any help in making me think in the right direction is highly appreciated. Thanks - sreeni
Input
Aaaaaaaaaaaaaaaaaaaa
Bbbbbbbbbbbbbbbbbbb
CccccccccccccccccccccDddddddddddddddddddd
Eeeeeeeeeeeeeeeeeeee

Output
 
Aaaaaaaaaaaaaaaaaaaa
Bbbbbbbbbbbbbbbbbbb
Ccccccccccccccccccccc
Ddddddddddddddddddd
Eeeeeeeeeeeeeeeeeeee


Code'd

Re: Sort help request

PostPosted: Sun Sep 28, 2014 3:31 am
by BillyBoyo
Please use the Code tags to preseve spacing when posting.

If you need multiple (two or more) records from an input record, you have to use OUTFIL's slash operator (/), which is available on BUILD.

So you need OUTFIL with IFTHEN=(WHEN=(logical expression) for the record you want to split, then BUILD=(1,20,/,21,20) or similar.

Re: Sort help request

PostPosted: Sun Sep 28, 2014 7:27 am
by Srini1808
Thank You very much! Worked perfectly!