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
 

 

Reg: Using NUMVAL intrinsic function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
mail_ssb

New User


Joined: 26 Mar 2005
Posts: 17

PostPosted: Sun Jun 05, 2005 11:50 pm    Post subject: Reg: Using NUMVAL intrinsic function
Reply with quote

Hello,
Appreciate any suggestions / help on this problem.

CODE:

05 WS-A PIC X(3) '999'.
05 WS-B PIC 9(3).

DISPLAY 'WS-A: ' WS-A
MOVE FUNCTION NUMVAL(WS-A) TO WS-B.
DISPLAY ' WS-B: ' WS-B

Problem: there is a compilation error to the effect that use of NUMVAL function is invalid in this context.

Troubleshooting: Tried changing WS-B to COMP-1 because the return type of NUMVAL is floating point...But error persists.

Thanks for help.
Back to top
View user's profile Send private message

Aditya Bhardwaj
Warnings : 1

New User


Joined: 02 Nov 2004
Posts: 18
Location: Noida, India

PostPosted: Tue Jun 07, 2005 10:45 am    Post subject: Re: Reg: Using NUMVAL intrinsic function
Reply with quote

Hi SSB,
The solution to your problem is to use COMPUTE rather to move the value from alphanumeric to the numeric field.

Code the following:

05 WS-A PIC X(3) '999'.
05 WS-B PIC 9(3).

DISPLAY 'WS-A: ' WS-A
COMPUTE WS-B = FUNCTION NUMVAL(WS-A).
DISPLAY ' WS-B: ' WS-B

With this we can do five arithmetic operations on the same like ADD, SUBTRACT, MULTIPLY, DIVIDE and COMPUTE.

During the analysis, what we found is, the "FUNCTION NUMVAL (WS-A)" performs the related task, but fail to find the location to store it temporarily before moving it to WS-B variable.

Let me know if I am clear and suggestions/corrections are always welcomed.
Back to top
View user's profile Send private message
mail_ssb

New User


Joined: 26 Mar 2005
Posts: 17

PostPosted: Fri Jun 10, 2005 6:05 am    Post subject:
Reply with quote

Hi Aditya,

You are correct....NUMVAL works if I use COMPUTE....

Its weird but even standard IBM documentation illustrates NUMVAL using a MOVE statement..!!

Appreciate your help...Thanks..!
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am


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