Tape I/O from a program
Typically, applications written in RPG or COBOL perform data record input and output (I/O) to database files. However, in some applications these files may be so large, that you never store them on disk. You store them on tape, and process them sequentially by application programs, either for input or for output, but not both at once. On the IBM® i platform, this is done using a tape file object.
Such applications have the same requirements for control and tracking of the media on which the operations are performed as do media used for normal save and restore operations. This chapter discusses how you can use these types of tape file I/O applications with BRMS.
The example in Figure 1 shows typical tape file processing from an application. It is a simple RPG program which writes the alphabet 100 times to a tape.
FTAPFIL O F 26 SEQ
F******************************************************************
F* Program: TAPFIL
F* Purpose: This program will write the 26 letters of the
F* alphabet to a file on tape through a tape file. The
F* alphabet is written 100 times.
F*
F******************************************************************
C DO 100 Loop 100 times
C EXCPTALPHA Write alphabet
C END End of loop
C*
C SETON LR End the program
O*******************************************************************
O* Exception output defining the alphabet to be written
O*
O*******************************************************************
OTAPFIL E ALPHA
O 24 'ABCDEFGHIJKLMNOPQRSTUVWX'
O 26 'YZ'
Create Tape File (CRTTAPF)
Type choices, press Enter.
File . . . . . . . . . . . . . . TAPFIL Name
Library . . . . . . . . . . . BRMTAPF Name, *CURLIB
Tape device . . . . . . . . . . *NONE Name, *NONE
+ for more values
Volume identifier . . . . . . . *NONE Character value, *NONE
+ for more values
Tape reels specifications:
Label processing type . . . . *SL *SL, *NL, *NS, *BLP, *LTM
Number of reels . . . . . . . 1 1-255
Sequence number . . . . . . . . 1 1-16777215, *END, *NEXT
Tape label . . . . . . . . . . . TAPEFILXMP
File type . . . . . . . . . . . *DATA *DATA, *SRC
Text 'description' . . . . . . . 'Tape file example'
Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys
Override with Tape File (OVRTAPF)
Type choices, press Enter.
File being overridden . . . . . TAPFIL Name
Overriding to tape file . . . . *FILE Name, *FILE
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Device . . . . . . . . . . . . . TAP03 Name
+ for more values
Volume identifier . . . . . . . Character value, *NONE
+ for more values
Tape reels specifications:
Label processing type . . . . *SL, *NL, *NS, *BLP, *LTM
Number of reels . . . . . . . 1-255
Sequence number . . . . . . . . 1-16777215, *END, *NEXT
File label . . . . . . . . . . .
Record length . . . . . . . . . Number, *CALC
Block length . . . . . . . . . . 1-524288, *CALC
Buffer offset . . . . . . . . . Number, *BLKDSC
Record block format . . . . . . *F, *FB, *V, *VB, *D, *DB...
More...
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys
This associates the tape file name to the tape device. Notice that the volume ID field is not specified.
CALL BRMTAPF/TAPFIL
The records are written to the tape.