Rashmi,

As the other person said, GRP2 of five bytes would overlay the first
five byte of GRP1, the rest of GRP1 is filled with spaces.

Unless you are using some unsafe compiler options, then the statement
MOVE N2 TO N4 should abend with an S0C7 (Data Decimal Exception) as N2
is not a valid number.

However you could do the move using reference modification like this

MOVE GRP2 TO GRP1(1:LENGTH OF GRP2).

In which case N2 would remain a 0 when the display statement is reached.

Darren

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On
Behalf Of Rashmi Nijaguni Mogali
Sent: Wednesday, August 01, 2007 4:16 AM
To: IBM-MAIN@BAMA.UA.EDU
Subject: COBOL Group moves

Hi,

I have a query regarding the following group move:

01 GRP1.
     05      N1           PIC S9(9) COMP-3 VALUE +0.
     05      N2           PIC S9(9) COMP-3 VALUE +0.

01 GRP2.
     05      N3           PIC S9(9) COMP-3 VALUE +123.

01 N4      PIC ZZZ,ZZZ,ZZ9.

PROCEDURE DIVISION.
    INITIALIZE GRP1.
    MOVE GRP2 TO GRP1.
    MOVE N2 TO N4.
    DISPLAY N4.

What value is displayed and why?

Regards,
Rashmi

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to