View previous topic :: View next topic |
Author |
Message |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Mon Jun 19, 2006 9:19 am Post subject: OCCURS ..DEPENDING ON |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Mon Jun 19, 2006 9:26 am Post subject: |
|
|
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 |
|
 |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Mon Jun 19, 2006 9:31 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Mon Jun 19, 2006 10:40 am Post subject: |
|
|
Thanks Kolusu. Its clear now. |
|
Back to top |
|
 |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Tue Jun 20, 2006 5:06 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Tue Jun 20, 2006 7:18 am Post subject: |
|
|
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 |
|
 |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Tue Jun 20, 2006 7:59 am Post subject: |
|
|
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 |
|
 |
calspach Beginner
Joined: 12 Jun 2006 Posts: 5 Topics: 0
|
Posted: Tue Jun 20, 2006 8:31 am Post subject: |
|
|
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 |
|
 |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Tue Jun 20, 2006 9:41 am Post subject: |
|
|
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 |
|
 |
|
|