AS400 CLP – Using Label

Labels on CLP function as markers for one or more instructions in the CLP program. All commands in CLP creation can be labeled. To call a label that can be made using the GOTO command enter the name of the label that was created.

Source code:

PGM                                         
             GOTO       CMDLBL(MYLABEL)       
             SNDPGMMSG  MSG('Hellow World!')
 MYLABEL:    SNDPGMMSG  MSG('JUMP TO LABEL')
ENDPGM                                      

From the above program, if we read there are GOTO instructions to the label command ‘MYLABEL’. So from the GOTO command, the program will jump to the SNDPGMMSG – ‘JUMP TO LABEL’ command without running ‘Hello World!’. Compile and run the program to find out the results.

Leave a Reply