Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
cobol statment starting with ON

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Dhanya Praju

New User


Joined: 16 Jul 2008
Posts: 10
Location: Banglaore

PostPosted: Fri Jul 25, 2008 1:35 pm    Post subject: cobol statment starting with ON
Reply with quote

hi,

One existing program has a cobol statment stating with On.
The statment is like

1000-Para.
ON 1
MOVE A to B
GOTO ABC.
Move B to C.

1000-exit-para.

when I try compiling I am getting the compilation error
" "ON" was invalid. Skipped to the next verb, period or procedure-name definition"

Please help
Back to top
View user's profile Send private message

sedireswarapu

New User


Joined: 18 Jun 2008
Posts: 28
Location: India

PostPosted: Fri Jul 25, 2008 4:00 pm    Post subject:
Reply with quote

Hi,

I could only get the below information about ON statement. Hope this could be of some use for you.

ON Statement -
OS/VS COBOL accepts the ON statement. IBM COBOL does not
accept the ON statement.
The ON statement allows selective execution of statements it contains.
Similar functions are provided in IBM COBOL by the EVALUATE statement
and the IF statement.
Back to top
View user's profile Send private message
Dhanya Praju

New User


Joined: 16 Jul 2008
Posts: 10
Location: Banglaore

PostPosted: Fri Jul 25, 2008 4:14 pm    Post subject:
Reply with quote

But in this case in which case this on 1 is setting to true? what is this ON 1 evaluating for?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Fri Jul 25, 2008 5:13 pm    Post subject:
Reply with quote

Hi !

It's an very old trigger implemented in earlier releases of cobol.
It,s a trigger do to only a action once during the programm.
For example, do an OpenDataset only the first time you come into that section. One-1 will trigger that automatically.

Section:

Move bla bla bla
Move bla bla bla

One 1 Open Output

Move Bla to Out-line
Write Output from Out-Line

The first time, you perform this section, open will be done.
Next times, open will automatically not be done.

I have something in mind, that you also could code on-2, on-3,...
cause that trigger was stept-up ervery time the command was passed.

Now in Cob-2 you have to programm that trigger by yourself or you
build a well-structured programm where there's no need to such triggers.









Exampel:
Back to top
View user's profile Send private message
sedireswarapu

New User


Joined: 18 Jun 2008
Posts: 28
Location: India

PostPosted: Fri Jul 25, 2008 5:34 pm    Post subject:
Reply with quote

Hi,

Thanks for demystifying the use of 'ON 1' in the above posted code as i could not get much information on it, inspite of searching for it in some of the manuals available.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Fri Jul 25, 2008 5:42 pm    Post subject:
Reply with quote

Sometimes it's not so bad to be past one's prime !!!

Nice Weekend, Guys
Back to top
View user's profile Send private message
sedireswarapu

New User


Joined: 18 Jun 2008
Posts: 28
Location: India

PostPosted: Fri Jul 25, 2008 5:54 pm    Post subject:
Reply with quote

Thanks & you too have a nice weekend...
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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us