Preprocessor skip past

<< Click to Display Table of Contents >>

Navigation:  Command Language > Preprocessor >

Preprocessor skip past

Sometimes text and preprocessor commands are not needed under certain conditions.

The *SKIP and *BLOCK commands are used for this.

See also loop commands *SLE and *LAST.

*SKIP

The *SKIP command tells the preprocessor to skip to a destination label later on in the CL script, ignoring everything in between, if the condition (described below) is true.

The skip may be unconditional (always skips), or conditional.

Skips are most commonly used in loops to allow for exceptions in the loop text.

If the skip is taken, all the code up the next occurrence of the destination label is ignored.

Think of the skip as "Ignore the code following if ...".

*BLOCK

The *BLOCK command tells the preprocessor to skip to a destination later on in the CL script, ignoring everything in between, only if the condition (described below) is false.

Skips are most commonly used in loops to allow for exceptions in the loop text.

If the skip is taken, all the code up the next occurrence of the destination label is ignored.

Think of the block as "Only do the code following if ...".

Destination label

The destination label command takes the form:

[*destination]

[*destinationD]

where destination is a number of one or more digits. The number has no significance, and the same number can be used again.

If the destination number is followed with a D, this tells the preprocessor to display in the log file all the current details. This can be useful for checking complex CL scripts.

Destination labels do not have to referred to in *SKIP or *BLOCK commands.

A skip or block may not be to a destination label inside a not yet opened loop.

Examples of destination labels:

[*23]

[*777d]

Condition

An unconditional skip takes the form

[*SKIP number]

A conditional skip takes the form:

[*SKIP destination ON arithmetic compare arithmetic]

[*SKIP destination STRING 'text' compare 'text']

[*SKIP destination STRING cellref compare 'text']

[*SKIP destination NULL index]

[*SKIP destination INTEGER cellref]

[*SKIP destination EMPTY cellref]

The arithmetic is any valid calculation or substitution that produces an integer value, see Preprocessor index usage.

The compare is one of the following:

.GT.  greater than

.LT.  less than

.EQ.  equal to

.NE.  not equal to

.LE.  less than or equal to

The cellref refers to a database cell.

When texts are compared case is ignored, so 'ABC'.eq.'abc' will be true.

On

This is true is the comparison of the values is true.

String

This is true is the comparison of the texts is true.  The first text can be a reference to a database cell.

Null

This is true if the index referred to is not set to a value.

Integer

This is true if the database cell contains a valid integer.

Empty

This is true if the database cell is empty.

 

Examples of *SKIP and *BLOCK commands:

[*skip 13] Ignored [*13]

[*skip 3 on Loop.eq.1] Not first time [*3]

[*skip 5 on Part1+Part2.gt.6] ... [*6]

[*skip 67 string dlList.volume.eq.'na'] ... [*67]

[*block 99 string '[@ThisText]’.ne.’NA’] ... [*99]

[*skip 99 string '[@ThisText]’.ne.’[@ThatText]’] ... [*99]

[*skip 77 null TestIndex] ... [*77]

[*block 20 integer dlList.value] ... [*20]

[*block 5 empty HowMany] ...  [*5]