The sign condition determines whether or not the algebraic value of an operand is positive, negative or zero. The operand can be either a numeric identifier or an arithmetic expression.
The format of this condition is as follows:
Example:
77 BALANCE PIC S9(6)V99. . .
77 BALANCE IS ZERO GO TO NIL-BALANCE.
Example program
IDENTIFICATION DIVISION.
PROGRAM-ID. SIGN.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC S9(3).
PROCEDURE DIVISION.
PARA-1.
DISPLAY “ENTER A VALUE”.
ACCEPT A.
PARA-2.
IF A IS POSITIVE
DISPLAY “GIVEN NO IS POSITIVE”.
ELSE IF A IS ZERO
DISPLAY “GIVEN NO IS ZERO”.
ELSE
DISPLAY “GIVEN NO IS NEGATIVE”.
STOP RUN.
Friday, 12 December 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment