Language Reference

LINK and RETURN Statements

jump to another statement

LINK label;
           statements
label:statements
RETURN;

The LINK statement, like the GOTO statement, directs IML to jump to the statement with the specified label. Unlike the GOTO statement, however, IML remembers where the LINK statement was issued and returns to that point when a RETURN statement is executed. This statement can only be used inside modules and DO groups.

The LINK statement provides a way of calling sections of code as if they were subroutines. The LINK statement calls the routine. The routine begins with the label and ends with a RETURN statement. LINK statements can be nested within other LINK statements to any level. A RETURN statement without a LINK statement is executed the same as the STOP statement.

Any time you use a LINK statement, you may consider using a RUN statement and a module defined using the START and FINISH statements instead.

An example that uses the LINK statement follows:

  
    start a; 
       x=1; 
       y=2; 
       link sum1; 
       print z; 
       stop; 
       sum1: 
          z=x+y; 
       return; 
    finish a; 
    run a; 
  
                 Z             1 row       1 col     (numeric) 
  
                                           3
 

Previous Page | Next Page | Top of Page