View previous topic :: View next topic
|
Author |
Message |
vinay upadhyay
New User
Joined: 13 May 2007 Posts: 14 Location: chennai
|
|
|
|
Hi All,
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.
Please help.....
Vinay |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please post some sample input data and the expected output from that data.
Also, please include the recfm and lrecl of the both the input and output files. You mentioned 254 and 90 characters, but clarificatoin will help. |
|
Back to top |
|
|
vinay upadhyay
New User
Joined: 13 May 2007 Posts: 14 Location: chennai
|
|
|
|
Hi,
Thanks for response
I would give a sample of input and expected output.
Case1:
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>
Case2:
Input can be:
World is a beautiful place XYZ save the planet earth ABC Good morning.
Expected output:
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.
I think i am making my point clear. |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
In the Sort control card you can use / character to write input record into multiple lines. |
|
Back to top |
|
|
vinay upadhyay
New User
Joined: 13 May 2007 Posts: 14 Location: chennai
|
|
|
|
Hi,
Devzee wrote: |
In the Sort control card you can use / character to write input record into multiple lines. |
This is not clear to me. can you please elaborate. an example will help. Moreover i have to split the records on basis of some strings also. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I think i am making my point clear. |
No, you're not. It's not clear when you want to use which rule, what the actual set of strings is, whether case1 and case2 are two different input files each with its own rules, or one input file with different sets of rules. Also, for case 1 you show the output as 90/90/30, but it would actually have to be 90/90/90 with the third record padded with blanks on the right.
Case 1 as shown could be done with these DFSORT control statements:
Code: |
OPTION COPY
OUTFIL BUILD=(1,90,/,91,90,/,181,30)
|
Case 2 could probably be done with DFSORT's PARSE function, but how you would do it depends on the full set of rules and strings. For more information on DFSORT's PARSE function, see:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
vinay upadhyay
New User
Joined: 13 May 2007 Posts: 14 Location: chennai
|
|
|
|
Hi,
The 2 cases can be in the same input file.That is to say there can be two kind of records in the inputs file.
Frank Yaeger wrote: |
Also, for case 1 you show the output as 90/90/30, but it would actually have to be 90/90/90 with the third record padded with blanks on the right.
|
This is correct.
Now there is change in the requirment.ppl want us to implement the logic in a pre existing program rather than using a sort step (which we thought of doing earlier).
How can we do it in a cobol pgm? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I'm closing this thread. Please start a new thread in the COBOL Forum. |
|
Back to top |
|
|
|