View previous topic :: View next topic
|
Author |
Message |
Captain Paralytic Warnings : 1 New User
Joined: 21 Apr 2010 Posts: 40 Location: UK
|
|
|
|
mtaylor wrote: |
Thanks for uncovering this nice little tid bit. I don't recall if I coded my JCL parser to accept an IF as the first statement in a job or not, I'll have to check. Although now that I think about it, there may be verbage in the manual to specify IF may not be first in a job.
Note; I also prefer the OS 390 JCL manual over any of the Z/OS ones. They rewrote and obfuscated a lot of relavent information in the newer manuals. |
I am just writing some feedback for the manual since, as pointed out by other posters in this thread, the list of what may be in a relational-expression is not compete. It states
Quote: |
A relational-expression consists of:- Comparison operators
- Logical operators
- NOT (¬) operators
- Relational-expression keywords.
|
But it does not state that it may also contain:
- Integer constants (e.g. 04, 08)
- Boolean constants (TRUE, FALSE)
which it quite plainly does. |
|
Back to top |
|
|
nil_mf
New User
Joined: 06 Jun 2005 Posts: 29
|
|
Back to top |
|
|
Captain Paralytic Warnings : 1 New User
Joined: 21 Apr 2010 Posts: 40 Location: UK
|
|
|
|
nil_mf wrote: |
"An IF statement specified before the first EXEC statement in a job is not evaluated before the first step executes. If the IF statement applies to later steps in the job, the statement will be evaluated when the system decides whether to process the later steps.
|
Yes, but as we have seen, this statement is not correct! The IF statement DOES get evaluated when the relational-expression is true.
I would expect consistency. Either the statement is NOT evaluated so that both the THEN and ELSE part are always executed, regardless of the logical value of the relational-expression, or it is always evaluated.
What we are seeing is that the relational-expression is evaluated and if its result is TRUE, then the IF statement operates in the normal way for an IF statement, but if the result is FALSE, the steps are executed as if the IF statement is not there. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
The IF statement is not evaluated, hence STEP1 executes.
The IF evaluation is done to determine whether or not to perform STEP2 -- per the manual statement nil_mf quoted. If the evaluation is such that the ELSE condition is selected, STEP2 executes. If the ELSE condition is not selected, STEP2 does not execute. So either the first step or both steps will be executed, depending upon the IF condition.
The manual statement from nil_mf, applied to your example, has predictable and understandable results. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
So - you guys gonna have that beer now? |
|
Back to top |
|
|
|