A simple REXX tool to test TCP/IP HTTP/HTTPS connection with a remote host using the z/OS Web Enablement Toolkit.
- z/OS Web Enablement Toolkit should be available.
For further details make sure to check the z/OS MVS Programming Callable Services for High-Level Languages" documentation.
Upload the REXXCON.rex code to a z/OS dataset with the following specifications
- LRECL: >= 80
- Record format: FB
REXXCON takes 2 arguments:
- input_url: The remote host URL (i.e https://google.com)
- port_number: The remote port number for the connection (i.e 443 for HTTPS or 80 for HTTP)
You can call the REXXCON tool from either JCL or from another REXX script.
From JCL
//TESTJCL JOB (AEA1,MVS),TESTCARD,CLASS=9,MSGCLASS=X,
// NOTIFY=&SYSUID
//STEP02 EXEC PGM=IKJEFT01
//SYSPROC DD DSN=<REXX.LIBRARY>,DISP=SHR
//SYSTSPRT DD SYSOUT=A
//SYSTSIN DD *
REXXCON https://google.com 443
/*
From REXX
Call REXXCON "https://google.com" "443"
The output might contain additional debug information, but the end result should have something like this:
--------------------------------------------------
____ _______ ___ ____________ _ __
/ __ \/ ____/ |/ / |/ / ____/ __ \/ | / /
/ /_/ / __/ | /| / / / / / / |/ /
/ _, _/ /___ / |/ / /___/ /_/ / /| /
/_/ |_/_____//_/|_/_/|_\____/\____/_/ |_/
--------------------------------------------------
>> REXXCON [Info] - Initiating REXXCON...
>> REXXCON [Info] - Retrieving toolkit constants...
>> REXXCON [Info] - Creating handler...
>> REXXCON [Info] - Setting up connection...
>> REXXCON [Info] - Connecting to host...
>> REXXCON [Info] - Connection successful!
>> REXXCON [Info] - Initiating disconnection procedures...
>> REXXCON [Info] - Terminating handler...
>> REXXCON [Info] - Have a great day!
To connect using HTTPS (Some remote hosts only accept HTTPS) make sure to properly configure AT-TLS on your environment so the connection can be upgraded to HTTPS.
In absence of an AT-TLS policy you can create a SAF keyring containing the digital certificate of the remote host.
Once the Keyring is created update the REXX code with the following:
/* Security variables */
use_keyring = 'YES'
ssl_keyring = '<KeyRing Owner>/<KeyRing>'
Where:
- use_keyring: Should be YES
- ssl_keyring: Should contain the Keyring in the format described above. (i.e "Userid/KeyRingName")
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.