[Access to Wang masthead]

The TRANSPRT Procedure

Queuing print files to remote systems

From "VS Procedure",  Access 87, August 1987
  [ Prior Article ]     [ Return to the Catalog of articles ]     [ Next Article ]  

This month we'll discuss a procedure I use to control Wang's TRANSFER utility, the file transfer portion of Wang Systems Networking (WSN, a.k.a. Wangnet). Since a growing number of readers have more than one system, file transfer and logon access to remote systems play an increasingly important role in daily life. Stick around even if you don't presently use WSN; the techniques might be of use in other situations.

The TRANSFER utility

TRANSFER allows files of any type to be transferred from one network node to another. Files are transferred by specifying the input and output parameters, the transfer option (send, retrieve), and some related transfer data. Once released through TRANSFER, the files appear on the TRANSMIT or RETRIEVE queues respectively and are moved in order of time of release and job priority to the other system. All transfer attempts are logged for future reference.

A option of TRANSFER allows print files to be queued directly to a printer on the remote system. This can be of some help if you need to send a print file to a distant user or wish to use specific features of a remote printer. I use this option often, since DP-oriented printers exist on only one of our three VS systems. While it could be used for any file transfer use, TRANSPRT (Figure 1) is specifically designed to spool print files onto a remote printer.

In writing this procedure, I've assumed that some defaults are correct for your environment. For example, there is no mention of the TRANSFER GROUP or queue STATUS since our shop typically uses the default. It may be necessary to add this and other items to meet your individual needs.

Step by step through TRANSPRT

After declaring variable (including literal variables corresponding to system naming defaults) TRANSPRT presents the user with a data entry screen (see PROMPT in step S01). It asks for the file name and location, defaulting the library name to the user's own spool library. The DISPRINT utility can be selected to assist in discerning the file name.

The user must decide at this time whether to STORE the print file on the remote system or to PRINT it directly to a remote printer. If the STORE option is selected, no other entry is needed here; the destination file, library, and volume names are all selected by using the DISPLAY verb to display the output screen (see step S03). Note that incorrect volume names will not be shown as errors since WSN makes no provision to validate such information.

If the PRINT option is taken the PRINT CLASS and FORM NUMBER must be specified. Both of these items direct the file to the proper printer and form. Again, note that these values cannot be verified for accuracy so be very careful. (For this reason, I typically use only one copy of this procedure for each conceivable transfer situation and "hard code" the remote system's values into that copy.)

After the file and all options have been specified, TRANSPRT does some investigative work. First, it verifies that a proper PF key has been pressed by using the &LABEL built-in function to check for the step's existence. Next, it runs the $VERIFY subprocedure featured in the February 1987 column to check for proper file syntax and for the existence of the file. Finally, it runs the TRANSFER utility in one of two ways, depending on whether the user has selected the PRINT or STORE option. If successfully concluded, control returns to the PROMPT at step S01 and the next file can be processed. Note that the original file remains intact; it is up to the user to scratch it after verifying that the transfer was successful.

Regular readers of this column will note several programming conventions in this procedure. For example, the value of the PF key pressed at the PROMPT in step S01 becomes the last two positions of &RUNSTEP. This value - coupled with the '@' sign at the beginning - becomes the name of the corresponding code section. I use the &LABEL built-in procedure function to check for the existence of a code section with that name, then CALL the step. New menu options can be added to the procedure by simply adding the code section (with an appropriate label) and explanatory text for the user's benefit.

Screen display elements are also controlled in a generic manner. Rather than relying on the Procedure interpreter's BRIGHT, DIM, BLINK and other display control verbs, I have used the &BYTE function to "splice" binary values to the beginning of &MESSAGE text to control blinking, brightness, and other Field Attribute Characters (FAC's) in the screen message. For example, the use of &BYTE(132) in step E03 causes the message to be bright, while &BYTE(148) in the same section makes the error message flash. Here are some of the most popular FAC's for text display control in procedures:

Field Attribute Characters
(as used for Procedure text control)

Display Attribute HEX
Value
Decimal
Value
BRIGHT NO LINE 84 132
BRIGHT LINE A4 164
DIM NO LINE 8C 140
DIM LINE AC 172
BLINK NO LINE 94 148
BLINK LINE B4 180

