You can use commands to change the flow of logic within your CL procedure.
Commands in a CL procedure are processed in consecutive sequence. Each command is processed, one after another, in the sequence in which it is encountered. You can alter this consecutive processing using commands that change the flow of logic in the procedure. These commands can be conditional or unconditional.
Unconditional branching means that you can instruct processing to branch to commands or sets of commands located anywhere in the procedure without regard to what conditions exist at the time the branch instruction is processed. Unconditional processing commands include:
Conditional branching means that under certain specified conditions, processing may branch to sections or commands that are not consecutive within the procedure. The branching may be to any statement in the procedure. This is called conditional processing because the branching only occurs when the specified condition is true. Conditional processing is usually associated with the IF command. With the ELSE command, you can specify alternative processing if the condition is not true.The simple DO command allows you to create groups of commands that are always processed together, as a group, under specified conditions. Conditional processing commands include: