View previous topic :: View next topic
|
Author |
Message |
senthilarumugam
New User
Joined: 09 May 2006 Posts: 19 Location: chennai
|
|
|
|
Hi,
I have come across a COBOL code as like below. Could anyone please explain me what the 'ON 1' statement do?
ON 1
PERFORM XX-XX
ELSE
PERFORM YY-YY. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Senthil,
Please post a little more scrap from your code where you see this code, I'm not aware of "ON 1" usage in IBM Mainfrmae COBOL, do you have any idea what the program is doing ? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
Back to top |
|
|
sureshbabur
New User
Joined: 11 Aug 2008 Posts: 8 Location: chennai
|
|
|
|
Okay i do accept it will executed only once in the program.....but i have one doubt in the coding
ON 1
PERFORM XX-XX
ELSE
PERFORM YY-YY.
in the above coding when it's first time processing the para XX-XX will be executed.Then while processing the second record where the control will go .please tell me know the result.
Thanks
Suresh |
|
Back to top |
|
|
senthilarumugam
New User
Joined: 09 May 2006 Posts: 19 Location: chennai
|
|
|
|
Thank you folks!
Suresh,
When you code ON 1 in your paragraph, ON first time execution XX-XX will be performed. When the same paragraph being executed next times, YY-YY will be performed. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
When you code ON 1 in your paragraph, ON first time execution XX-XX will be performed |
No longer. Several releases ago (of the mainframe compiler) ON was removed from the syntax/language.
I suggest you try to compile with the code before you plan on using it. Once upon a time, it was often used for testing or as a first-time switch. |
|
Back to top |
|
|
|