IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

OCCURS CLAUSE WITH DEPENDING ON from Endeavor


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ranjitbhingare

New User


Joined: 30 Nov 2005
Posts: 94
Location: PUNE

PostPosted: Wed Nov 01, 2006 12:51 pm
Reply with quote

Hi,

Part of copy book :
05 WS-OUTPUT-PARAMETERS OCCURS 1 TO 200 TIMES
DEPENDING ON WS-REQUEST-COUNT.
15 WSO-RETURN-CODE PIC X(04).
15 WSO-HASMORE-ROWS PIC X(01).
15 WSO-RESPONSE-COUNT PIC 9(03).
15 WSO-RESPONSE OCCURS 1 TO 30 TIMES
DEPENDING ON WSO-RESPONSE-COUNT.
20 WSO-ABC PIC X(10).
20 WSO-TYPE PIC X(10).
20 WSO-XYZ PIC X(09).

This gives me a compilation error as there is DEPENDING ON clause with in OCCURS and DEPENDING ON caluse elements.

Can anyone please give me a solution how to solve this problem ASAP ?

Please respond ASAP,
Thanks icon_cry.gif
Back to top
View user's profile Send private message
ramesh_m

New User


Joined: 27 Sep 2006
Posts: 10
Location: Sydney

PostPosted: Wed Nov 01, 2006 1:28 pm
Reply with quote

Hi,
Can you please let me know the error which you are getting
Back to top
View user's profile Send private message
ranjitbhingare

New User


Joined: 30 Nov 2005
Posts: 94
Location: PUNE

PostPosted: Wed Nov 01, 2006 1:53 pm
Reply with quote

Error MSG from Endeavor :
"OCCURS DEPENDING ON" OBJECT "WSO-RESPONSE-COUNT" WAS DEFINED AS A TABLE ELEMENT. THE "DEPENDING ON" PHRASE WAS DISCARDED.

Thanks & Regards,

Ranjit
Back to top
View user's profile Send private message
ramesh_m

New User


Joined: 27 Sep 2006
Posts: 10
Location: Sydney

PostPosted: Wed Nov 01, 2006 2:26 pm
Reply with quote

Hi,

From the error, we can't use the varriable WS-RESPONSE-COUNT in depending on clause, because it is coming under another occur clause.

I am not sure about the other solution.......
Back to top
View user's profile Send private message
ranjitbhingare

New User


Joined: 30 Nov 2005
Posts: 94
Location: PUNE

PostPosted: Wed Nov 01, 2006 2:57 pm
Reply with quote

Thanks but I am aware about that.

What I need to know if there is any other way that we can modify the copy book to use same variables with same effect.

Please help, I am stuck in this program.


icon_cry.gif
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Nov 01, 2006 7:32 pm
Reply with quote

Hi there,

What u want to modify in copybook?
Back to top
View user's profile Send private message
ranjitbhingare

New User


Joined: 30 Nov 2005
Posts: 94
Location: PUNE

PostPosted: Wed Nov 01, 2006 7:36 pm
Reply with quote

The problem is there is a variable length table within a variable length table in the given copy book.

Now I can't remove
15 WSO-RESPONSE OCCURS 1 TO 30 TIMES
DEPENDING ON WSO-RESPONSE-COUNT.
as it will change the way the varibles behave, as the given copy book is also used by some other program.

Is there anyway I can change the OCCURS clause to keep the functionality of the variable similar.
Or how to modify the given ODO clause so the program will be compiled successfully.

Please help !!!!!!!!!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Nov 01, 2006 10:16 pm
Reply with quote

If the copybook is failing to compile in your program, what makes you think the copybook will compile clean in another program?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Nov 01, 2006 10:34 pm
Reply with quote

Hi Ranjitbhingare,

Dick is right it wont wrk in any program So u dont have ne option other than modifying the copybook
Back to top
View user's profile Send private message
toddnugen

New User


Joined: 01 Nov 2006
Posts: 9

PostPosted: Thu Nov 02, 2006 7:57 am
Reply with quote

Can use no copy book or redefines it, and so the change wont affect to the rest of system. Looks like WSO-RESPONSE-COUNT needs an index.
If it cant fix, then replace it with a new data name, then change the program logic correspondingly. Good luck. icon_wink.gif
Back to top
View user's profile Send private message
ranjitbhingare

New User


Joined: 30 Nov 2005
Posts: 94
Location: PUNE

PostPosted: Thu Nov 02, 2006 11:28 am
Reply with quote

Thank you very much guys !

Finally we changed the copybook itself and removed ODO object which was causing the problem.


icon_biggrin.gif Releived.

Thanks,
Ranjit
Back to top
View user's profile Send private message
ranjitbhingare

New User


Joined: 30 Nov 2005
Posts: 94
Location: PUNE

PostPosted: Thu Nov 02, 2006 1:14 pm
Reply with quote

Hi,
Just wanted to share this.
We found a way to solve the problem :

WORKING-STORAGE SECTION.
01 WS-RESPONSE-CT PIC 9(03) VALUE ZERO.

PROCEDURE DIVISION.

MOVE WS-RESPONSE-COUNT(N) TO WS-RESPONSE-CT.

And we can use 'WS-RESPONSE OCCURS 1 to 30 TIMES DEPENDING ON WS-RESPONSE-CT " in copybook .

Regards,
Ranjit Bhingare
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Thu Nov 16, 2006 4:32 pm
Reply with quote

well guys saw this topic and was bit amazed. Think we should forgot a rule. Whenever u have to use depending on clause then the variable on which your value depends must be defined prior. For e.g

01 table1
02 ws-rec pic 99.
02 ws-fil pic x(20) occurs 1 to 200 times depending on ws-rec.

Above syntax is correct. Where as the following is not

01 table1
02 ws-fil pic x(20) occurs 1 to 200 times depending on ws-rec.
working-storage section.
01 ws-rec pic 99.
Back to top
View user's profile Send private message
vijay_bn79

New User


Joined: 20 Nov 2006
Posts: 48
Location: Hyderabad

PostPosted: Mon Nov 20, 2006 2:10 pm
Reply with quote

Hi

this may work, please try with this
i think we should give INDEXED BY as follows:-

INDEXED BY WS-INDEX

Modify this code as given below and compile again:-


05 WS-OUTPUT-PARAMETERS OCCURS 1 TO 2 TIMES
DEPENDING ON WS-REQUEST-COUNT INDEXED BY WS-INDEX.
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Wed Nov 22, 2006 1:54 pm
Reply with quote

indexed by is used when u like the organisation of table on index rather than using subscripts.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts To search DB2 table based on Conditio... DB2 1
No new posts Updating a 1 byte thats in occurs mul... DFSORT/ICETOOL 6
No new posts How can I select certain file dependi... JCL & VSAM 12
This topic is locked: you cannot edit posts or make replies. How can I select certain file dependi... Compuware & Other Tools 1
No new posts NOT IN clause in COBOL pgm COBOL Programming 8
Search our Forums:

Back to Top