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

COBOL statement 'ON 1'


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
senthilarumugam

New User


Joined: 09 May 2006
Posts: 19
Location: chennai

PostPosted: Mon Sep 22, 2008 11:50 am
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Sep 22, 2008 12:14 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Sep 22, 2008 1:35 pm
Reply with quote

Hello,

The below links might help.

See the description on "ON" at the bottom of the page.
docs.hp.com/cgi-bin/doc3k/BB243390047.15064/57

ibmmainframes.com/post-60005.html

Thanks,
Arun
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Sep 22, 2008 1:43 pm
Reply with quote

Senthil,

See this one too - ibmmainframes.com/about32786.html

Thanks,
Arun
Back to top
View user's profile Send private message
sureshbabur

New User


Joined: 11 Aug 2008
Posts: 8
Location: chennai

PostPosted: Mon Sep 22, 2008 2:47 pm
Reply with quote

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
View user's profile Send private message
senthilarumugam

New User


Joined: 09 May 2006
Posts: 19
Location: chennai

PostPosted: Mon Sep 22, 2008 3:46 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Sep 22, 2008 7:18 pm
Reply with quote

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
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 COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top