PASS


The PASS statement causes the indicated area to be passed to the next subroutine, process, or external program that is executed via a GOSUB, CALL, RUN, or process-type statement (i.e., INPUT, INQUIRY, JOB, MENU, OUTPUT, QUERY, STATUS, SUBR, UPDATE), or to the next automatic or optional child process that is run. See the next section, PASS Lists, for a discussion of how PASS lists are maintained and cleared.

    ••••• PASS     ••• •••••••••••••••••••••• ••• •••••••••••••••  SHARE? •
    (1)            (2) (3)                    (4) (5)                    (6)

(1) T/F execution conditions

(2) Application ID

(3) Field name or predefined field

(4) Occurrence (constant/index)

(5) Area type (FIELD)

(6) Share? (Y/N)

Using the Statement

The PASS statement has two uses:

·    To explicitly pass an area from one process to another that would not otherwise be passed using implicit interprocess communication specifications.

·    To pass areas to an external program written in another programming language.

In the first case, the receiving program must explicitly receive the area with a RECEIVE statement, unless it receives the passed area based on implicit IPC specifications.

In the second case, the order areas are passed in is significant. Areas are passed in the order that the PASS statements are executed in.

Area type should be FIELD until such time other values have been implemented.

If SHARE? is Y, the PASS statement sends a pointer to the area value. Any changes made to this area in the receiving process or external program are available to the calling process.

If SHARE? is N, the PASS statement sends a copy of the area value. Changes made to the area in the receiving process (or program) do not modify the value in the calling process.

Related Statements

CALL, GOSUB, INPUT, INQUIRY, JOB, MENU, OUTPUT, QUERY, RECEIVE, RUN, STATUS, SUBR, UPDATE

Example

          PASS     TAR CUSTOMER NAME              FIELD            SHARE? N
          PASS     TAR WORK STRING LENGTH         FIELD            SHARE? Y
          GOSUB    :COMPUTE NAME LENGTH
          END
          *
          LABEL    :COMPUTE NAME LENGTH
          RECEIVE  --- TEMP 2K                    FIELD              FAIL N
          RECEIVE  --- A1                         FIELD              FAIL N
          CNV BIN  --- TEMP 1                     =      0
          APPEND   --- TEMP 2K                    0  --- TEMP 1
          IF       --- TEMP 2K                    IN --- TEMP 1
    T     SET      --- A1                         =  --- TEXT AT POSITION
    T     COMPUTE  --- A1                         -      1
          RETURN

In this example, the initial value of CUSTOMER NAME is returned following the subroutine. Even if the subroutine altered the value of this field, it would still be returned in its initial state because the PASS statement does not share the field. The WORK STRING LENGTH field (paired with the value of the AI field), however, is modified to contain the length of the value in the CUSTOMER NAME field. This new value is returned following the subroutine because the WORK STRING LENGTH field was passed as a shared field.