The .SKIP command skips one or more statements. It is useful for moving past a program statement that caused an error. If the optional argument n is present, it gives the number of statements to skip; otherwise, a single statement is skipped.
Note that .SKIP does not execute or evaluate the code it is skipping. Rather, it arbitrarily alters the current program counter to the nth physical statement following the current point. This has implications that may not be obvious on initial consideration:
- .SKIP does not skip into a called routine.
- .SKIP moves to the nth physical statement following the current program location. This may not be the statement that execution would have actually have moved to if you had allowed the program to run normally.
- Arbitrarily moving the program counter in this way may leave your program in an unrunnable state, depending on resulting state of the local variables and the statements that the newly positioned program counter attempts to execute next.
In contrast, the .STEP executive command has none of the above drawbacks and can be used instead in many situations. The advantage of .SKIP over .STEP is that .SKIP can move past statements that .STEP cannot, such as:
- Statements with errors that cause execution to halt.
- Infinite loops, and similar logic errors.
For example, consider the following program segment:
...... ... ...
OPENR, 1, 'missing'
READF, 1, xxx, ..., ...
... ... ...
If the OPENR statement fails because the specified file does not exist, program execution will halt with the OPENR statement as the current statement. Execution can not be resumed with the executive command .CONTINUE because it attempts to re-execute the offending OPENR statement, causing the same error. The remainder of the program can be executed by entering .SKIP, which skips over the incorrect OPEN statement.
Note: .SKIP is an executive command. Executive commands can only be used at the IDL command prompt, not in programs.