Subject: | |
From: | |
Reply To: | |
Date: | Wed, 15 Oct 1997 13:55:49 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Mike Berkowitz writes:
-----------------------------------------------------------------------
-------------
No, Tony is right. Even though a COBOL PIC S9(9) COMP should only
hold to a maximum of 999,999,999, the compiler only uses your picture
clause as a blueprint for move and display statements. Internally it
will
treat the number as a 32 bit signed integer that can have a maximum
value of (2 ** 31) - 1 or 2,147,483,647, unless you use an on size
error
clause.
Try the sample program:
IDENTIFICATION DIVISION.
PROGRAM-ID. TST.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC S9(9) COMP.
77 B PIC S9(18) COMP.
PROCEDURE DIVISION.
BEG-IT.
COMPUTE A = (2 ** 31) - 1.
MOVE A TO B.
DISPLAY "A = " A.
DISPLAY "B = " B.
STOP RUN.
When you run it you will get:
A = +147483647
B = +000000002147483647
I humbly defer to the above description. When I hit this problem, I
had to generate an unsigned 32 bit integer and write it in the same
format. I had to accept my integer from my c routine in an x(4) field
and write it to the file as such.
|
|
|