Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

OCCURS CLAUSE WITH DEPENDING ON from Endeavor

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: OCCURS CLAUSE WITH DEPENDING ON from Endeavor
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    Post subject: Re: OCCURS CLAUSE WITH DEPENDING ON : Please respond ASAP
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    Post subject:
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    Post subject:
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    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Wed Nov 01, 2006 7:32 pm    Post subject:
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    Post subject:
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    Post subject: Re: OCCURS CLAUSE WITH DEPENDING ON : Please respond ASAP
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: 1187
Location: Bangalore,India

PostPosted: Wed Nov 01, 2006 10:34 pm    Post subject:
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    Post subject: Re: OCCURS CLAUSE WITH DEPENDING ON : Please respond ASAP
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: OCCURS CLAUSE WITH DEPENDING ON
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Add Trailing Zeroes depending upon th... Rohit Umarjikar DFSORT/ICETOOL 3 Fri Oct 23, 2015 1:47 am
No new posts [SQL0029] INTO clause missing from em... HABBIE DB2 2 Fri Sep 04, 2015 3:54 pm
No new posts Multiple OCCURS depending on in same ... muralirajansm COBOL Programming 6 Fri Aug 21, 2015 4:23 pm
No new posts 3-D Table with nested DEPENDING ON Cl... VivekKhanna COBOL Programming 5 Sat Aug 08, 2015 11:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us