IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How move left justified space filled pic X to numeric


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Hank Watson

New User


Joined: 25 Nov 2010
Posts: 6
Location: Miami, FL

PostPosted: Fri Jan 07, 2011 10:25 pm
Reply with quote

Does anyone have a clever way of taking a left justified, space filled PIC X field that contains a number and moving it to an actual numeric field. I can do it byte by byte (which I have done many times in the past) but is there an easier way? In other languages, such as JAVA, this is easy; but I don't know of an easy way to do this in COBOL.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 07, 2011 10:28 pm
Reply with quote

Hello and welcome to the forum,

If you are absolutely positive the value will always be a left-justified numeric value, you might consider using NUMVAL to move the number to a numeric field.

If you are not familiar with NUMVAL, there is a link to "IBM Manuals" at the top of the page. What you are looking for will be in the COBOL Language Reference.
Back to top
View user's profile Send private message
Hank Watson

New User


Joined: 25 Nov 2010
Posts: 6
Location: Miami, FL

PostPosted: Mon Jan 10, 2011 3:06 am
Reply with quote

This was my first attempt at posting to any of the forums. I must say - VERY IMPRESSED! Perfect anwser forcing me to read the book and learn something new. Not surprisingly, the function works as documented. Many thanks.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jan 10, 2011 3:11 am
Reply with quote

Good to hear it is working - thanks for letting us know icon_smile.gif

Some of us "old guys" believe the main purpose of the forum is to help with learning . . .

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top