Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 108
Accessing an Unlabeled Tape File: An Example
!------------------------------------------------------------
! Procedure to perform initialization for the program. It
! calls INITIALIZER to read and copy the Startup message
! into the global variables s area and then opens the IN file
! specified in the Startup message. This procedure also
! opens the tape file and sets buffered mode for tape access.
!------------------------------------------------------------
PROC INIT;
BEGIN
STRING .TAPE^NAME[0:MAXFLEN - 1];
STRING .TERM^NAME[0:MAXFLEN - 1];
INT TAPELEN;
INT TERMLEN;
INT OPEN^FLAG;
INT ERROR;
! Read and save the Startup message:
CALL INITIALIZER(!rucb!,
!passthru!,
SAVE^STARTUP^MESSAGE);
! Open IN file:
ERROR := OLDFILENAME_TO_FILENAME_(
CI^STARTUP.INFILE.VOLUME,
TERM^NAME:MAXFLEN,TERMLEN);
IF ERROR <> 0 THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
ERROR := FILE_OPEN_(TERM^NAME:TERMLEN,TERMNUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
! Open the tape file for exclusive access:
ERROR := OLDFILENAME_TO_FILENAME_(
CI^STARTUP.OUTFILE.VOLUME,
TAPE^NAME:MAXFLEN,TAPELEN);
IF ERROR <> 0
THEN CALL FILE^ERRORS^NAME(TAPE^NAME:TAPENUM,ERROR);
ERROR := FILE_OPEN_(TAPE^NAME:TAPELEN,TAPENUM,
!access!,
1);
IF ERROR <> 0
THEN CALL FILE^ERRORS^NAME(TAPE^NAME:TAPELEN,ERROR);
! Set buffered mode:
CALL SETMODE(TAPENUM,99,1);
IF <> THEN CALL FILE^ERRORS(TAPENUM);
END;