IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Query on cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Tue Jul 27, 2010 11:08 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jul 27, 2010 11:23 pm
Reply with quote

Hello,

The "Code" tag is your friend icon_smile.gif

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
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Tue Jul 27, 2010 11:36 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jul 27, 2010 11:51 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top