! TSXLIB.RNO NAB/1738/SNLA 09-OCT-80/13-OCT-80. ! A LIBRARY IMPLEMENTATION OF PROGRAMMED REQUESTS FOR TSX/TSX-PLUS. .PAPER SIZE 60,72 .UPPER CASE .LEFT MARGIN 8 .RIGHT MARGIN 64 .TAB STOPS 8,16,24,32,40,48,56,64,72 .DATE .NUMBER 0 .FIGURE 8 .CENTER A Library Implementation .CENTER of .CENTER Programmed Requests .CENTER for .CENTER TSX/TSX-Plus .BLANK 8 .CENTER N.#A.#Bourgeois, Jr. .CENTER Sandia National Laboratories .CENTER Systems Engineering Division 1738 .CENTER P.#O.#Box 5800 .CENTER Albuquerque, NM 87185 .FIGURE 8 .CENTER Abstract .BLANK .PARAGRAPH A library of FORTRAN callable subroutines that implement EMT's provided by TSX/TSX-Plus is described. Calling sequences, library building procedures and source codes are given. .FIGURE 8 .CENTER 80j13b .PAGE .PAPER SIZE 60,72 .UPPER CASE .LEFT MARGIN 16 .RIGHT MARGIN 56 .FIGURE 16 This document is issued by Sandia National Laboratories, operated for the United States Department of Energy by Sandia Corporation. .BLANK 2 .CENTER Notice .BLANK 2 This document was sponsored by the United States Government. Neither the United States Government nor the United States Department of Energy, nor any of their employees, nor any of their contractors, subcontractors, or their employees makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness or usefulness of any information, apparatus, product or process disclosed, or represents that its use would not infringe privately owned rights. .BLANK 2 This work was sponsored and funded by: .BLANK .INDENT 4 Headquarters, ESD / OCB / Stop 36 .INDENT 4 Hanscom Air Force Base, MA 01731 .LEFT MARGIN 8 .RIGHT MARGIN 64 .PAGE .FIGURE 4 .CENTER Introduction .BLANK .PARAGRAPH When application programs are executed under a time sharing executive, such as TSX or TSX-Plus [1,2], certain capabilities become desirable if not absolutly essential. These capabilities relate to requirements for such things as hardware dependent I/O, shared files and inter-program communication. Both TSX and TSX-Plus provide a number of programmed requests or EMT's for this purpose. .PARAGRAPH This paper describes a number of FORTRAN callable subroutines and their calling sequences that implement these EMT's. All of the routines are written in MACRO-11 [3]. They provide facilities that permit files to be shared, that allow running programs to communicate with each other, that determine the TSX line number and that determine the amount of free space available in the spool file. Procedures for building a library of these routines are also presented [4]. Source code is given in the appendix. .BLANK 3 .CENTER Communication Subroutines .CENTER MSGCOM.MAC .BLANK .PARAGRAPH Three subroutines provide the facilities that allow running programs to communicate with each other. These message communication facilities allow programs to send messages through named channels, check to see if any messages are pending and to suspend execution until a message is received. Suitable error codes are returned as required. The calling sequence is as follows: .BLANK .CENTER CALL XXXXXX (CHNAME,MSGBUF,MSGSIZ,IERR) .BLANK .LEFT MARGIN 24 .INDENT -16 Where: XXXXXX Subroutine name as follows: .LEFT MARGIN 32 .BLANK .INDENT -8 SNDMSG Send a message. .BLANK .INDENT -8 RCVMSG Receive a message, return if none pending. .BLANK .INDENT -8 RCVMSW Receive a message, wait for one if none pending. .LEFT MARGIN 24 .TEST PAGE 4 .BLANK .INDENT -8 CHNAME Six ASCII character name of the message channel. Must be six characters, backfill with spaces if necessary. .BLANK .INDENT -8 MSGBUF Name of the string array containing the message. .BLANK .INDENT -8 MSGSIZ Message length in characters. .BLANK .INDENT -8 IERR Error code returned as follows: .LEFT MARGIN 32 .BLANK .INDENT -8 0 No error. .BLANK .INDENT -8 1 All message channels busy. .BLANK .INDENT -8 2 Maximum allowed number of messages. .BLANK .INDENT -8 3 No message is pending on the named channel. .BLANK .INDENT -8 4 Message was too long and was truncated to maximum length. .BLANK 3 .LEFT MARGIN 8 .CENTER Shared Files .CENTER RCDLOK.MAC .BLANK .PARAGRAPH Four subroutines provide record locking facilities that are useful in situations where programs being run from several terminals wish to update a common file. Through these record locking facilities a program may gain exclusive access to one or more blocks in a file. Other programs attempting to lock the same block(s) will be denied access until the first program releases the locked block(s). Suitable error codes are returned as required. The calling sequence is as follows: .BLANK .CENTER CALL XXXXXX (ICHN[,IBLK],IERR) .BLANK .LEFT MARGIN 24 .INDENT -16 Where: XXXXXX Subroutine name as follows: .LEFT MARGIN 32 .BLANK .INDENT -8 SHRFIL Declare a shared file. .BLANK .INDENT -8 LKBLK Lock a block, return if already locked. .BLANK .INDENT -8 LKBLKW Lock a block, wait if already locked. .BLANK .INDENT -8 UNLBLK Unlock all locked blocks. .BLANK .LEFT MARGIN 24 .INDENT -8 ICHN Channel number open to the file. .BLANK .INDENT -8 IBLK Number of the block to be locked. Required for LKBLK and LKBLKW only. .BLANK .INDENT -8 IERR Error code returned as follows: .LEFT MARGIN 32 .BLANK .INDENT -8 0 No error. .BLANK .INDENT -8 1 Channel not open to a file. .BLANK .INDENT -8 2 Too many channels opened to shared files. .BLANK .INDENT -8 3 Too many shared files opened. .BLANK .INDENT -8 4 Channel not open to a shared file. .BLANK .INDENT -8 5 Request to lock too many blocks. .BLANK .INDENT -8 6 Requested block is locked by another user. .LEFT MARGIN 8 .BLANK 3 .CENTER Miscellaneous Subroutines .CENTER TSXMSC.MAC .BLANK .PARAGRAPH The first of these subroutines is used to determine if TSX is running and if so the TSX line number. It returns a single positive integer value to the calling program. If TSX is not running the value returned is zero. If TSX is running the value returned is the TSX line number. The second subroutine determines the integer value of the number of free blocks available in the spool file. Neither routine returns any error codes. The calling sequence is as follows: .BLANK .CENTER CALL XXXXXX (IVAL) .LEFT MARGIN 24 .BLANK .INDENT -16 Where: XXXXXX Subroutine name as follows: .LEFT MARGIN 32 .BLANK .INDENT -8 TSXTST Determine the TSX line number. .BLANK .INDENT -8 SPLBLK Determine the number of free blocks. .LEFT MARGIN 24 .BLANK .INDENT -8 IVAL The integer value returned. .LEFT MARGIN 8 .TEST PAGE 8 .BLANK 3 .CENTER Library Building .CENTER TSXLIB.COM .BLANK .PARAGRAPH The following outlines the procedures to build and use the several subroutines in a library format. RT-11 command strings to assemble the routines and build them into a library are given. Also shown are command strings to compile an application program and link it with the library. .BLANK .NOJUSTIFY .NOFILL .LEFT MARGIN 16 _.RUN MACRO *MSGCOM[,LP:/C]