HP3000-L Archives

December 1999, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tracy Pierce <[log in to unmask]>
Reply To:
Tracy Pierce <[log in to unmask]>
Date:
Fri, 17 Dec 1999 07:50:44 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (62 lines)
The use of the trailing (or leading) minus sign in this picture clause
changes the data item from numeric to editted-numeric, which is not really
numeric.  Your MOVE ZERO to this field results in "0000 ", which is not
"ZERO", which is a valid comparator for an alphanumeric field, which will
return true if all digits are zero.

I'd recommend the use of PIC S9(4) COMP for this field.

I'm sure I'll hear about how my explanation is not 100%!

> -----Original Message-----
> From: HP-3000 Systems Discussion [mailto:[log in to unmask]]On
> Behalf Of JIM McINTOSH
> Sent: Thursday, December 16, 1999 5:00 PM
> To: [log in to unmask]
> Subject: Use of PIC 9(4)- in COBOL
>
>
> 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)-.
>
>  PROCEDURE DIVISION.
>  00-MAIN.
>      MOVE ZERO TO DATE-ERR-NUM.
>
>      IF DATE-ERR-NUM NOT = ZERO
>        DISPLAY "NOT ZERO " DATE-ERR-NUM
>      ELSE
>        DISPLAY "ZERO     " DATE-ERR-NUM
>      END-IF.
>
>      STOP RUN.
>
> Jim McIntosh
> Professional Data System, Inc.
> (206) 789-5163
> [log in to unmask]
>

ATOM RSS1 RSS2