View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi,
I have 2 records like,
Code: |
record1: Abdul rafi went to madras
record2: Cts tcs csc Accenture |
In both the records, I need to append a data soon after the final word ends. So the output should look like this, Note that the space between each word is not equal.
Code: |
record1: Abdul rafi went to madrasAmerica
record2: Cts tcs csc AccentureAmerica |
Could anybody help me how I can resolve this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The "Code" tag is your friend
To do what you want determine the last data position with a non-blank value in the record. Then, using Reference Modification, move the additional data to that position+1. |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
It is to append that data and use it as files in jcl. there is a program which processes after that. but if i use reference modification i need the entire record in a working storage and then use it as a(1),a(2)....etc. Wont it be more complex? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Wont it be more complex? |
It shouldn't be. . .
No matter how you do this, you will need the entire record in your COBOL code.
You can "reverse" the data and look for the first non-blank or you can write a loop that looks at bytes from the back end until the first non-blank is found.
There is no reason to code (1) and (2) and (n). . .
Now is probably a good time to become familiar with our forum SEARCH feature (in the blue line above). There are multiple topics in the COBOL part of the forum that deal with determining the first/last non-blank. |
|
Back to top |
|
|
|