Preface
Using the Hercules hardware emulator to run MVS 3.8J declares various files on your PC OS (e.g. Windows, Linux) file system such as MVS DASD devices, communication devices, MVS printer output, MVS logs, and punched output.
A Hercules configuration file may contain the following unit-record devices as depicted in the below sample snippet:
. . # Card Readers 000C 3505 3505 sockdev ascii eof 010C 3505 jcl/dummy eof 020C 2501 * eof # Card Punches 000D 3525 pch/pch00d.txt ascii 010D 3525 pch/pch10d.txt ascii 020D 3525 pch/pch20d.txt ascii # Line Printers 000E 1403 1433 sockdev 000F 1403 prt/prt00f.txt crlf noclear 010E 1403 prt/prt10e.txt crlf noclear 030E 1403 /log/hardcopy-mvs.log crlf noclear . .
After each MVS 3.8J shutdown and IPL, Hercules allocates resources as defined in a configuration file (e.g. MVS.conf or tk4-.conf). Note the various options for each device (e.g. ASCII, CRLF, NOCLEAR, etc.).
In the above snippet, unit-record devices are allocated as described below:
- Card Punch 000D uses filename prt/pch00d.txt at current directory using ascii code set
- Line Printer 000E uses sockdev (TCP/IP sockets connection, e.g. HERCPRT Windows Application)
- Line Printer 000F uses filename prt/prt00f.txt at current directory using crlf (carraige return line feed) sequences at the end of each line and and noclear (do not clear file on subsequent output)
- Line Printer 010E uses filename prt/prt10e.txt at current directory using crlf (carraige return line feed) sequences at the end of each line and noclear (do not clear file on subsequent output)
- Line Printer 030E uses filename hardcopy-mvs.log at directory /log using crlf (carraige return line feed) sequences at the end of each line and noclear (do not clear file on subsequent output)
The same file name is re-used given the above configuration. Meaning, a previous version of content is overlaid (lost) when MVS 3.8J is restarted (i.e. IPL).
Keeping my Files
When I first started using Hercules, I desired to retain output files from each IPL of my MVS 3.8J system for reference purposes.
One approach for keeping previously used files (from MVS and Hercules) is to uniquely append a unique identifier as part of the file name.
By using symbolic or environment parameters, dynamic value substitution can be utilized in Hercules configuration file(s) similar to use of symbolic parameters in a MVS JCL PROC.
In TK3 or TK4-, MVS 3.8J is typically started via a Windows Batch Command file or Linux Script.
The below snippet of a Windows Batch Command file shows the setting of various environment variables:
. . :: :: *********************************************** :: * Set BASEDIR environment variable * :: *********************************************** SET BASEDIR="m:/mvs38j" :: :: *********************************************** :: * Set PortRDR environment variable * :: *********************************************** SET PortRDR=3535 :: :: *********************************************** :: * Set TStamp environment variable * :: * TStamp=2015-07-20_21-49-16 * :: *********************************************** :: :: Get TIME e.g. 21:49:16 SET TStamp=%TIME:~-11,2%-%TIME:~-8,2%-%TIME:~-5,2% :: Get DATE e.g. 2015-07-20 :: and append to modified TIME from above SET TStamp=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%_%TStamp% :: Replace / with - SET TStamp=%TStamp:/=-% :: Replace : with - SET TStamp=%TStamp::=-% :: Replace blank with 0 i.e. midnight time contains blank and 0 (" 0-23-01") SET TStamp=%TStamp: =0% . .
Refer to the Hercules User Reference for more information regarding configuration file options including use of symbolic variables.
The below snippet exhibits use of symbolic variables (set prior to using the specific symbolic) in the Hercules configuration file:
. . # Card Readers 000C 3505 $(PortRDR) sockdev ascii eof 010C 3505 $(BASEDIR)/jcl/dummy eof 020C 2501 * eof # Card Punches 000D 3525 $(BASEDIR)/pch/pch00d-$(TStamp).txt ascii 010D 3525 $(BASEDIR)/pch/pch10d-$(TStamp).txt ascii 020D 3525 $(BASEDIR)/pch/pch20d-$(TStamp).txt ascii # Line Printers 000E 1403 1433 sockdev 000F 1403 $(BASEDIR)/prt/prt00f-$(TStamp).txt crlf noclear 010E 1403 $(BASEDIR)/prt/prt10e.txt crlf noclear 030E 1403 $(BASEDIR)/log/hardcopy-mvs-$(TStamp).log crlf noclear .
This item of focus is the use of TStamp which holds a date-time stamp value initialized each time MVS 3.8J is IPL-ed to provide a value to easily and uniquely identify selected file names associated with each execution of MVS 3.8J!
Assume TStamp = 2015-07-20_21-49-16, after symbolic substitution, configuration file statements are transformed as shown below:
. . # Card Readers 000C 3505 3535 sockdev ascii eof 010C 3505 m:/mvs38j/jcl/dummy eof 020C 2501 * eof # Card Punches 000D 3525 m:/mvs38j/pch/pch00d-2015-07-20_21-49-16.txt ascii 010D 3525 m:/mvs38j/pch/pch10d-2015-07-20_21-49-16.txt ascii 020D 3525 m:/mvs38j/pch/pch20d-2015-07-20_21-49-16.txt ascii # Line Printers 000E 1403 1433 sockdev 000F 1403 m:/mvs38j/prt/prt00f-2015-07-20_21-49-16.txt crlf noclear 010E 1403 m:/mvs38j/prt/prt10e.txt crlf noclear 030E 1403 m:/mvs38j/log/hardcopy-mvs-2015-07-20_21-49-16.log crlf noclear .
- Card Reader 000D uses port 3505 for TCP/IP sockets transport to submit data to JES reader using ascii code set and eof
- Card Punch 000D uses filename pch00d.txt at directory m:\mvs38J\prt using ascii code set
- Line Printer 000E uses a TCP/IP sockets connection (i.e. HERCPRT Windows Application)
- Line Printer 000F uses filename prt00f.txt at directory prt using crlf (carriage return line feed) sequences at the end of each line
- Line Printer 010E writes to filenameprt10e.txt at directory prt using crlf (carriage return line feed) sequences at the end of each line and noclear (do not clear file on subsequent output)
- Line Printer 030E
Cleaning up…
With this enhanced file naming approach, disk space consumption on your PC is increased as MVS 3.8J IPLs are realized!
Thus, an automated clean up process is warranted where each directory holding uniquely named files is interrogated using the time-stamp portion of the file name to determine disposition (archival and/or deletion).
Alternatively, frequently review usage of PC disk space on the directories of interest and manually archive and/or delete special named files (with date-time stamp) such as printer or hardcopy output.
I will leave this task as a challenge for the reader.
Closing…
This post is a short communication for awareness purposes which outlines an alternative file naming approach that facilitates keeping files created by each Hercules execution for later reference.
Refer to the Hercules Users manual for additional information and configuration declaration / usage.
The Hercules console log may be specified in the Hercules start-up command, typically:
hercules -f 3033.log
The same approach of appending a date-time stamp can be applied to the file name 3033.log
With a simple time-stamp file naming approach, logs and other files can be safe kept for later reference.
Enjoy your mainframe!
Larry Belmontes