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 replacing junk with hyphen Nitin32 DFSORT/ICETOOL 10 Fri Jun 02, 2017 7:47 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm


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