MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dynamic Arrays

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
HB0
Beginner


Joined: 20 Apr 2005
Posts: 25
Topics: 7

PostPosted: Mon May 16, 2005 7:21 am    Post subject: Dynamic Arrays Reply with quote

Hello,

What are Dynamic arrays and how can they be created ? In what situations do we use these ? I didnot know which manual would help me in the whole Cobol list ? Any help is appreciated.

Thanks,
HB0.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon May 16, 2005 7:36 am    Post subject: Reply with quote

HBo,


In COBOL Arrays are basically Static. However you can define a varying array using OCCURS DEPENDING ON .

Check this link which explains in detail about Creating variable-length tables (DEPENDING ON)

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.4.5?DT=20020923143836

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HB0
Beginner


Joined: 20 Apr 2005
Posts: 25
Topics: 7

PostPosted: Tue May 17, 2005 2:31 am    Post subject: Reply with quote

Thanks Kolusu.

HB0.
Back to top
View user's profile Send private message
syam
Beginner


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Sat Dec 30, 2006 8:58 am    Post subject: Reply with quote

My working storage declarations for the array and another group element declarations are
Code:

05 WS-SEL-VALUE                             PIC 9(03).         
05 WS-SEL-ARRAY.                                               
   10 WS-SEL-REC  OCCURS 1 TO 100 TIMES DEPENDING ON           
                                         WS-SEL-VALUE       PIC X(02).         
05 WS-DATE.                                                   
   10 WS-DD                                 PIC 9(02).         
   10 FILLER                                PIC X(01) VALUE   
                                                SPACES.       
   10 WS-MM                                 PIC X(02).         
   10 FILLER                                PIC X(01) VALUE   
                                                SPACES.       
   10 WS-YY                                 PIC 9(02).         


and this is my compilation output
Code:

00089     05 WS-DATE.                                                   ö
00090        10 WS-DD                                 PIC 9(02).        ö
00091        10 FILLER                                PIC X(01) VALUE   ö
                                                                         
1109-S A "VALUE" CLAUSE WAS SPECIFIED FOR VARIABLY LOCATED ITEM "FILLER".
       "VALUE" CLAUSE WAS DISCARDED.                                     
                                                                         
00092                                                     SPACES.       ö
00093        10 WS-MM                                 PIC X(02).        ö
00094        10 FILLER                                PIC X(01) VALUE   ö
                                                                         
1109-S A "VALUE" CLAUSE WAS SPECIFIED FOR VARIABLY LOCATED ITEM "FILLER".
       "VALUE" CLAUSE WAS DISCARDED.                                     

if i comment the occurs clause declaration it is not throwing error. What might be the possible reason??? and what are the changes i have to make so that the program compiles without errors
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Sat Dec 30, 2006 1:52 pm    Post subject: Reply with quote

The reason is described in the error message itself; you can't specify a value clause in a variably located item.

Remove the value clauses, and all should be well.
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Sat Dec 30, 2006 9:21 pm    Post subject: Reply with quote

change:
Code:

10 WS-SEL-REC  OCCURS 1 TO 100 TIMES DEPENDING ON           
                                         WS-SEL-VALUE

to this:
Code:

10 WS-SEL-REC  OCCURS 100 TIMES.


and maintain a counter for the table and ws-date will be in a fixed location.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group