Hercules virtual tape review

Previously, I talked about Hercules virtual tapes without being specific. I find this useful for getting large amounts of data to a MVS dataset. So here I find myself reviewing/documenting the procedures…again!

These below examples are using test data with a fixed length of 165 characters!

Example data!

Getting the data

It seems I created some fixed length test records with various record counts in ~/Mystuff/COBOL/data/
Since I need to be able to view the files on Linux they have one extra byte at the end that the mainframe doesn’t need…the new line character. It would be hard to view a large file on Linux without this character as most editors are looking for it.
Mainframe files or datasets are best created as fixed length fields and lengths.
I use a Python program to create a lot of real looking test records. This program uses the mimesis package, so currently mimesis is installed in a virtual environment, and can be accessed as follows.
conda deactivate
cd ~/Mystuff/Python3/project1_env/
source bin/activate

Converting the data to a Virtual Tape file

Note: I moved Jay’s “C” programs (maketape and tapedump) to “/usr/local/bin” so I can run them anywhere!

Once the test or real data is created as a Linux ASCII file, it needs to be converted to a EBCDIC virtual tape file. I use Jay Mosley’s maketape program. See here to get maketape. Example below. The dollar sign is the Linux command line prompt.

Here’s how I’d use maketape to convert the linux file into a Hercules mainframe virtual tape dataset

$ maketape INPUT: customer.txt VOLSER: VOL001 DATASET: CUSTOMER.FILE OUTPUT: TAPE04.AWS LRECL: 165 BLOCK: 100
MAKETAPE v1.1 (C) copyright Jay Moseley, CCP 2000
Processing input from: customer.txt
Wrote 1001 blocks to AWSTAPE file: TAPE04.AWS (Seq #0001 Dataset:CUSTOMER.FILE )
$

Viewing Virtual tape info locally

tapedump is useful for virtual tapefiles that you may have forgot details about. It can provide useful information needed for your JCL, DD card. See the IEBGENER utility in the next section.

$ tapedump I: TAPE01.AWS
TAPEDUMP v1.0 (C) copyright Jay Moseley, CCP 2000
Processing AWSTAPE file: TAPE01.AWS
Serial Number from VOLume 1 label: VOL001

File MVT Dataset RECFM BLKSIZE LRECL BlocksExpected BlocksRead
0001 CUSTOMER.FILE F 16500 165 1001 1001
$

Apparently there exists a program called “hetmap” that gives more details than TAPEDUMP.

Processing the virtual tape on the mainframe

You can either use a custom program (for example COBOL or Assembler) on the mainframe. For example the select statements in the COBOL program in my case looks like this…

SELECT IN-FILE ASSIGN TO UT-S-INTAPE.
SELECT OUT-FILE ASSIGN TO DA-S-OUTDISK.


Or you can use the IBM utility IEBGENER to load this virtual tape file to disk. As far as these programs are concerned this file is a tape!

IEBGENER (upload) Jcl

//TAPEDASD JOB (12345678),BILL,CLASS=A,MSGCLASS=A,
// MSGLEVEL=(1,1),USER=HERC01,PASSWORD=CUL8TR
//STEP01 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUT1 DD DSN=CUSTOMER.FILE,UNIT=TAPE,VOL=SER=VOL001,
// DISP=OLD,LABEL=(,SL)
//SYSUT2 DD DSN=CUST.MILLION.DATA,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(200,10),RLSE),
// UNIT=3350,
// VOL=SER=WRK142,
// DCB=(DSORG=PS,RECFM=FB,LRECL=165,BLKSIZE=16500)
//SYSIN DD *
GENERATE MAXFLDS=1
RECORD FIELD=(165)
/*

After submitting this Job it will wait for the tape
You should get a message from the console like so…

HHC01603I devinit 00c /home/bill/Mystuff/Mainframe/MVS/JCL/TAPEDASD/TAPEDASD.JCL
HHC01046I 0:000C COMM: device unbound from socket 3505
HHC00101I Thread id 7F65F81BC700, prio 0, name Socket device listener ended
HHC02245I 0:000C device initialized
16.31.23 JOB 769 $HASP100 TAPEDASD ON READER1 BILL
16.31.23 JOB 769 $HASP373 TAPEDASD STARTED – INIT 1 – CLASS A – SYS TK4-
16.31.23 JOB 769 IEF403I TAPEDASD – STARTED – TIME=16.31.23
16.31.23 JOB 769 *IEF233A M 480,VOL001,,TAPEDASD,STEP01
herc =====>

As you can see from the last message IEF233A, the job is looking for a tape on device 480

Which you supply by giving Hercules the following command
devinit 480 pathToVirtualTape/TAPE01.AWS

Some other useful Hercules tape commands

Check for tape drives:
/d u,tape
/v 480,online

You can use dslist in TSO (to easily look at the dataset)