Enscribe Programmer's Guide
External Declarations
Like all other procedures in an application program, the file-system procedures must be declared
before being called. These procedures, however, are declared externally to the application program
in a system file named $SYSTEM.SYSTEM.EXTDECS0. The compiler command SOURCE, specifying
this file, should be included in the source program after the global declarations but before the first
call to one of these procedures, as in this example:
global-declarations
?SOURCE $SYSTEM.SYSTEM.EXTDECS0 (external-procedure, ...)
procedure-declarations
Each external procedure used in the program should be specified in the SOURCE command. For
example,
?SOURCE $SYSTEM.SYSTEM.EXTDECS0 ( KEYPOSITION, WRITEUPDATE,
? FILE_OPEN_, FILE_CLOSE, READ, WRITE, POSITION, )
compiles only the external declarations for the KEYPOSITION, WRITEUPDATE, FILE_OPEN_,
FILE_CLOSE_, READ, WRITE, and POSITION procedures.
Sequential I/O (SIO) Procedures
The sequential I/O (SIO) procedures summarized in Table 6 provides HP Tandem Application
Language (TAL) programmers with a standardized set of procedures for performing common I/O
operations. These operations include reading and writing IN and OUT files, and BREAK from a
terminal. These procedures are primarily intended for system and user utility programs. The primary
benefit is that programs using these procedures can treat different file types in a consistent and
predictable manner.
The SIO procedures also contain a set of DEFINEs and LITERALs that allocate control-block space,
specify file-opening characteristics, and both set file and check file-transfer characteristics.
Table 6 SIO Procedures
FunctionProcedure
checks whether the BREAK key was pressedCHECK^BREAK
retrieves file characteristicsCHECK^FILE
closes a fileCLOSE^FILE
disables the BREAK keyGIVE^BREAK
opens a file for access by the SIO proceduresOPEN^FILE
reads from a fileREAD^FILE
sets or alters file characteristicsSET^FILE
enables the BREAK keyTAKE^BREAK
waits for the completion of an outstanding I/O operationWAIT^FILE
writes to a fileWRITE^FILE
SIO procedures have these characteristics:
• All file types are accessed in a uniform manner. File access characteristics, such as access
mode, exclusion modes, and record size, are selected according to device type and the
intended access. Default characteristics are set to facilitate their most general use.
• Error recovery is automatic. Each fatal error causes a comprehensive error message to be
displayed, all files to be closed, and the process to be aborted. Both the automatic error
handling and the display of error messages can be turned off so the program can do the error
handling.
44 System Procedures