CALL

Call an internal subroutine

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
CALL label

or

CALL(label[, ...]), value

label

Either a specific label to which execution control is transferred, or a list of labels (separated by commas) to which control is transferred based on the specified selection in value.

value

An expression whose result is used to select a label from a list of labels. Execution control is transferred to the selected label. A result of 1 selects the first label in the list, a result of 2 selects the second label, and so forth. If the result is less than or equal to 0, or greater than the number of labels, no transfer occurs. (n)

The CALL statement transfers control to an internal subroutine. The internal subroutine is entered through the statement whose label matches the label that is specified or selected in the CALL statement. After returning from the internal subroutine, execution continues with the statement following the most recently executed CALL statement.

Internal calls use the same data area as the calling routine.

Note

In Synergy .NET, CALL-RETURN is not allowed inside a TRY block.

Writing and calling subroutines and functions for more information about internal subroutines

Examples

.align LONG
record
    select      ,i2
    type        ,i2
    agedate     ,d8
    date        ,4d8
    cutoff      ,d8
proc
    xcall choice(select)                ;Get "select" value
    call(zapper, zinger), select        ;Depending on select value, call either
                                        ; zapper or zinger
    .                                   ;Point A
    .
    .
zinger,
    agedate = date(type)
    .
    .
    .
    call inner
    .                           ;Point B
    .
    .
    return                      ;Return to point A
inner,
    if(date .gt. cutoff)
      over = 1
zapper,
    .
    .
    .
    return                      ;Return to point B if entered at inner
                                ;Return to Point A if entered at zapper