IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

problem with INITIALIZEING Variable length array.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Sun Aug 30, 2009 3:02 pm
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
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: 6966
Location: porcelain throne

PostPosted: Sun Aug 30, 2009 6:18 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top