Other standard elements include use of the &MESSAGE and &ALARM variables and control over abnormal exits through the CANCEL EXIT IS option in RUN. &MESSAGE is defined GLOBAL so that a message can be inserted from the $VERIFY subprocedure if an error is found. If an error occurs - i.e., if &MESSAGE has a value - the value of &ALARM is set to YES to sound the workstation's bell. The CANCEL EXIT clause in running TRANSFER makes sure that the procedure is terminated if the user abnormally exits during operation.

Variations? The most obvious changes are those to the use of the TRANSFER utility's options. A specific transfer group might be selected to ensure that the transferred files will have a predictable ownership and file protection profile. Selection might be made to the transfer status option so entries are queued for later release rather than transferring immediately. Braver souls might select the option to SCRATCH the file after a successful transfer, but I'm not that trusting. Finally, control might be extended to other print options, such as the number of copies, disposition after printing, and the number of lines per page. There are also options to send and receive Word processing documents and to print those documents on a remote system.

Mail and other loose ends

David Mizzell of Mizzell Enterprises in Houston has again attempted to keep me honest. He comes to the defense of the PROCFORM utility I covered in the March column "Using Procedure Generators" by pointing out that screen dumps can be created for almost all GETPARM screens by simply pressing PF 15; the exceptions to this are those screens that use PF 15 as a valid menu option. This knowledge certainly makes PROCFORM easier to use. He has also discovered a curious fact about using EXTRACT to get the system ID: the returned value is sixteen characters in length rather than eight as currently implemented. Room for future growth, perhaps? At any rate, you'll note that I have accordingly defined &REMSYS with a length of sixteen. Thanks for the tips, David.

If you are a heavy TRANSFER addict, you owe it to yourself to check into the XFERMANY Useraid offered by the International Society of Wang Users (ISWU). This little gem allows you to transfer a number of files or even an entire library in one move. Alas, there are no GETPARM screens so it can't be run from a procedure. Contact ISWU (International Society of Wang Users, Wang Labs, M/S 1935, One Industrial Drive, Lowell, MA 01851) if interested.

And what of next month's column? How about a major improvement to TRANSPRT?

Experienced users of TRANSFER have already know that the print files queued using the SPOOL option arrive without any information as to their ownership or routing. Instead, the print banner reads FTMTSK and the files are assigned random names (typically 'WNETxxxx' in library 'WNET'). This means your print files can vanish faster than a suitcase on a transcontinental flight. Since the file names are assigned automatically by WSN, what can you do to identify your files?

My solution to was to write the subprocedure PRINTID, which adds a header page to each print file I transfer. Next month we'll look at this generic print file routing utility and incidentally examine the GETPARM utility in the USERAIDS collection. In the meanwhile, I look forward to your comments and suggestions.


Figure 1: The TRANSPRT Procedure


     PROCEDURE TRANSPRT - Transfers print files to a remote system

**********************************************************************
*
*         TRANSPRT - transfers print files to a remote printer
*
*    This procedure was featured in the August 1987 ACCESS 87.  It uses
*    the TRANSFER utility to send print files to a printer located on
*    another VS.  Information on the file's location is validated
*    through the $VERIFY subprocedure, and the appropriate transfer
*    method is invoked.  Abnormal cancels from TRANSFER funnel the
*    user to a special cancel screen.
*
*    SPECIAL NOTES: the value for &REMSYS shown below must be changed
*    to reflect the Wangntet ID of the destination system.
*
*    This procedure also assumes the existance of the following
*    files:
*
*         $VERIFY  / [ PROGLIB (same library and volume as this file) ]
*         TRANSFER / @SYSTEM@ / [ system volume ]
*         DISPRINT / USERAIDS / [ system volume or PROGLIB ]
*
*    Written by Dennis S. Barnes
*
*
**********************************************************************

* Default variables for print option of TRANSFER
     DECLARE &PRTMODE    STRING (01) INITIAL "P"
     DECLARE &PRTCLASS   STRING (01) INITIAL "A"
     DECLARE &PRTFORM    STRING (03) INITIAL "000"
     DECLARE &REMSYS     STRING (08) INITIAL "REMOTE  "

     DECLARE &RC         INTEGER
     DECLARE &MESSAGE    GLOBAL STRING (71)

     DECLARE &RUNSTEP    STRING (03)         INITIAL "@  "
     DECLARE &ALARM      STRING (03)         INITIAL "NO "

     DECLARE &PRTFIL     STRING (08)
     DECLARE &PRTLIB     STRING (08)
     DECLARE &PRTVOL     STRING (06)

     EXTRACT             &PRTLIB   = SPOOLIB, &PRTVOL     = SPOOLVOL

