Just a quick followup.

The error message shown below is from the OPM compiler, which goes ahead and
creates the program in spite of the warning message.

Using the ILE compiler results in a similar message, but it is an error
message not a warning message. That means the program will NOT be created.


Richard


-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Richard Casey
Sent: Monday, December 15, 2008 10:02 AM
To: 'COBOL Programming on the iSeries/AS400'
Subject: Re: [COBOL400-L] Initializing tabels

Without a subscript for WS-TABLE, the compiler doesn't know which occurrence
you want, so it defaults to using the first one.

For:

INITIALIZE WS-TABLE

the compiler reports the following error:

Message . . . . : 'WS-TABLE' table item but not subscripted. First
occurrence used.


If you used a higher level field that included the table, i.e.

01 WS-TEST.
05 WS-TABLE OCCURS 10.
10 WS-ELEM PIC 9.

and did an INITIALIZE WS-TEST, you would initialize all 10 occurrences of
WS-ELEM to zero.

Have fun!
Richard


-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mike Apice
Sent: Monday, December 15, 2008 9:33 AM
To: COBOL Programming on the iSeries/AS400
Subject: Re: [COBOL400-L] Initializing tabels

I am curiuos too.  I see no reason why that should not work.

--- On Mon, 12/15/08, geir.kildal@xxxxxxxxxx <geir.kildal@xxxxxxxxxx> wrote:

From: geir.kildal@xxxxxxxxxx <geir.kildal@xxxxxxxxxx>
Subject: [COBOL400-L] Initializing tabels
To: cobol400-l@xxxxxxxxxxxx
Date: Monday, December 15, 2008, 8:25 AM

Hi.

Given:

05 ws-tabel occurs 10.
10 ws-elem pic 9.

I expected all 10 ws-elem to be set to zero when 'INITIALIZE ws-table'
was executed. Only ws-elem(1) is set to zero.

What am I doing wrong?


Mvh.

Geir Kildal.

"Keep it simple!"


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.