PASS Lists


As discussed in the previous section, the PASS statement allows an 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. Prior to APPX 4.1, there was only one PASS list which was cleared upon completion of a CALL or RUN statement. Now it is possible to have a series of PASS lists. Each PASS statement adds its area to a single list until the execution of a GOSUB, CALL, RUN, or process-type statement, or the invocation of a automatic or optional child process. Upon such execution, only the values in the current PASS list are passed. However, if executing an APPX subroutine or process, it can in turn execute PASS statements. These statements then build another PASS list until terminated in the same manner. Each PASS list is cleared when execution returns to the routine or level which established it.

The following code provides an example of the use of three separate PASS lists. The first PASS list holds values for CUSTOMER NAME and CUSTOMER ADDRESS. The second PASS list contains the value for AREA MAIL CODE, and this is the only value passed to the :PROCESS MAIL CODE subroutine. The second PASS list is then cleared upon return from this subroutine while the first PASS list remains intact until the return from the :PROCESS NAME & ADDRESS subroutine. As illustrated in our example, values from the first PASS list do not have to be RECEIVE'd before initiating another PASS list. Finally, a third PASS list is established for the CUSTOMER BALANCE value, which is finally cleared upon return from the :PROCESS BALANCE subroutine.

          PASS     TAR CUSTOMER NAME              FIELD            SHARE? N
          PASS     TAR CUSTOMER ADDRESS           FIELD            SHARE? N
          GOSUB    :PROCESS NAME & ADDRESS
          PASS     TAR CUSTOMER BALANCE           FIELD            SHARE? N
          GOSUB    :PROCESS BALANCE
          END
          *
          LABEL    :PROCESS NAME & ADDRESS
          RECEIVE  TAR WORK NAME
          *        (code to process name)
          PASS     TAR AREA MAIL CODE
          GOSUB    :PROCESS MAIL CODE
          RECEIVE  TAR WORK ADDRESS
          *        (code to process address)
          RETURN
          *
          LABEL    :PROCESS MAIL CODE
          RECEIVE  TAR WORK MAIL CODE
          *        (code to process mail code)
          RETURN
          *
          LABEL    :PROCESS BALANCE
          RECEIVE  TAR WORK BALANCE
          *        (code to process balance)
          RETURN