A label in an NCL procedure should not appear more than once; NCL normally checks to ensure a label is not duplicated. If the &CONTROL NODUPCHK operand is used, duplicate label checking is not performed. This option can result in improved efficiency, but is normally only used after the procedure has been thoroughly debugged.
While label variables offer great benefits in both performance and simplicity, one point needs to be considered. By its very nature, a label must be unique within a given procedure. An attempt to &GOTO a duplicate label will result in an error (unless the &CONTROL NODUPCHK option is in effect). If the processing of a label variable yields a duplicate label, perhaps conflicting with one used earlier in the procedure, you can use the following. if you are using a variable in an &GOTO that is itself not unique, you can append one or more characters to the label in the &GOTO to ensure the generated label is in fact unique.
Example: Duplicate Labels
In this example, the operator can enter YES or NO to either of the &PAUSE statements. In the second, the letter X is prefixed to the operator's input to differentiate it from input entered in reply to the first &PAUSE statement.
&WRITE DATA=ENTER 'Yes' OR 'No'
.PAUSE &PAUSE ARGS
&GOTO .&1
&WRITE DATA=INVALID RESPONSE, RE-ENTER.
&GOTO .PAUSE
.NO &END
.YES
.
.
.
&WRITE DATA=ENTER 'Yes' OR 'No'
.PAUSE2 &PAUSE ARGS
&GOTO .X&1
&WRITE DATA=INVALID RESPONSE, RE-ENTER.
&GOTO .PAUSE2 -* Note addition of X to both
.XNO &END -* &GOTO and target labels to
.XYES -* make labels unique.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |