APPX Software Library

Chapter 4-7: Predefined Fields and Processes

SEND FILE TO CLIENT

This subroutine retrieves a file from the server and stores it on the client system. Three arguments are expected to be passed to the subroutine:

  • Source pathname (alpha field, maximum length 256)
  • Destination pathname (alpha field, maximum length 256)
  • If blank, the client will open a dialog browser so the user can select the file.
  • Should be PASS'ed shared to allow for return of user-selected file.
  • If the destination pathname is relative, it will be relative to the location of the APPX client jar file.
  • Field for status indicator (numeric field)
  • Must be PASS'ed shared.
  • Returns status code (0=Failure, 1=Success).

The subroutine can be invoked via SUBR or GOSUB. While the file is in transit, the client will show a progress slider and the APPX session will wait until it completes before returning.

The following example retrieves a file from the APPX server and stores it in the user-selected file on the APPX client. A message (or warning) is used to report the name of the file the user selected and whether or not it was sent successfully.

          SET      --- TEMP 132                   =      /tmp/testfile.txt
          SET      --- TEMP 256                   =
          SET      --- XI                         =      0
          *
          PASS     --- TEMP 132                   FIELD            SHARE? N
          PASS     --- TEMP 256                   FIELD            SHARE? Y
          PASS     --- XI                         FIELD            SHARE? Y
          SUBR     --- SEND FILE TO CLIENT              DETACHED     END? N  FAIL 0
          *
          IF       --- XI                         EQ     1
    T     APPEND   --- TEMP 256                   1      sent OK
    F     APPEND   --- TEMP 256                   1      not sent
    -     APPEND   --- TEMP 256                   1      to client
    T     MESSAGE  --- TEMP 256
    F     WARNING  --- TEMP 256