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
 
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 Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

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