By Jay Moseley
What started out to be a Q&D program, ended up being something I thought might be worth sharing here. Then it grew into a major project that took a couple of weeks to complete. Can you say "mission creep"?
Basically I wanted to be able to read in ASCII, Line Sequential files and build AWSTAPE image files that could be read and processed under MVT/MVS. I suppose that I could have kept it simple and it would have remained a Q&D solution to a specific need. But, I expanded it to be able to optionally:
I know it will probably draw some criticism because I wrote it in BASIC, but I was writing pretty complex BASIC code long before I heard of C++ and can still turn out a BASIC program faster than the C++ equivalent. I still have and use the final release of Microsoft's Professional Development System which is way beyond the dinky QBASIC that is stuck on all the DOS/Windows systems now.
Thanks to the diligence of Rob Dieters in finding my misplaced Tape Marks as I worked out the single/multiple output files, I finally got all the options working as I envisioned them. Then I spent another week writing C equivalents of the original program and getting that to the point it would produce the AWSTAPE image files over under Linux. Even though the compiled BASIC versions ran under DOSEMU, I wanted to have a native version.
The source is included in the archives available for download, so you can look at the source to see what I am doing if you are interested. Note that I am not primarily a C programmer, so please don't send me harsh criticism of my C coding style. Otherwise if something seriously needs correcting, do please let me know.
The program is compiled as MAKETAPE.EXE. If you execute the program with no parameters it will display a message with the syntax it expects:
The keywords for the parameters may be abbreviated to single characters (i, v, d, o, l, b, u). The colon following the keyword may also be omitted.
There are four required keyword parameters - input, volser, dataset, and output.
INPUT - specifies the source file to be read to create the data blocks. This may specify a single file or a metafile; that is, a file containing the names of other files that will be read in sequence to build the input. Preface the name with an at sign ('@') to designate a meta file. The file should be created with a plain text editor, one file name per line, maximum of 50 lines (file names). In the C version, I allow for 64 character file names, which should be adequate for most needs.
VOLSER - specifies a one to six alphanumeric character volume serial number that will be written to the standard labels and used as the output dataset name. My System 370 Job Control Language (Gary DeWard Brown, second edition) specifies that serial numbers less than six characters are right justified and padded with blanks in standard tape labels, so that is how I handle it here.
DATASET - specifies a one to seventeen alphanumeric character dataset name. This will be used to match to the DSN parameter on the DD card, so you need to make it conform to the naming conventions for MVT datasets. I don't do any enforcement of this field; I only copy it over to the labels in the appropriate position. (see related information in UNIQUE)
OUTPUT - specifies the output file which will contain the AWSTAPE image.
In the BASIC version, if the output file already exists with the same dataset name in the same subdirectory, you will be prompted to overwrite or abort:
Reply Y to overwrite the existing file or reply N to terminate the program.
There are three optional keyword parameters - lrecl, block, and unique.
LRECL - specifies the logical record size of both the input data record and the output data record. Input records which are longer than the length specified here will be truncated to this length. The default is 80.
BLOCK - specifies a blocking factor used to calculate the output block size (ie., the value of LRECL multiplied by the value of BLOCK yields the output BLKSIZE). The default is 1 and I have established an arbitrary upper limit of 200.
Note that the LRECL and BLOCK parameters will apply to all files processed if the input file is a meta file rather than a single input file.
UNIQUE - can be used to indicate that each input file is to be placed in a separate output dataset on the AWSTAPE image. The dataset name used for the output datasets will be modified by appending a low order qualifier consisting of the four digit file sequence number in order to ensure each dataset name on a tape volume is unique for MVT's use. If the dataset name supplied when the program is executed is longer than twelve characters, the name supplied will be truncated to allow for the appending of the file sequence qualifier. The default if UNIQUE is not specified is to aggregate all input files into a single output file on the AWSTAPE image.
All parameters will be verified before any processing begins. If the meta file or single input file is not present, the program will not run. If there are more than fifty files in the meta file, any beyond fifty will be ignored. Any individual files in the meta file that are not present are simply skipped, but if you specify a meta file and none of the files are present, the program will not make it past the parameter validation.
I have tried to be as accurate as possible building the VOL/HDR1/HDR2/EOF1/EOF2 label records. I set the creation date to the day of year (commonly known as julian) format using the system date. This may cause a problem if your system date is set correctly because the label fields are pre-Year-2000 and I don't have the century field available in the label. I set the expiration date to 99365 which usually signifies non-expiring datasets. The C date routines seem to not be adjusting for leap year correctly, so the day of year returned is off by one, at least under my environment (Caldera Open Linux).
As the input files are processed, messages are issued to indicate what files are processed and as the trailing dataset label is written, the count of blocks written to the image file is displayed on the screen:
As I worked on MAKETAPE, I found it necessary to write a program that expanded upon Jay Maynard's tapemap program. My TAPEDUMP program will provide a bit more summary information for the datasets found on an AWSTAPE image and will also allow the specification of a 'DETAIL' parameter to translate from EBCDIC and print the data records along with their associated AWS header information.
Like MAKETAPE, if you execute TAPEDUMP with no parameters, it will display the required syntax:
The default is summary mode, which results in the display of:
If you need to see the entire contents of the tape, include the DETAIL parameter to see output similar to:
Note: As it is currently written, TAPEDUMP will only process tapes written with Standard Labels as it requires the information contained in the labels to deblock and process the data in individual records.
The sources and executable binaries for TAPEDUMP are included in the downloadable archives above.
I hope that if you use MAKETAPE, you find it beneficial. If you have questions that I can answer or problems that I need to fix, please don't hesitate to let me know:This information was obtained from Jay Moseley's WEB Site and reproduced with permission.
The information on this site is the combined effort of a lot of people,
please credit the authors if you use their information.