Previous Topic

Next Topic

Book Contents

Book Index

%%GOTO and %%LABEL

%%GOTO and %%LABEL control statements provide the AutoEdit facility with "GO TO" logic, permitting simple inclusion or exclusion of job steps, DD statements, input date, and so on.

The format of %%GOTO and %%LABEL statements is:

%%GOTO labelname

%%LABEL labelname

The %%GOTO statement transfers control to the location in the program designated by a matching %%LABEL statement. The search for a matching %%LABEL labelname is only performed downward (that is, loops are not supported).

Ordinarily, statements between a %%GOTO statement and its matching %%LABEL statement are not processed (that is, no statements are submitted and AutoEdit statements are not resolved). The one exception is %%IF, %%ELSE, and %%ENDIF control statements that are commented (that is, begin with //*), which are submitted but not resolved, in order to clarify the flow of conditions in the generated JCL.

The AutoEdit facility performs a validity check on %%GOTO and %%LABEL control statement pairs in JCL members. If an active %%GOTO control statement is detected without its corresponding %%LABEL control statement, an warning message is issued.

Using the AutoEdit facility, several %%GOTO statements in one JCL member can be combined, so that a number of jobs defined in the member can be combined into one job, which can be submitted by Control-M.

%%GOTO and %%LABEL statements are generally used in conjunction with %%IF, %%ELSE, and %%ENDIF control statements. Examples at the end of this chapter demonstrate how these statements can be combined.

Parent Topic

Control Statements