View previous topic :: View next topic
|
Author |
Message |
mikayag
New User
Joined: 10 Mar 2005 Posts: 16
|
|
|
|
Hi there,
I'm a newbie in COBOL and mainframe. I see codes in existing modules such as this:
EVALUATE SL-RET-CODE ALSO SQLERRD(3)
WHEN DB-SUCCESS ALSO NOT ZERO
PERFORM <SOME CODES>
WHEN DB-FAIL ALSO ZERO
PERFORM <SOME CODES>
.
.
.
What will happen if I omit the ALSO in the EVALUATE statement and there is an ALSO in the WHEN |
|
Back to top |
|
|
serious_mainframes
New User
Joined: 10 Mar 2005 Posts: 2
|
|
|
|
hi,
also is used for specifying a additional condition to an evaluate statement
so that the will be applied to whole block |
|
Back to top |
|
|
kingofmf
New User
Joined: 02 Mar 2005 Posts: 13 Location: Bangalore
|
|
|
|
take the following example-
EVALUATE VAR1
WHEN 1 PERFORM PARA-1
WHEN 2 PERFORM PARA-2
WHEN 3 PERFORM PARA-3
END-EVALUATE.
depending on the value of VAR1 it execute para-1 to para-3.
here WHEN 1 PERFORM PARA-1 is equivallent to the statement
IF VAR1 = 1
PERFORM PARA-1
END-IF.
now see the following
EVALUATE VAR1 ALSO VAR2
WHEN 1 ALSO 2 PERFORM PARA-1
WHEN 1 ALSO 3 PERFORM PARA-2
.
.
END-EVALUATE.
here to perfrom para -1 var1 and var2 must contain value 1 and 2.
ie the statement is equivallent to
IF VAR1 = 1 AND VAR2 = 2
PERFORM PARA-1
END-IF.
i think the above discussion will clear your concept |
|
Back to top |
|
|
|