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 statement 'ON 1'

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: COBOL statement 'ON 1'
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

Senior Member


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

PostPosted: Mon Sep 22, 2008 12:14 pm    Post subject:
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: 2239
Location: @my desk

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

Hello,

The below links might help.

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

http://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: 2239
Location: @my desk

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

Senthil,

See this one too - http://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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Sep 22, 2008 7:18 pm    Post subject:
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    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 SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm


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