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

COBOL compiler error


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Wed Jun 18, 2008 11:33 pm
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
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

Moderator Emeritus


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

PostPosted: Wed Jun 18, 2008 11:44 pm
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
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

Moderator Emeritus


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

PostPosted: Thu Jun 19, 2008 12:48 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Error when install DB2 DB2 2
Search our Forums:

Back to Top