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 

OCCURS ..DEPENDING ON

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


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Mon Jun 19, 2006 9:19 am    Post subject: OCCURS ..DEPENDING ON Reply with quote

Hello,

In the following Table declaration, I am using OCCURS for 200 TIMES while the value of WC-MAX-NO-OF-PROD is 100.

05 WT-BILL-ACCT-TABLE OCCURS 1 TO 200 TIMES
DEPENDING
ON WC-MAX-NO-OF-PROD.
10 WT-BILL-ACCT-NO PIC X(016).
10 WT-BUS-TYP-COD PIC X(005).

Will it make any difference? Yes, thaen what?
In my final output, I just want to see 100 entries but right now it is displaying upto 200. Is it something due to this table declaration or I need to fix this bug in the code ?

Regards
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jun 19, 2006 9:26 am    Post subject: Reply with quote

Nancy,


Quote:

Will it make any difference? Yes, thaen what?


It will not make any difference as the program allocates the storage for the 200 occurances.

Quote:

In my final output, I just want to see 100 entries but right now it is displaying upto 200.


What do you mean it is diaplaying upto 200? How are you displaying the values? Are you checking for the WC-MAX-NO-OF-PROD while displaying?

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


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Mon Jun 19, 2006 9:31 am    Post subject: Reply with quote

Kolusu,
It might be the code bug but what I want to know is that if the table can really have 200 items even if the DEPENDING ON has a variable that can contain just 100 ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jun 19, 2006 10:03 am    Post subject: Reply with quote

Nancy,

The contents of WT-BILL-ACCT-NO & WT-BUS-TYP-COD items whose occurrence numbers exceed the value of the WC-MAX-NO-OF-PROD( 100 in your case ) are undefined

Check this link which explains the OCCURS DEPENDING in detail

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR10/5.3.10.5?SHELF=&DT=20020920180651&CASE=

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
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Mon Jun 19, 2006 10:40 am    Post subject: Reply with quote

Thanks Kolusu. Its clear now.
Back to top
View user's profile Send private message
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Tue Jun 20, 2006 5:06 am    Post subject: Reply with quote

Kolusu,

I have one more doubt.

10 SIBRU503-ACCT-ARRAY.
15 SIBRU503-ACCT-LIST OCCURS 0 TO 100
DEPENDING ON SIBRU503-NO-OF-ACCT.
20 SIBRU503-ACNO PIC X(022).
20 SIBRU503-ACCT-SHRT-DESC PIC X(030).
20 SIBRU503-ACCT-TYP PIC X(003).
20 SIBRU503-RBA PIC X(022).

In the same program, this array should not have more than 100 items as per the OCCURS clause but if SIBRU503-NO-OF-ACCT has the value more than 100 say 110, then we are getting all the 110 accounts with the correct information of ACNO, ACCT-SHRT-DESC etc in output. Why it is so?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 20, 2006 7:18 am    Post subject: Reply with quote

Nancy,

Are you sure you are having 110 occurance despite the table being declared as max of 100 occurances? Did the pgm even compile? I am sure the compiler throws an error if you are try to load the table beyond max occurance.

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


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Tue Jun 20, 2006 7:59 am    Post subject: Reply with quote

Yeah, I was expecting that but it did not happen and I got 110 accounts back. Just want to confirm if it is possible with this declaration.
Back to top
View user's profile Send private message
calspach
Beginner


Joined: 12 Jun 2006
Posts: 5
Topics: 0

PostPosted: Tue Jun 20, 2006 8:31 am    Post subject: Reply with quote

It's not supposed to be. I'd say you have a compiler option turned off that should be on. I wish I could tell you which one. But, what is most likely happening since you are getting the data is that the data is overwriting whatever follows that declaration in working storage. In this case that may be ok, but it's surely not a good idea.
Back to top
View user's profile Send private message
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Tue Jun 20, 2006 9:41 am    Post subject: Reply with quote

Right. Just now I noticed that it is NOSSRANGE in my compiler option instead of SSRANGE to have the subscript values checked at run time to see if they are in range. I should get S0C4 if it is more than 100 accounts.

Thanks for your help.
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