───────────────────────────────────────────────────────────┤
The null statement is sometimes used in flow-of-control statements when no action is desired. A null statement can be generated within certain flow-of-control statements without using a statement separator, as shown in some of the following examples.
A null statement can also be generated by a statement separator that is preceded only by blank characters or a statement label identifier. The usual statement separator is a semicolon (;) appearing at the end of a statement. However, an invalid character at the start of a line also acts as a statement separator. For details, refer to Statement List.
Examples
In this first example, a CASE statement is used to select which update program (if any) should be run that day. Although no update program should be run on the weekends, the syntax of the CASE statement requires a statement after the selection expression. This requirement is satisfied by the null statement (labeled WEEKEND:).
?BEGIN JOB CASE/EXAMPLE(STRING DAY); CLASS=2; CASE DAY OF BEGIN ("MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY"): RUN OBJECT/DAILY/UPDATE; ("FRIDAY"): RUN OBJECT/WEEKLY/UPDATE; ("SATURDAY", "SUNDAY"): WEEKEND: ; % No run needed. ELSE: ABORT "INVALID INPUT STRING:" & DAY; END; ?END JOB.
In this example, a null statement (consisting of blank characters after the reserved word THEN) appears within an IF statement. A semicolon can be inserted after the THEN clause, but its presence does not terminate the statement and does not affect the logic of nested IF statements.
IF FILE (SAM)DAILY/TOTALS/DATA IS RESIDENT THEN % Continue job. ELSE ABORT "Job terminated due to missing data file";
In this example, a null statement is unintentionally generated (after the predefined word DO) by the invalid character at the beginning of the next line.
?WHILE PRINTCOUNTER LEQ REQCOPIES DO ? BEGIN ? PRINT (VIP)ANNUAL/REPORT; ? PRINTCOUNTER := PRINTCOUNTER + 1; ? END;