I have a requirement. i need to split a record (having 254 characters) if any of the following case occurs.
1) After every 90 characters
2) There is a set of strings say 'XYZ', 'ABC', 'PQR' etc.
At any ocurance of a perticular string say 'XYZ' , from this set of strings.
If the record breaks due to 2nd reason then the new sentence has to begin from the foresaid string. i.e. i have to retain the string in the beginning of the new line.
I would give a sample of input and expected output.
Input can be:
World is a beautiful place.....<90 char>Save the planet earth....<90 char>Good morning...<30 char>
Expected output:the above line string should be split in three lines as follows.
World is a beautiful place.....<90 char>
Save the planet earth....<90char>
Good morning...<30 char>
Input can be:
World is a beautiful place XYZ save the planet earth ABC Good morning.
World is a beatuiful place
XYZ save the planet earth
ABC Good morning.
recfm is FB for both input and putput and lrecl is 254 for input and 90 for output.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
It may help if you post more complete examples and use data lengths of 50/20 rather than 254/90 (once you have something that does what you want, changing the length to the longer length should be trivial). If you create sample input and expected output using the shorter lengths it will be much easier for you to post and for us to read & work with. When you post the input and output, please use the "Code" tag near the top of the reply panel. This will preserve embedded blanks and is much easier to read. To make sure your post will appear as you want, click Preview. When you are satisfied with your post, then Submit.
Why are ABC and XYZ "special"? How many of these special values will the process need to look for as a delimiter? Will these special values always be the same length? What is the chance that some value that is a delimiter might be actual data in some other place in the input text?