Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
problem with INITIALIZEING Variable length array.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Amsar

New User


Joined: 26 Sep 2008
Posts: 84
Location: Chennai

PostPosted: Sun Aug 30, 2009 11:57 am    Post subject: problem with INITIALIZEING Variable length array.
Reply with quote

Hi All,

I have array defined as

01 WS-ARRAY1.
05 WS-CACT-ARRAY OCCURS 0 TO 500 TIMES DEPENDING
ON WS-VAR INDEXED BY WS-C1.
10 WS-CACT-NUM PIC S9(9) COMP.
10 WS-CACT-FLAG PIC X(01).

I am Initalizing array as INITIALIZE WS-ARRAY1.

I am getting error while compilation

IGYPS2142-E - WS-ARRAY1" was found in an "INITIALIZE" statement but was variable-length or variably located The operand was discarded from the "INITIALIZE" statement.

Can anybody help me to resolve this issue?


Thanks,
Amsar
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Sun Aug 30, 2009 3:02 pm    Post subject:
Reply with quote

yes I can help you. the application programmers guide states:

Quote:
The INITIALIZE statement cannot assign values to a variable-length table (that is, a table that was defined using the OCCURS DEPENDING ON clause).


you could move low-values to WS-ARRAY1 and treat WS-CACT-FLAG = low-values as valid data - meaning unused.

you could perform varying and
INITIALIZE WS-CACT-NUM(WS-C1) WS-CACT-FLAG(WS-C1).

or, as you increment WS-VAR and the index WS-C1, you could initialize the item then.
that way you do not initialize anything that you don't need to use.
Back to top
View user's profile Send private message
Amsar

New User


Joined: 26 Sep 2008
Posts: 84
Location: Chennai

PostPosted: Sun Aug 30, 2009 3:32 pm    Post subject:
Reply with quote

Hi Dick,

Thanks for your reply.

Quote:
and treat WS-CACT-FLAG = low-values as valid data - meaning unused.


i didn't get what you mean by this, but i need to check this flag value ( can be 'Y' or 'N') to do the further processing in the program.


Thanks,
Amsar
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Sun Aug 30, 2009 6:18 pm    Post subject:
Reply with quote

instead of having a Y or N, have a Y or low-values.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us