Page 1 of 1

How to MOVE numeric value to a COMP-3 group variable ?

PostPosted: Fri Jul 09, 2010 6:32 pm
by Falcon
01 WS-VAR-LIST.
                 05 WS-VAR-ONE   PIC X(5).
                 05 WS-VAR-TWO   PIC S9(3) COMP-3.
                     .
                     .
                 05 .......      PIC S9(6)V9(3) COMP-3.
                     .
   


I have to move 500.30 to the variable which has Picture class S9(6)V9(3) COMP-3. But we know only the group variable name(WS-VAR-LIST) and starting position, lenght of the variable in WS-VAR-LIST. How this move can be achieved ?

Re: How to MOVE numeric value to a COMP-3 group variable ?

PostPosted: Sat Jul 10, 2010 12:38 am
by dick scherrer
Hello and welcome to the forum,

First - there is no comp-3 group variable. There cannot be. Group variables are by definition alphanumeric.

What is the source of the 500.30? Is this in a file created by a trusted program or is this "raw input"? If this is raw input, it must be edited before being used or there will be abends. If the value is gong to always be correct use NUMVAL or NUMVAL-C depending on exactly what you have. Look here:
http://publibz.boulder.ibm.com/cgi-bin/ ... r50/7.1.32
and:
http://publibz.boulder.ibm.com/cgi-bin/ ... r50/7.1.33

Suggest you go to the Table of Contents of this manual (COBOL Language Reference) and bookmark it (and possibly download a copy to your local hard drive).

In your code suggest you redefine the area and name the specific fields that are needed for the code. If you won't do this, use Reference Modification.