S01: PROMPT              PFKEY     = &RUNSTEP (2,2),
                         ALARM     = &ALARM
     CENTER BRIGHT LINE  "Print File Transfer Utility";;
     CENTER
     "This procedure transfers print files to any DP print on",
                         BRIGHT &REMSYS(1,*), ".";;
     CENTER "Please enter the file parameters:";;
     CENTER              "PRINT FILE =", UPPER &PRTFIL,
                         " in ",         UPPER &PRTLIB,
                         " on ",         UPPER &PRTVOL;;
     CENTER              "  TRANSFER MODE =", UPPER &PRTMODE,
                         "(P)RINT OR (S)TORE";;
     CENTER "The following parameters relate to the PRINT option:";;
     CENTER              "PRINT CLASS =", UPPER &PRTCLASS;
     CENTER              "FORM #      =", UPPER &PRTFORM;;
     CENTER              "PF(14) to display print files";
     CENTER              "PF(16) to EXIT               ";;
     CENTER              &MESSAGE (1,*)

     ASSIGN &ALARM       = "NO "
     ASSIGN &MESSAGE     = " "
     IF NOT &LABEL ( &RUNSTEP )    GOTO WRONGKEY
     CALL &RUNSTEP
     GOTO S01

WRONGKEY:
     ASSIGN &ALARM       = "YES"
     ASSIGN &MESSAGE     = &BYTE(148) !!
                         "Invalid option - please try again"
     GOTO S01

@0:  RUN $VERIFY [ in library on volume ]    USING &PRTFIL,
                                                   &PRTLIB,
                                                   &PRTVOL

     IF &MESSAGE = " "   GOTO S02
     ASSIGN &ALARM       = "YES"
     GOTO S01

S02: IF &PRTMODE = "S"   GOTO S03

* Transfer files - PRINT option **************************************

STP: RUN TRANSFER [ in library on volume ]
     CANCEL EXIT         IS CANCEL
     ERROR EXIT          IS E03
     ENTER FUNCTION      01
     ENTER OPTIONS       LOCATION  = &REMSYS
     ENTER INPUT         FILE      = &PRTFIL,
                         LIBRARY   = &PRTLIB,
                         VOLUME    = &PRTVOL,
                         DISP      = P,
                         SCRATCH   = NO
     ENTER OUTPUT        PRTCLASS  = &PRTCLASS,
                         FORM#     = &PRTFORM
     ENTER FUNCTION      16

     GOTO E03

* Transfer files - STORE option **************************************

S03:
STP: RUN TRANSFER [ in library on volume ]
     CANCEL EXIT         IS CANCEL
     ERROR EXIT          IS E03
     ENTER FUNCTION      01
     ENTER OPTIONS       LOCATION  = &REMSYS
     ENTER INPUT         FILE      = &PRTFIL,
                         LIBRARY   = &PRTLIB,
                         VOLUME    = &PRTVOL,
                         DISP      = &PRTMODE
     DISPLAY OUTPUT      FILE      = &PRTFIL,
                         LIBRARY   = &PRTLIB
     ENTER FUNCTION      16

E03: ASSIGN &MESSAGE     = &BYTE(132) !!
                         "File " !! &PRTFIL !!
                         " successfully transferred"
     ASSIGN &PRTFIL      = " "

     ASSIGN &RC          = STP
     IF &RC      = 0     GOTO S01

     ASSIGN &MESSAGE     = &BYTE(148) !!
                         "Transfer error - return code = " !!
                         &RC
     ASSIGN &ALARM       = "YES"
     GOTO S01


* Run DISPRINT *******************************************************

@14: RUN DISPRINT IN USERAIDS [ on volume ]
     ASSIGN &MESSAGE     = &BYTE(132) !!
                         "DISPRINT completed"
     GOTO S01

* End of program - exit **********************************************

@16: RETURN

**********************************************************************
* Subroutines                                                        *
**********************************************************************

* Standard cancel exit screen

CANCEL:
     PROMPT              ALARM     = YES
     CENTER BRIGHT LINE  "Print File Transfer Utility";;
     CENTER BLINK        "W A R N I N G ! !";;
     CENTER
     "TRANSFER has been cancelled.  The procedure will be aborted.";;
     CENTER              "Press (RETURN) to exit program";;

     GOTO @16

  [ Prior Article ]     [ Return to the Catalog of articles ]     [ Next Article ]  


Copyright © 1987 Dennis S. Barnes
Reprints of this article are permitted without notification if the source of the information is clearly identified