GOTO LABEL command
The GOTO LABEL command causes z/OS® Debugger to resume
program execution at the specified statement label. The specified
label must be in the same block. If you want z/OS Debugger to return
control to you at the target location, make sure there is a breakpoint
at that location.
- statement_label
- A valid statement label within the currently executing program or, in PL/I, a label variable.
Usage notes
- For COBOL, if a
GOTO LABELcommand is issued and the specified label contains an EXIT statement, the results might be unpredictable such as an ABEND because the EXIT statement might not be specified with a return location. - You can use the GOTO command if the SET WARNING is set to OFF and
the runtime level allows GOTO without compiler enablement for the following programs:
- A COBOL program compiled without hooks being inserted by the compiler and with optimization, if you compiled with the NOEJPD suboptions of the TEST compiler option
- A program compiled with Enterprise COBOL for z/OS Version 5 or later and optimized by Automatic Binary Optimizer for z/OS
- A program compiled with Open XL C/C++ for z/OS
- When the target of the GOTO or JUMPTO command is a paragraph name or a section name (label).
- When the target of the GOTO or JUMPTO command is the first statement in the paragraph or section.
- Use the syntax of statement_label enclosed in apostrophes (') only for LangX COBOL programs. It is not supported in any other programming language.
- In PL/I, out-of-block
GOTOs are allowed. However, qualification might be needed. - The
LABELkeyword is optional when either the target statement_label is nonnumeric or if it is qualified (whether the actual label was nonnumeric or not). - A COBOL statement_label can have either of the following forms:
nameThis form can be used in COBOL for reference to a section name or for a COBOL paragraph name that is not within a section or is in only one section of the block.
name1 OF name2orname1 IN name2This form must be used for any reference to a COBOL paragraph (
name1) that is within a section (name2), if the same name also exists in other sections in the same block. You can specify eitherOForIN, but z/OS Debugger always usesOFfor output.
Either form can be prefixed with the usual block, compile unit, and load module qualifiers.
- For C, to be able to use the
GOTO LABELcommand, you must compile your program in one of the following ways:- With either the
PATHorALLsuboption and theSYMsuboption of theTESTcompiler option. - With either the
PATHorALLsuboption and theSYMsuboption of theDEBUGcompiler option.
GOTO LABELcommand. - With either the
- For C++, to be able to use the
GOTO LABELcommand, you must compile your program in one of the following ways:- With the
TESTcompiler option. - With either the
PATHorALLsuboption and theSYMsuboption of theDEBUGcompiler option.
GOTO LABELcommand. - With the
- For COBOL programs, you can use
GOTO LABELcommand if you compile your program with the following suboptions and compilers:- The
HOOKsuboption of theTESTcompiler option with Enterprise COBOL for z/OS, Version 4 - The
PATHorALLsuboption and theSYMsuboption of theTESTcompiler option with the following compilers:- Enterprise COBOL for z/OS and OS/390®, Version 3
- COBOL for OS/390 & VM, Version 2
- For Enterprise COBOL for z/OS Version 5, programs are always compiled without hooks inserted by the compiler. If you are using the TEST compiler option in combination with any level of the OPT compiler option, it is recommended to use the EJPD suboption of the TEST compiler option.
name, wherenameis a section name, or the name of a paragraph not within a section or in only one section of the block.name1 OF name2orname1 IN name2, wherename1is duplicated by one or more other paragraphs in one or more other sections in the block. You can use eitherOForIN, but z/OS Debugger always displaysOFin the log.
- The
- For PL/I, you can use
GOTO LABELonly if you compiled your program with either thePATHorALLsuboption and theSYMsuboption of theTESTcompiler option. There are no restrictions on using labels withGOTO LABELand label variables are supported. GOTO LABELis not available while debugging Enterprise PL/I programs.- You
cannot use the
GOTO LABELcommand while you are replaying recorded steps by using thePLAYBACKcommands. - You cannot use the
GOTO LABELcommand while you debug an optimized COBOL program. - This command cannot be used if you are stopped at an AT APPEARANCE breakpoint, an AT LOAD breakpoint, or an AT DELETE breakpoint.
Examples
- Go to the label constant
labain blocksubain programprog1.GOTO prog1:>suba:>laba; - Go to the label constant
para OF sect1. The current programming language setting is COBOL.GOTO LABEL para OF sect1;
Refer to the following topics for more information related to the material discussed in this topic.
- Related tasks
- IBM® z/OS Debugger User's Guide
- Related references
- statement_label
