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

cobol statment starting with ON


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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: 771
Location: Germany

PostPosted: Fri Jul 25, 2008 5:13 pm
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
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: 771
Location: Germany

PostPosted: Fri Jul 25, 2008 5:42 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts ABEND 0717 during starting IMS IMS DB/DC 0
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts Starting a PROC with parameters from ... CLIST & REXX 6
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
Search our Forums:

Back to Top