Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Processing magnetic tape files

COBOL2000 supports the processing of magnetic tape files by means of the following language elements (see “COBOL2000 Reference Manual” [1]):

  • The INPUT...REVERSED and WITH NO REWIND phrases in the OPEN statement:

    Each of these phrases prevents the file position indicator being set to the start of the file when the file is opened.

    INPUT...REVERSED causes a file to be positioned at its last record when the file is opened. Records of the file can then be read in reversed (i.e. descending) order.

    WITH NO REWIND can be specified for OPEN INPUT as well as OPEN OUTPUT and prevents the file from being repositioned when the OPEN statement is executed.

  • The REEL, WITH NO REWIND and FOR REMOVAL phrases in the CLOSE statement:

    REEL is permitted only for multi-volume files, i.e. files that are distributed over more than one data volume (magnetic tape reels in this case). Depending on the open mode of each file, this phrase initiates the execution of different volume-closing operations at the end of the current reel (see CLOSE statement in “COBOL2000 Reference Manual” [1]). If the WITH NO REWIND or FOR REMOVAL has also been specified, the actions associated with these phrases (see below) are also performed at the end of the volume.

    The WITH NO REWIND phrase causes the current reel to be left in its current position (i.e. not repositioned to the start of the reel) when processing of the file or reel is closed.

    FOR REMOVAL indicates that the current reel is to be unloaded at the end of the file or at the end of the magnetic tape reel.

Assignment of magnetic tape files

Like disk files, magnetic tape files can also be assigned via the ADD-FILE-LINK command and supplied with attributes (see section "Assignment of cataloged files" and section "Definition of file attributes"). A detailed description of the command format for tape files is provided in “Commands” manual [3] and “Introductory Guide to DMS” [4].

Example 9-8

Assigning a tape file

/SEC-RESOURCE-ALLOC,TAPE=PAR(VOL=CA176B,TYPE=T6250,ACCESS=WRITE) ——————(1)
/CREATE-FILE STOCK.NEW,SUPPORT=TAPE(VOLUME=CA176B,DEVICE-TYPE=T6250)———(2)
/ADD-FILE-LINK OUTFILE,STOCK.NEW ——————————————————————————————————————(3)
/START-PROGRAM *LIB(PLAM.LIB,UPDATE) ——————————————————————————————————(4)
...
/REMOVE-FILE-LINK OUTFILE,UNLOAD-RELEASED-TAPE=YES—————————————————————(5)

(1)

For batch operations in particular, it is recommended that the required private volumes and devices be reserved with SECURE-RESOURCE-ALLOCATION before processing begins. In the above example, the tape with VSN CA176B is requested on a tape device with a recording density of 6250 bpi (TYPE=T6250) and a mounted write-permit ring (ACCESS=WRITE).

(2)

The CREATE-FILE command

  • catalogs the file STOCK.NEW as a tape file and

  • links the volume serial number (VOLUME) and the tape device (DEVICE-TYPE)

(3)

The ADD-FILE-LINK command links the file name STOCK.NEW with the link name OUTFILE.

(4)

START-PROGRAM calls the problem program that is stored as a program under the element name UPDATE in the PLAM library PLAM.LIB.

(5)

On completion of processing, the REMOVE-FILE-LINK command

  • releases the link between the file STOCK.NEW and the link name OUTFILE and

  • causes the tape CA176B to be unloaded; the tape device is released by default.