Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6966
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: 6966
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us