I have a VB file LRECL 5014 which I need to limit to an LRECL of 256. Most of the records are less than 256 but some aren't. The output file needs to be VB.
I need to find lines that are longer than 256 and split them up into 256 chunks with an intervening line with something like 'SPLIT LINE' on it so I can tell which lines have been split - This file is going to be emailed and then the long lines need to be put back together - hence the **SPLIT** for ease of finding the rows that were chopped up.
I've figure out a way to do it - but it is quite clunky and is going to be long as I will need about 20 IFTHEN statements. I have got the basics working (breaking it up into lengths of 100 for testing purposes).
Joined: 09 Mar 2011 Posts: 7312 Location: Inside the Matrix
There are no looping constructs. ICETOOL's RESIZE only works with fixed-length records, and would require a second pass of the data at least.
You need to specify a length in all but the final record of each IFTHEN. At the moment, you are writing out longer records than you think.
If your output needs to be 256, and you have that long "marker", you're going to need to have less data in each output record.
What about records which are 100 bytes long in your example? It doesn't really matter, as you have it. The final IFTHEN is redundant (it BUILDs a record to its exact original condition - so no need to bother).
You've got a lot of repetition. I'd use symbols/SYMNAMES which will reduce nasty typos, and aid testing with different-sized data. It will also make it clearer what you code is doing.
So, 20 IFTHENs (or so). Define the symbols, make the first IFTHEN, then it is just an editor-job to make the remaining ones.