[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Two errors of Open-Cobol 09.7-11
From: |
Enrico Ceppi |
Subject: |
[open-cobol-list] Two errors of Open-Cobol 09.7-11 |
Date: |
Wed Nov 13 13:45:05 2002 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; it-IT; rv:1.1) Gecko/20020826 |
I have downloaded Open-Cobol 0.9.7-11.
This program is not compiling.
================
*****************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. ERR01.
*****************************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
INPUT-OUTPUT SECTION.
*****************************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
77 PGM PIC X(8) VALUE 'ERR01 '.
77 FILLER PIC X.
88 YESS VALUE 'Y'.
88 NOOO VALUE 'N'.
PROCEDURE DIVISION.
MAIN.
DISPLAY PGM.
SET NOOO TO TRUE.
IF YESS DISPLAY 'YES'
ELSE DISPLAY 'NO'.
STOP RUN.
================
This program give wrong results.
================
*****************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. ERR02.
*****************************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
INPUT-OUTPUT SECTION.
*****************************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
77 PGM PIC X(8) VALUE 'ERR02 '.
77 PIC-X PIC X(8).
77 PIC-9 PIC 9(5).
PROCEDURE DIVISION.
MAIN.
DISPLAY PGM.
MOVE ' 2A' TO PIC-X.
a) MOVE PIC-X TO PIC-9.
DISPLAY 'PIC-X >' PIC-X '<'.
b) DISPLAY 'PIC-9 >' PIC-9 '<'.
c) IF PIC-9 IS NUMERIC
DISPLAY 'PIC-9 IS NUMERIC'
ELSE
DISPLAY 'PIC-9 IS NOT NUMERIC'
END-IF.
d) ADD 1 TO PIC-9.
DISPLAY 'PIC-9 >' PIC-9 '<'.
STOP RUN.
----------------------------
This is the output of pgm:
ERR02
PIC-X > 2A <
PIC-9 >00002<
PIC-9 IS NUMERIC
PIC-9 >00003<
The correct output must be:
ERR02
PIC-X > 2A <
PIC-9 > 2A <
PIC-9 IS NOT NUMERIC
Run-time error in line 28: wrong decimal data
Move a) must be permitted to permit c) test. Display b) must show the
field. Every aritmetic operation must break the program with an error. A
move of PIC-9 in a field pic-edited (ZZ.ZZZ, for example) must give
error, too.
================
Thank you, and sorry for my english!
Enrico Ceppi
- [open-cobol-list] Two errors of Open-Cobol 09.7-11,
Enrico Ceppi <=