Not sure if this applie to your situation, but when dealing with input
values the ACCEPT ... FREE format can be of assistance in getting the number
value lined up right off the bat.
...
049200 05 HOLD-EMPLY PIC 9(5) VALUE 0.
...
750800 DISPLAY "Enter OPERATOR #> " WITH NO ADVANCING
750850 MOVE 1 TO FAILED-SWITCH
750950 ACCEPT HOLD-EMPLY FREE ;
751000 ON INPUT ERROR
751050 DISPLAY BELL "Must be max 5 DIGITS..."
751100 NOT ON INPUT ERROR
751150 MOVE 0 TO FAILED-SWITCH
751200 END-ACCEPT
...
Bob Comeau
Sr. Systems Programmer Analyst
Crossley Carpet Mills Ltd.
(902)895-5491 ex 139
-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]]On
Behalf Of Rao, Raghu
Sent: May 5, 2005 3:08 PM
To: [log in to unmask]
Subject: Re: COBOL : Redefines question
Thanks for everyone's quick reply.. I had no intentions of sticking to
REDEFINES. The COMPUTE and NUMVAL trick did it.. I also would not be needing
ROUNDING because my input character value will always be a positive integer
representing the length of previously accepted another input field. So its
value can range from 0 thru 99.
Thanks.
Raghu Rao
> -----Original Message-----
> From: Rao, Raghu
> Sent: Thursday, May 05, 2005 12:05 PM
> To: [log in to unmask]
> Subject: COBOL : Redefines question
>
> 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:
>
> Thanks.
> Raghu Rao
>
Confidentiality Notice:
The information contained in this electronic message is intended for the
exclusive use of the individual or entity named above and may contain
privileged or confidential information.
If the reader of this message is not the intended recipient or the employee
or agent responsible to deliver it to the intended recipient, you are hereby
notified that dissemination, distribution or copying of this information is
prohibited.
If you have received this communication in error, please notify the sender
immediately by telephone and destroy the copies you received.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|