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 ...

Follow-Ups:
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.