Interfacing an IBM S/370 with HP9845

Author: F.Ulivi

License: CC-BY-SA


This recipe demonstrates how an IBM mainframe could be remotely accessed by a RJE (Remote Job Entry) utility on a HP9845B.

The typical setup included:

The "RJE" tool on the HP9845B emulates a 2780/3780 terminal. Synchronous communication with modem is handled by HP98046 module.





This figure shows the block diagram of the emulation setup.

A few notes:

  • 2780_listen is needed to bridge the Hercules and RJE variants of the Bisync protocol. The Hercules side lacks idle characters and CRC bytes whereas RJE on the HP9845 needs them. The 2780_listen is there to remove/add these parts as needed. Another function of this utility is to synchronize the bit stream coming from 98046 by identifying pairs of SYN characters.

  • The RJE disk, in addition to the RJE tool itself, holds a couple of useful files:


    Configuration file for this demo


    A ready-made FORTRAN program to compute & print all prime numbers less than 500

Hercules setup

  1. Install SDL-Hercules from
  2. Decompress (keeping the structure) into a freshly-made os360mvt directory
  3. You can either use the pre-built DASD images or build them yourself. In the former case, images are already included in the zip file (dasd directory) and step 4 is not needed. If, on the contrary, you want to build the images, erase all files in dasd directory and proceed to next step.
  4. To build the DASD images yourself, follow instructions from with the following exceptions:
    • When running stage 1 sysgen step, file jcl/stage1.jcl is to be substituted with jcl/stage1_mame.jcl in order to add the support for a remote BSC line at address 0020.
    • Pay special attention to the stage 2 sysgen step: input for this step comes from the output of the previous step! (i.e. you have to copy pch00d.txt to jcl/stage2.jcl before running it)
    • When building HASP, file haspjcl/p01gen.jcl is to be substituted with haspjcl/p01gen_mame.jcl to have a remote line defined (LNE1)
    • Last step (build & install TSO/TCAM) is not needed and can be skipped

Running Hercules

  1. cd into os360mvt directory (see Hercules setup)

  2. Start Hercules with hercules -f mvt_hasp_mame.cnf

  3. Connect a 3270 terminal emulator to TCP port 3270

  4. On Hercules console issue ipl 350 command to boot OS/360

  5. The 3270 terminal should display SPECIFY SYSTEM PARAMETERS FOR RELEASE 21.8F MVT, just press ENTER


  7. Reply r 00,u to confirm date & time.

  8. Change the display parameters by typing k s and adjusting the resulting line to read

    K S,DEL=rd,SEG=19,CON=n,RNUM=19,RTME=001

  9. Start HASP with s hasp

  10. The first time you run HASP reply r nn,format,noreq to nn $ SPECIFY HASP OPTIONS -- HASP-II VERSION 4.009762; just reply r nn,noreq from the second time on

  11. Issue the following HASP command to start remote line LNE1: $slne1

  12. Status of LNE1 can be checked with command $dlne1


3270 console after booting

Running 2780_listen

Just run it in a Python 3 interpreter. It waits for connection from MAME side, then tries to connect to Hercules side. Once connection is lost on either side, it returns to listen for incoming MAME connections (though I haven't tested this looping extensively).

Control-C stops this utility.

Starting hp_disk

  1. Start hp_disk
  2. Select 9895 drive model
  3. Set HPIB address to 0
  4. Load RJE disk image in unit 0

Starting MAME

  1. Start MAME with the following command line (add other options you may need):

    mess hp9845b -rompath <whatever> -rom1 datacomm -rom2 bisync -rom3 massd -slot0 98034_hpib -slot0:98034_hpib:ieee_rem remote488 -bitb1 socket.localhost:1234 -slot1 98046 -slot1:98046:rs232 rs232_sync_io -bitb2 socket.localhost:2780 -bitb3 print_out.txt
  2. Ensure emulated system is configured as shown here:

  1. Type MASS STORAGE IS ":H7" and press EXECUTE
  2. Type LOAD "RJE",1 and press EXECUTE
  3. RJE is now ready: see next section for usage.

RJE just after starting

Using RJE

RJE is a fairly sophisticated 2780/3780 emulator. It's entirely written in HP-BASIC. I couldn't find any manual online so I partially reverse engineered it from BASIC listing.

This is a summary of what I found.

  • It emulates all the peripherals composing a 2780/3780: keyboard, printer and card reader/punch.
  • Terminal peripherals can be mapped freely to HP9845 I/O devices: keyboard, CRT, integrated or HPIB printers and disk files.
  • It includes a rudimentary text file editor
  • It can be controlled/configured through either the keyboard or a script file

This table summarizes the actions associated with function keys.

Key Function
k0 Send a line of text
k1 Send a file
k2 Store a line into edited file
k3 Insert a line into edited file
k4 Delete a line from edited file
k5 Replace a line of edited file
k6 Toggle automatic reception
k7 Establish connection
k8 Move to next field
k9 Modify current field
k10 Toggle control script
k11 Define reader configuration
k12 Define printer configuration
k13 Define punch configuration
k14 Define general configuration
k15 Toggle monitor
k16 (SHIFT + k0) Toggle EOT insertion
k17 (SHIFT + k1) Connection abort
k18 (SHIFT + k2) Create a text file
k19 (SHIFT + k3) Edit an existing text file
k20 (SHIFT + k4) Delete an existing text file
k21 (SHIFT + k5) List an existing text file
k22 (SHIFT + k6) Copy rest of file when editing
k23 (SHIFT + k7) Disconnect
k24 (SHIFT + k8) Move to previous field
k25 (SHIFT + k9) Modify current field
k26 (SHIFT + k10) Define control script
k30 (SHIFT + k14) Dump low level tracing
k31 (SHIFT + k15) Define monitor configuration

After RJE starts (see Starting MAME) you can try some canned action by pressing k10 to execute pre-compiled CTL$ script file and then k1 to send PRIME3 file over to S/370 for remote processing. Once this file has been transferred, RJE receives and prints output from mainframe on internal printer (MAME actually stores it in print_out.txt file).

The whole processing of PRIME3 takes about 2 minutes.


RJE after processing PRIME3


3270 console after processing PRIME3

Shutting down

  1. Disconnect RJE from S/370 (press SHIFT + k7 on HP9845)
  2. Stop MAME
  3. Stop 2780_listen
  4. Close hp_disk
  5. Disable LNE1 line by typing $plne1 on 3270 terminal
  6. Stop HASP with $phasp. Sometimes it replies with HASP NOT DORMANT, just ignore it.
  7. Stop OS/360 with z eod
  8. Exit Hercules by typing quit at the herc =====> prompt
  9. Collect your printout (in print_out.txt).