HP3000-L Archives

May 2005, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tom Brandt <[log in to unmask]>
Reply To:
Tom Brandt <[log in to unmask]>
Date:
Thu, 5 May 2005 12:20:19 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (47 lines)
Don't use REDEFINES, use the COBOL function NUMVAL.

COMPUTE WS-C = FUNCTION NUMVAL(WS-A).

This will move the value 3 to WS-C.

At 12:05 PM 5/5/2005, Rao, Raghu wrote:
>Hi,
>
>In cobol, is there any way that I get the redefined value from character
>value into a proper numeric value ?
>
>For Ex:
>*************
>01 WS-A           PIC X(04).
>01 WS-B redefines WS-A   pic 9(04).
>02 WS-C           pic 9(04).
>...
>MOVE 3 TO WS-A.
>MOVE WS-B TO WS-C.
>..
>DISPLAY " A:" WS-A ":"
>DISPLAY " B:" WS-B ":"
>DISPLAY " C:" WS-C ":"
>
>Results are
>A:3   :
>B:3   :
>C:3000:
>
>
>I want the results to be:
>--------------------------------
>A:3   :
>B:0003:
>C:3:

--
Tom Brandt
Northtech Systems, Inc.
130 S. 1st Street, Suite 220
Ann Arbor, MI 48104-1343
http://www.northtech.com/

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2