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

Converting alphanumeric data to numeric with right justifica


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

New User


Joined: 19 May 2005
Posts: 12
Location: kolkata

PostPosted: Mon Jun 20, 2005 2:19 pm
Reply with quote

Hi all,

Say we have a variable A which is X(3) and variable B which is 9(3).

If we have values like "1 " , "10 " etc in A with trailing spaces and we want them as 001 and 010 respectively in B which is right justification of the data with preceeding zeroes.

How can that be accomplished with COBOL? Can anyone give the code snippet for that?

Thanks & regards,
Mouli
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Mon Jun 20, 2005 10:15 pm
Reply with quote

Hi Mouli

Check the NUMVAL function.
Code:

COMPUTE WS-NUM-DIGITS = FUNCTION NUMVAL(WS-ALPHA)


For more details
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR10/7.1.32?DT=20020920180651

hth
-Som
Back to top
View user's profile Send private message
mouli

New User


Joined: 19 May 2005
Posts: 12
Location: kolkata

PostPosted: Tue Jun 21, 2005 3:22 pm
Reply with quote

Hi somasundaran_k,

Thank u very much for ur solution. it's working very fine.


thanks & Regards
mouli
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top