View previous topic :: View next topic
|
Author |
Message |
Dhanya Praju
New User
Joined: 16 Jul 2008 Posts: 10 Location: Banglaore
|
|
|
|
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 |
|
|
sedireswarapu
New User
Joined: 18 Jun 2008 Posts: 28 Location: India
|
|
|
|
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 |
|
|
Dhanya Praju
New User
Joined: 16 Jul 2008 Posts: 10 Location: Banglaore
|
|
|
|
But in this case in which case this on 1 is setting to true? what is this ON 1 evaluating for? |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
sedireswarapu
New User
Joined: 18 Jun 2008 Posts: 28 Location: India
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Sometimes it's not so bad to be past one's prime !!!
Nice Weekend, Guys |
|
Back to top |
|
|
sedireswarapu
New User
Joined: 18 Jun 2008 Posts: 28 Location: India
|
|
|
|
Thanks & you too have a nice weekend... |
|
Back to top |
|
|
|