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
 

 

COBOL compiler error

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
madhusudan

New User


Joined: 13 Dec 2004
Posts: 3

PostPosted: Wed Jun 18, 2008 11:29 pm    Post subject: COBOL compiler error
Reply with quote

Hi,

could you please tell me what is the 'replacement' code for

PROCEDURE DIVISION USING DATA-FORWARDED.
ON 1 PERFORM 00000-INITIALIZATION THRU 00000-INIT-EXIT.
GO TO 00000-MAINLINE-ROUTINE.



this is older version of cobol. when i am compiling this with new version (enterprise) its failing at "ON". i am in the middle of converting the code to suit the new version of Cobol. any suggestions or help is much appreciated.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 18, 2008 11:33 pm    Post subject:
Reply with quote

Hello madhusudan and welcome to the forums,

Create a counter in ws.

Add 1 to the counter and compare the counter in place of the "ON" (if counter not = zero, PERFORM).

This can be used for other ON values as well (i.e. on 100) which may be more useful than a simple off/on indicator.
Back to top
View user's profile Send private message
madhusudan

New User


Joined: 13 Dec 2004
Posts: 3

PostPosted: Wed Jun 18, 2008 11:40 pm    Post subject:
Reply with quote

hi, thanks for the quick reply.

this is a called program and what i beleive is
to execute the "00000-INITIALIZATION " paragraph only the first time this pgm is called. this para has just couple of OPEN statements. i think this way there are not many I/Os. so files are opened only once!
so how do i go about accomplishing this ?
much thx
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 18, 2008 11:44 pm    Post subject:
Reply with quote

Hello,

If this will be called repeatedly, change the IF to compare for 1 rather than not= zero.

The obsolete ON instruction created an invisable counter and incremented this counter each time the ON was excuted. You will be doing the same thing explicitly with the counter and the ADD.
Back to top
View user's profile Send private message
madhusudan

New User


Joined: 13 Dec 2004
Posts: 3

PostPosted: Wed Jun 18, 2008 11:52 pm    Post subject:
Reply with quote

kindly correct me if am wrong.

you mean to say have a working storage variable, say ws-counter.and whenever this counter = 1 perform this para else skip?

but then this pgm is called by 8 other programs and each time the control is passed to the main program, the variables are RESET right, as it is a local variable?

i just want to avoid changing all the 8 calling programs by having global variables !
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jun 19, 2008 12:48 am    Post subject:
Reply with quote

Hello,

Quote:
the variables are RESET right, as it is a local variable?
The value used processing ON would be a local variable as well, would it not?

It should not be difficult to set up a test to determine whether your called module "remembers" or is reset in your current environment.

If you search the forum (COBOL), there has been recent discussion about this. There are ways to explicitly reset or retain the variables in the called program.
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am


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