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
 

 

Moving/replacing values into variable of different length

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Mon Apr 26, 2010 1:17 pm    Post subject: Moving/replacing values into variable of different length
Reply with quote

1) I have a variable length of 10 characters with spaces inclusive .
How can I replace the spaces with '-' .

My answer :
-> We can do this using String functions in COBOL program (not sure which function name) .
-> We write a logic in COBOL program to replace the strings .
-> We can do the same with JCL (using SORT etc) .

Please let me know if answers were OK ?

2) I have a numeric variable of length 8 .
I am moving value '10' to it . How it will accomodate ?

My answer :
It will placed at the rightmost bits .
However we can format the placing using the format specifiers in COBOL .

Please let me know is correct answer ?
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: Mon Apr 26, 2010 1:25 pm    Post subject:
Reply with quote

Hello,

1. Not a string function but - INSPECT/REPLACING. There are STRING and UNSTRING functions, but they would not be good for this.

2. This would depend on the actual definition of the field. Suggest you use the link at the top of the page to "IBM Manuals" among which are several COBOL Language Reference documents. Read about moving to numeric fields.
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Mon Apr 26, 2010 2:28 pm    Post subject:
Reply with quote

Thanks Dick !!!
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: Mon Apr 26, 2010 11:18 pm    Post subject: Reply to: Moving/replacing values into variable of different
Reply with quote

You're welcome - good luck icon_smile.gif

d
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm


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