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 

ODO Associated Variable

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


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri Sep 26, 2008 9:02 am    Post subject: ODO Associated Variable Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Fri Sep 26, 2008 9:12 am    Post subject: Reply with quote

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
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri Sep 26, 2008 9:21 am    Post subject: Reply with quote

Dick,
I agree about the 01 and that was a mistake in citing the ex. the compiler is smart and points out such errors Smile.
The question still remains ...how do these ODOs work without the ws-counts being populated ?
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Fri Sep 26, 2008 9:32 am    Post subject: Reply with quote

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
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri Sep 26, 2008 9:43 am    Post subject: Reply with quote

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
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Sun Sep 28, 2008 3:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
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