MSCEWI2070

A return statement was added at the end of the label section to ensure the same execution flow

Severity

Medium

Description

When a Goto statement is replaced with a Label section and it does not contain a return statement, then one is added at the end of the section to ensure the same execution flow.

In BTEQ after a Goto command is executed the statements that are between the goto command and the label command with the same name are ignored. So, to avoid those statements to be executed the label section should contains a return statement.

In addition, is worth value mentioning the Goto command skips all the other statements except for the Label with the same name, where is when the execution resumes. Therefore, the execution will never resume in a label section defined before the Goto command.

Example Code

Input Code:

.LOGON dbc,dbc;
select 'STATEMENTS';
.GOTO LABEL_B
select 'IGNORED STATEMENTS';
.label LABEL_B
select 'LABEL_B STATEMENTS';

Output Code

Recommendations

Last updated