View previous topic :: View next topic |
Author |
Message |
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Fri Sep 26, 2008 9:02 am Post subject: ODO Associated Variable |
|
|
Aware of what ODO (Occurs Depending On) does but I have never used it without populating the associated variable. I came across some working programs which do not populate the associated variabale and wanted some clarifications.
Ex :
01 WS-ODO-1 Occurs 0 to 1 Times Depending on WS-COUNT.
05 SSN PIC X(9).
05 ........
Now if nothing is moved to WS-COUNT but the elementary items are populated for subscript 1 of the table....as.......
MOVE WS-SSN TO SSN (1)
1) Is this statement as good as MOVE 1 to WS-COUNT and thats how it works ?
2) If 0 were to be specifically moved to WS-COUNT would the table not be allocated in memory at all ?
3) What if there is conflict between the WS-COUNT value and last subscript value to which data is moved to ? Will the last subscipt value automatically over-ride the WS-COUNT ?
I have gone through some posts but could not find this level of detail. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Sep 26, 2008 9:12 am Post subject: |
|
|
don't think you can put an occurs clause on a 01 level.
but anyway,
cobol will not inhibit the direct accessing of an item greater than ws-count.
but, if you try to move the table (group item)
then the compiler will generate lengths based on the ws-count
or
search all will only search the number of occurances based on the current value of ws-count. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Fri Sep 26, 2008 9:21 am Post subject: |
|
|
Dick,
I agree about the 01 and that was a mistake in citing the ex. the compiler is smart and points out such errors .
The question still remains ...how do these ODOs work without the ws-counts being populated ? |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Sep 26, 2008 9:32 am Post subject: |
|
|
the ODO only means something when
the length of the table
or
the number of occurances is required:
- Group MOVE
- Search ALL
- usage of an INDEX-ITEM (cobol term for the variable declared in a OCCURS ..... INDEXED BY var.
Use of subscripts is not dependent on the value contained in the ODO object (WS-COUNT). _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Fri Sep 26, 2008 9:43 am Post subject: |
|
|
Quote: |
"the ODO only means something when
the length of the table
or
the number of occurances is required:"
|
Does this mean if we were to display WS-COUNT even though we have not specifically moved anything to WS-COUNT ...it would display 1 as in cited example ? |
|
Back to top |
|
|
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Sun Sep 28, 2008 3:47 pm Post subject: |
|
|
No. WS-COUNT would be displayed as whatever it's value is, regardless of what you've moved into the table. Also, you'll probably S0C7 if WS-COUNT is not numeric when you attempt to display it. _________________ ....Terry |
|
Back to top |
|
|
|
|