Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 141
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: 141
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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us