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



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

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

Postby Falcon » Fri Jul 09, 2010 6:32 pm

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 ?
Regards,
Ian Padayachi
Falcon
 
Posts: 7
Joined: Fri Jul 09, 2010 6:16 pm
Has thanked: 0 time
Been thanked: 0 time

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

 

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

Postby dick scherrer » Sat Jul 10, 2010 12:38 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post