gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [open-cobol-list] runtime error with open cobol


From: William M. Klein
Subject: RE: [open-cobol-list] runtime error with open cobol
Date: Tue Feb 17 16:22:22 2004

The definition of
   AW-SYSUT1-WA1.

is "illegal" according to the '85 (and 2002) ANSI Standard.  This is because
there is an ODO (Occurs Depending On) tjat fp;;pws amptjer ODO within the
SAME 01-level.  This is documented as an IBM extension at:
 
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR10/APPENDIX
1.1 

with the description,

"Complex OCCURS DEPENDING ON
[Standard COBOL requires that an entry containing OCCURS DEPENDING ON be
followed        only by subordinate entries, and that no entry containing
OCCURS DEPENDING ON be           subordinate to an entry containing OCCURS
DEPENDING ON.]"

However, the really "tricky" part of this is that exactly HOW this works is
NOT consistent across IBM mainframe COBOLs.  See (for example) the topic,

"OCCURS DEPENDING ON clause--value for receiving items changed"
at:
 http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3mg10/4.1.7 

You might also want to compare this with the "Substantive change potentially
effecting" number 8 on page XVII-55 on the '85 Standard.

Bottom-Line:
  Behavior of complex ODO (as an extension to the ANSI/ISO Standards) needs
to be VERY sensitive to EXACTLY what extension is being emulated (different
compilers give different results - and each implementor may LEGALLY define
whatever extension they want)

> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden On 
> Behalf Of David Korn
> Sent: Tuesday, February 17, 2004 5:43 PM
> To: address@hidden; address@hidden
> Subject: [open-cobol-list] runtime error with open cobol
> 
> cc:  address@hidden
> Subject: runtime error with open cobol
> --------
> 
> I have enclosed a program below that produces different results
> with openCobol and IBM MVS Cobol.  I was told that the IBM
> version is correct.
> 
> The output with IBM is
> ================cut here=======================
>  *** TEST RUN ***
> AW-SYSUT1-WA1 =  01  QD2E-FILE-ACS-REQST-REC.
> 
> AW-SYSUT1-WA2 =  01  QD2E-FILE-ACS-REQST-REC.
> 
> 1 AW-SYSUT1-WA1-A =  01  QD2E-FILE-ACS-REQST-REC.
> 1 AW-SYSUT1-WA1-B =
> 2 AW-SYSUT1-WA1-A =  01
> 2 AW-SYSUT1-WA1-B = QD2E-
> ================cut here=======================
> 
> and with OpenCobol
> 
> ================cut here=======================
> AW-SYSUT1-WA1 =  01  QD2E-FILE-ACS-REQST-REC.                 
>                     
> AW-SYSUT1-WA2 =  01  QD2E-FILE-ACS-REQST-REC.                 
>                                                               
>                                                       
> 1 AW-SYSUT1-WA1-A =  01  QD2E-FILE-ACS-REQST-REC.             
>                         
> 1 AW-SYSUT1-WA1-B =                               
> 2 AW-SYSUT1-WA1-A =  01  
> 2 AW-SYSUT1-WA1-B =
> ================cut here=======================
> 
> Note that the last line differs.
> 
> 
> =====================Here is the program 
> prog9.cob=========================
>        IDENTIFICATION DIVISION.
>        PROGRAM-ID.     PROG9.
>        DATA DIVISION.
>        WORKING-STORAGE SECTION.
>        01  SM-DISPLACEMENT-CELLS.
>            05  SM-SYSUT1-WA1-A         PIC S9(5)  VALUE 66   COMP.
>            05  SM-SYSUT1-WA1-B         PIC S9(5)  VALUE 30   COMP.
>            05  SM-SYSUT1-WA1-C         PIC S9(5)  VALUE 30   COMP.
>            05  SM-SYSUT1-WA1-X         PIC S9(5)  VALUE 66   COMP.
>            05  SM-SYSUT2-WA1-A         PIC S9(5)  VALUE 66   COMP.
>            05  SM-SYSUT2-WA1-B         PIC S9(5)  VALUE 30   COMP.
>            05  SM-SYSUT2-WA1-C         PIC S9(5)  VALUE 30   COMP.
>            05  SM-SYSUT2-WA1-X         PIC S9(5)  VALUE 66   COMP.
> 
>        01  AW-ARG-COMPARE-AREA.
>            05  AW-CARD-DATA            PIC X(30)  VALUE SPACES.
> 
>        01  AW-ARG-AREA.
>            05  AW-ARG-LENGTH           PIC S9(5)  VALUE ZERO COMP.
> 
>         01  AW-SYSUT1-WA1.
>             05  AW-SYSUT1-WA1-A.
>                 10  AW-INWA1-A          PIC X      OCCURS 0 
> TO 66 TIMES
>                                            DEPENDING ON 
> SM-SYSUT1-WA1-A.
>             05  AW-SYSUT1-WA1-B.
>                 10  AW-INWA1-B          PIC X      OCCURS 0 
> TO 30 TIMES
>                                           DEPENDING ON 
> SM-SYSUT1-WA1-B.
>             05  AW-SYSUT1-WA1-C.
>                 10  AW-INWA1-C          PIC X      OCCURS 0 
> TO 66 TIMES
>                                           DEPENDING ON 
> SM-SYSUT1-WA1-C.
> 
>        01  AW-SYSUT1-WA1-TRAILER       PIC X(162) VALUE SPACES.
> 
>        01  AW-SYSUT1-WA2.
>            05  AW-SYSUT1-WA2-BYTE      PIC X      OCCURS 162 TIMES
>                                         INDEXED BY IX-AW-SYSUT1-BYTE.
>        01  AW-SYSUT2-WA1.
>             05  AW-SYSUT2-WA1-A.
>                 10  AW-OTWA1-A          PIC X      OCCURS 0 
> TO 66 TIMES
>                                            DEPENDING ON 
> SM-SYSUT2-WA1-A.
>             05  AW-SYSUT2-WA1-B.
>                 10  AW-OTWA1-B          PIC X      OCCURS 0 
> TO 30 TIMES
>                                           DEPENDING ON 
> SM-SYSUT2-WA1-B.
>             05  AW-SYSUT1-WA1-C.
>                 10  AW-OTWA1-C          PIC X      OCCURS 0 
> TO 66 TIMES
>                                           DEPENDING ON 
> SM-SYSUT2-WA1-C.
> 
>        01  AW-SYSUT1-WA2-TRAILER       PIC X(162) VALUE SPACES.
> 
> 
>        PROCEDURE DIVISION.
>            DISPLAY ' *** TEST RUN ***'
>            MOVE ' 01  QD2E-FILE-ACS-REQST-REC.' TO AW-SYSUT1-WA1
>                                                    AW-SYSUT1-WA2.
>            DISPLAY 'AW-SYSUT1-WA1 = ' AW-SYSUT1-WA1
>            DISPLAY 'AW-SYSUT1-WA2 = ' AW-SYSUT1-WA2
> 
>            MOVE 6  TO SM-SYSUT1-WA1-X.
>            SET  IX-AW-SYSUT1-BYTE TO 6.
>            DISPLAY '1 AW-SYSUT1-WA1-A = '  AW-SYSUT1-WA1-A
>            DISPLAY '1 AW-SYSUT1-WA1-B = '  AW-SYSUT1-WA1-B
>            COMPUTE SM-SYSUT1-WA1-A = SM-SYSUT1-WA1-X - 1
>            MOVE 5               TO SM-SYSUT1-WA1-B
>            DISPLAY '2 AW-SYSUT1-WA1-A = '  AW-SYSUT1-WA1-A
>            DISPLAY '2 AW-SYSUT1-WA1-B = '  AW-SYSUT1-WA1-B
>            MOVE AW-SYSUT1-WA1-B TO AW-CARD-DATA.
>            GOBACK.
> =====================cut here=========================
> 
> David Korn
> address@hidden
> 
> 
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]