GO OUT TO

<< Click to Display Table of Contents >>

Navigation:  Reference > Commands >

GO OUT TO

There are two possible forms for the GO OUT TO command: GO OUT TO position,

GO OUT TO svar (position1, position2 [,position3 ... ] ),

The GO OUT TO command functions exactly as the GO TO command, with the important addition that when the command is executed, the address of the next command in the CL script is saved, so that when a GO BACK command is next executed, control will be returned to the command immediately following the GO OUT TO command.

In the first form, execution causes control to be transferred to the position command specified. The second form is called a "computed GO OUT TO", and execution causes control to be transferred to position i where i is the true bit in svar. If the svar is empty (value 0), then execution continues with the next command and the GO OUT TO command is ignored.

If any possible destination of the GO OUT TO command is previously defined in the code (i.e. if the jump might cause control to be transferred backwards) a warning message is printed (unless F=NWBJ). Note that jumping back is not allowed at all in Tables Stages.

The GO OUT TO command enables you to write only once a section of code that would otherwise need to be written a number of times, with different variable names for example.

It is possible to "nest" GO OUT TO commands to a depth of 20 in Data and Manip Stages; that is, to execute a series of GO OUT TO commands without executing a GO BACK in between. This may not be done in a Tables Stage. Here a record may only GO OUT TO once before a GO BACK is executed.

A section which is reached during execution from a GO OUT TO command should have an unconditional GO TO immediately before it which will jump round the section so that it will only be executed after a GO OUT TO. This is because if a record reaches a GO BACK command when it has not previously encountered a GO OUT TO command, or if it has already gone back from all previously encountered GO OUT TO commands, the execution run will be aborted.

Examples of GO OUT TO usage:

go to @101,

!

@100,

dm $mm=$231-245/ ...

go back,

!

@101,

d $231-245 = $131-145,

go out to @100,

dm $mm1=$mm,

d $231-245=$146-160,

go out to @100,

dm $mm2 = $mm,

d $231-245 = $161-175,

go out to @100,

dm $mm3=$mm,