NAME
MVS::VBFile - Perl extension to read variable blocked files from MVS
SYNOPSIS
use MVS::VBFile;
$next_record = vbget(*FILEHANDLE);
@whole_enchilada = vbget(*FILEHANDLE);
DESCRIPTION
This module provides a single function, vbget(), to get records from a mainframe MVS file in variable blocked (VB) format. It works like the angle operator: when called in scalar context, it returns the next record; when in array context, it returns the entire file in a single array. The file must be in "binary" format (no translation of bytes) and include the block and record descriptor words.
The rationale behind this is as follows. Most files from MVS systems are either fixed-length (record format FB) or variable-length (recfm VB). Perl can read fixed-length mainframe files just as it reads other fixed-length files -- open, read a certain number of bytes, close -- but variable-length files require some special handling. Since Perl provides open and close, the only function needed is one to get the next record.
Read the file as follows:
open FILEHANDLE, "..name..";
while (vbget(*FILEHANDLE)) { # Be sure to use '*'!!
# process and reality...
}
# OR do this:
@much_in_little = vbget(*FILEHANDLE);
# and then process the array (only on small files, of course).
close FILEHANDLE;
RESTRICTIONS
VB is the only format supported. In particular, this function will not work properly on format V (unblocked variable-length) or VBS (spanned). Since VB is by far the most commonly used format, this should not be a major snag.
AUTHOR
W. Geoffrey Rommel, grommel@sears.com, March 1999.