Subject: | |
From: | |
Reply To: | |
Date: | Fri, 17 Dec 1999 08:57:29 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
JIM McINTOSH wrote:
> Hello.
>
> Please consider the following code. The result is that DATE-ERR-NUM is
not
> equal to ZERO. When the picture is changed to PIC 9(4) (without the
> negative sign), the result is that DATE-ERR-NUM is equal to ZERO. The
> question is: has it always been thus? Thanks in advance.
>
> $CONTROL VALIDATE,BOUNDS,CMCALL
> IDENTIFICATION DIVISION.
> PROGRAM-ID. JCMTESTC.
> AUTHOR. JC MCINTOSH.
> DATE-WRITTEN. DECEMBER 1999.
> DATE-COMPILED.
> REMARKS.
>
> ENVIRONMENT DIVISION.
> CONFIGURATION SECTION.
> SOURCE-COMPUTER. HP-3000.
> OBJECT-COMPUTER. HP-3000.
>
> DATA DIVISION.
> WORKING-STORAGE SECTION.
>
> 01 DATE-ERR-NUM PIC 9(4)-.
When I change the "PIC 9(4)-" to "PIC S9(4)-", I get:
00030 002600 41 140 Q MULTIPLE SIGN DESIGNATORS IN PICTURE.
so I am assuming you mean that S9(4) works and 9(4)- does not.
I think your problem is that a PIC 9(4)- (which is equivalent to PIC 9999-)
is an edited numeric field (like PIC ZZZ9 or PIC $,$$9.99). In the COBOL
manual it says that a minus sign will insert a "-" or a blank, depending on
the sign of the value moved to the field. Since the field will always be
edited, no matter what numeric value is moved to it, it will never be equal
to the figurative constant "zeroes". Incidentally, since this is an edited
field you cannot use it for calculations either.
You may want to use PIC S9(4) SIGN IS TRAILING SEPARATE CHARACTER, which
would give you a numeric data item of five bytes length, with the sign in
the fith position.
Jim Phillips Manager of Information Systems
E-Mail: [log in to unmask] Therm-O-Link, Inc.
Phone: (330) 527-2124 P. O. Box 285
Fax: (330) 527-2123 Garrettsville, Ohio 44231
|
|
|