Menu

Exemplo:

Programa para demonstrar a condição do sinal

IDENTIFICATION DIVISION.
PROGRAM-ID. SIGCCOBL.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 N1 PIC S9(9) VALUE -678.
01 N2 PIC S9(9) VALUE 78923.

PROCEDURE DIVISION.
A000-FIRST-PARA.
    IF N1 IS POSITIVE THEN
       DISPLAY 'NUMBER-1 IS POSITIVE'.

    IF N1 IS NEGATIVE THEN
       DISPLAY 'NUMBER-1 IS NEGATIVE'.

    IF N1 IS ZERO THEN
       DISPLAY 'NUMBER-1 IS ZERO'.

    IF N2 IS NEGATIVE THEN
       DISPLAY 'NUMBER-2 IS NEGATIVE'.

    IF N2 IS POSITIVE THEN
       DISPLAY 'NUMBER-2 IS POSITIVE'.

    STOP RUN.

Quando você compila e executa o programa acima, ele produz o seguinte resultado -

Resultado:

NUMBER-1 IS NEGATIVE
NUMBER-2 IS POSITIVE