View previous topic :: View next topic
|
Author |
Message |
madhusudan
New User
Joined: 13 Dec 2004 Posts: 3
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
madhusudan
New User
Joined: 13 Dec 2004 Posts: 3
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
madhusudan
New User
Joined: 13 Dec 2004 Posts: 3
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|