via the Socket Reader
The “sockdev” option allows you to submit cards directly to a Hercules card reader from outside of Hercules. The card reader must be defined with the “sockdev” keyword and either a TCP/IP port number or the name of a Unix Domain Socket. Then whenever you want to submit a card deck to that particular card reader, you use an external program to connect to the socket and transmit the cards to the reader. Socket readers were implemented by Fish, based upon code originally contributed by Malcolm Beattie.
Socket readers are defined in the Hercules configuration like this:
Descriptive
devnum devtype sockspec SOCKDEV [option [option ... ]]
Parameters devnum, devtype and the keyword SOCKDEV are the same as described in chapter 6.5 (“Card Reader Devices”).
The socket specification sockspec can take any of the following formats:
ipaddr:port The reader listens on the specific IP address and port number. ipaddr must be The IP address of an interface on the local system.
For example, “127.0.0.1:1234” is used to accept only jobs submitted locally via the loopback interface.
hostname:port Similar to the previous example, where hostname must resolve to an IP address belonging to the local system.
Example:
“localhost:1234”.
port The reader listens on the specified port number and accepts jobs submitted from any IP address defined on the local system.
Example:
“1234”.
path/name The reader listens on the specified Unix Domain Socket.
Example:
“/tmp/hercrdr.00C”
Examples:
000A 2501 127.0.0.1:2501 SOCKDEV ASCII TRUNC EOF 000C 3505 localhost:1234 SOCKDEV ASCII TRUNC EOF 0012 3505 3505 SOCKDEV ASCII TRUNC EOF 0014 2501 /tmp/hercrdr.014 SOCKDEV ASCII TRUNC EOF
The “HercRdr” program is distributed as part of Fish’s GUI package and allows you to send jobs to a socket reader via TCP/IP. Simply enter “HercRdr” from the command line (i.e. from a “Command Prompt” window if you are using Windows NT / 2K / XP) to submit your file(s).
The following screen print shows the help information from the HercRdr program that is displayed whenever the program is called without parameters:
If you are lucky enough to have a copy of the excellent editor SPF/PC Version4 or SPF/Pro (produced by CTC but unfortunately no longer available), then you can submit jobs directly from your edit session. The SUB command can be implemented by means of a REXX macro such as the following one, provided by Volker Bandke:
/* +----------------------------- REXX -----------------------------+ */ /* */ /* Name: D:\APPS\SPFPRO\REXX\USER\SUB.SPF */ /* */ /* Type: SPF edit macro */ /* */ /* Desc: submit JCL to MVS 3.8 */ /* */ /* Creation date: 24 Aug 1999, creation time: 18:49:40 */ /* */ /* Author: (c) Volker Bandke */ /* */ /* +----------------------------------------------------------------+ */ 'isredit macro (p1 p2 p3 p4 p5 p6 p7 p8 p9)' "ISREDIT (member) = MEMBER" "ISPEXEC CONTROL ERRORS CANCEL" parse upper var member file '.' ext do 'ISREDIT REPLACE' $$$$$$$$.SPF '.ZF .ZL' ADDRESS "CMD" "HERCRDR 192.168.1.102:3505 $$$$$$$$.SPF" zedsmsg = 'File submitted' zedlmsg = 'The member '||member||' has been submitted to MVS' 'ispexec setmsg msg(isrz000)' ADDRESS "CMD" "DELETE $$$$$$$$.SPF" end EXIT 0
Submitting jobs from Unix can be done in two different ways, described in detail in the next sections:
Malcolm Beattie has provided a simple Perl script which can submit jobs using either TCP/IP or Unix Domain Sockets. The script is invoked using one of the following command formats:
hercsub 192.168.1.102:3505 dummy.jcl hercsub /tmp/hercrdr.00C dummy.jcl
Here is the Hercsub script:
============== hercsub ================ #!/usr/bin/perl use Socket; use IO::Socket::UNIX; use IO::Socket::INET; if (@ARGV < 1) { print STDERR "Usage: hercsub socket_spec [job]\n"; exit 2; } my $spec = shift @ARGV; my $sock; if ($spec =~ m{^/}) { $sock = IO::Socket::UNIX->new(Peer => $spec); } else { $sock = IO::Socket::INET->new(PeerAddr => $spec); } die "Failed to connect to socket $spec: $!\n" unless defined($sock); while (<>) { print $sock $_; } ========== end of hercsub =============
The netcat (nc) program can also be used to submit files to a Hercules reader via TCP/IP. Install netcat (which is useful for many other things as well) and use the following syntax:
nc –w1 localhost 1234 < dummy.jcl
For more information on the netcat program, type man nc from the Unix shell.