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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm

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