Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Query on cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 149
Location: Coimbatore

PostPosted: Tue Jul 27, 2010 11:08 pm    Post subject: Query on cobol
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

Site Director


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

PostPosted: Tue Jul 27, 2010 11:23 pm    Post subject:
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: 149
Location: Coimbatore

PostPosted: Tue Jul 27, 2010 11:36 pm    Post subject:
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

Site Director


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

PostPosted: Tue Jul 27, 2010 11:51 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 4 Wed Nov 22, 2017 10:23 pm
No new posts Native SQL Query kishpra DB2 1 Wed Nov 22, 2017 8:38 pm
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us