I have a REXX exec on z/OS 1.4 that is sending information to a Perl program on a UNIX box. The listening program on the UNIX box is sending an acknowledgement message back down the socket. My REXX program does not get the response. Can anyone help me?
Here is the program:
*****************************************************
/**
=== mf2ito - Send error notifications to ito using network socket.
=== (If ito does not return an ack, then to symon and console).
===
===
=== +---- GROUP(misc) ----------+
=== mf2ito --->+---------------------------+--->
=== +---- GROUP(mq) ------------+
===
=== +---- SEV(1) ---------------+ (normal)
=== +---------------------------+--->
=== +---- SEV(2) ---------------+ (warning)
=== +---- SEV(3) ---------------+ (minor)
=== +---- SEV(4) ---------------+ (major)
=== +---- SEV(5) ---------------+ (critical)
===
=== +---------------------------+--->
=== +---- APPL(?) --------------+
===
=== +---------------------------+--->
=== +---- NODE(?) --------------+
===
=== +---------------------------+--->
=== +---- OBJ(?) ---------------+
===
=== +---- MSG(TEXT) ------------+
===
===
=== Change history:
=== 09/01/2005 (bag) - Copied from SYMONSAY script.
=== 09/01/2005 (bag) - Straighten out the socket calls, get
=== positive acknowledgement from listener.
**/
host = "xxxxxxxx.ameren.com"
port = "99999"
dlm = " ~%~ "
say "Sending message to ito(" host":"port")"
parse upper arg text
parse var text "SEV("sev")"
parse var text "GROUP("grp")"
parse var text "MSG("msg")"
parse var text "APPL("appl")"
parse var text "NODE("node")"
parse var text "OBJ("obj")"
/**
*** Parse SEVERITY field
**/
select
when sev = "5" then xsev = "critical"
when sev = "4" then xsev = "major"
when sev = "3" then xsev = "minor"
when sev = "2" then xsev = "warning"
when sev = "1" then xsev = "normal"
otherwise do
sev = 1
xsev = "normal"
end
end
/**
*** Parse MESSAGE GROUP field
**/
select
when grp = "MQ" then xgrp = "MQSeries"
otherwise xgrp = "misc"
end
/**
*** Parse NODE field
**/
select
when node = "" then xnode = "abcd"
otherwise xnode = node
end
/**
=== Message parsed -- put it together
**/
string = xgrp || dlm || xsev || dlm || appl || dlm || xnode || dlm
string = string || dlm || obj || dlm || msg
say "String is:" string
/**
=== Message ready -- send it over the socket
**/
/* verify the the socket is closed */
result = Socket('Terminate')
/* Set error code values */
initialized = 0
/* Initialize */
result = Socket('Initialize','RSCLIENT',2)
parse var result src rest
say "Socket initialize ("result")"
/* check the socket return code */
if src=0 then initialized = 1 else exit 1
/* Initialize for receiving lines sent by the server */
result = Socket('Socket',2,'SOCK_STREAM','TCP')
say "Socket set to TCP/STREAM mode ("result")"
parse var result src sid rest
/* Setup the mainframe TCP/IP to use EBCDIC to ASCII conversion */
say "Socket set for ASCII translation ("result")"
result = Socket('Setsockopt', sid,'SOL_SOCKET', 'SO_ASCII','On')
parse var result src rest
result = Socket('Socketsetstatus','RSCLIENT')
say "Socket status is ("result")"
/* Connect to the Network IP socket */
result = Socket('Connect',sid,'AF_INET' port host)
parse var result src rest
say "Socket connect ("result")"
if src^=0 then exit 1
/* send the single line message */
result = Socket('Send',sid,string)
say "Socket send ("result")"
selectlist = 'Read' sid 'Write' 'Exception'
elapsed = 0
seconds = 5
say "Select List=("selectlist")"
do i = 1 to 6 by 1
elapsed = elapsed + seconds
result = Socket('Select',selectlist,seconds)
say i") Socket select ("result") elapsed="elapsed "seconds"
parse var rsn knt rest
if knt > 0 then leave
end
if knt > 0 then do
result = Socket('Read',sid)
parse var result
say "Socket read ("result")"
end
else do
say "Error--Time out waiting for acknowledgement"
end
/* Terminate and exit */
result = Socket('Close',sid)
say "Socket close ("result")"
result = Socket('Terminate')
say "Socket terminate ("result")"
exit 0
*********************************************
Here is the output:
*********************************************
Sending message to ito( sitop1.ameren.com:28985)
String is: MQSeries :%: normal :%: :%: SYSC :%: :%: :%: THIS IS A TEST.
Socket initialize (0 RSCLIENT 2 *INET)
***
Socket set to TCP/STREAM mode (0 1)
Socket set for ASCII translation (0 1)
Socket status is (0 RSCLIENT Connected Free 1 Used 1)
Socket connect (0)
Socket send (0 63)
Select List=(Read 1 Write Exception)
1) Socket select (0 0 READ WRITE EXCEPTION) elapsed=5 seconds
2) Socket select (0 0 READ WRITE EXCEPTION) elapsed=10 seconds
3) Socket select (0 0 READ WRITE EXCEPTION) elapsed=15 seconds
4) Socket select (0 0 READ WRITE EXCEPTION) elapsed=20 seconds
5) Socket select (0 0 READ WRITE EXCEPTION) elapsed=25 seconds
6) Socket select (0 0 READ WRITE EXCEPTION) elapsed=30 seconds
Error--Time out waiting for acknowledgement
Socket close (0)
Socket terminate (0 RSCLIENT)
***
Thank you,
Barry
*
* Barry Goldstein
* Ameren Services
* St. Louis, Missouri
* bgoldstein@ameren.com
* (314) 554-4351
*
Here is the program:
*****************************************************
/**
=== mf2ito - Send error notifications to ito using network socket.
=== (If ito does not return an ack, then to symon and console).
===
===
=== +---- GROUP(misc) ----------+
=== mf2ito --->+---------------------------+--->
=== +---- GROUP(mq) ------------+
===
=== +---- SEV(1) ---------------+ (normal)
=== +---------------------------+--->
=== +---- SEV(2) ---------------+ (warning)
=== +---- SEV(3) ---------------+ (minor)
=== +---- SEV(4) ---------------+ (major)
=== +---- SEV(5) ---------------+ (critical)
===
=== +---------------------------+--->
=== +---- APPL(?) --------------+
===
=== +---------------------------+--->
=== +---- NODE(?) --------------+
===
=== +---------------------------+--->
=== +---- OBJ(?) ---------------+
===
=== +---- MSG(TEXT) ------------+
===
===
=== Change history:
=== 09/01/2005 (bag) - Copied from SYMONSAY script.
=== 09/01/2005 (bag) - Straighten out the socket calls, get
=== positive acknowledgement from listener.
**/
host = "xxxxxxxx.ameren.com"
port = "99999"
dlm = " ~%~ "
say "Sending message to ito(" host":"port")"
parse upper arg text
parse var text "SEV("sev")"
parse var text "GROUP("grp")"
parse var text "MSG("msg")"
parse var text "APPL("appl")"
parse var text "NODE("node")"
parse var text "OBJ("obj")"
/**
*** Parse SEVERITY field
**/
select
when sev = "5" then xsev = "critical"
when sev = "4" then xsev = "major"
when sev = "3" then xsev = "minor"
when sev = "2" then xsev = "warning"
when sev = "1" then xsev = "normal"
otherwise do
sev = 1
xsev = "normal"
end
end
/**
*** Parse MESSAGE GROUP field
**/
select
when grp = "MQ" then xgrp = "MQSeries"
otherwise xgrp = "misc"
end
/**
*** Parse NODE field
**/
select
when node = "" then xnode = "abcd"
otherwise xnode = node
end
/**
=== Message parsed -- put it together
**/
string = xgrp || dlm || xsev || dlm || appl || dlm || xnode || dlm
string = string || dlm || obj || dlm || msg
say "String is:" string
/**
=== Message ready -- send it over the socket
**/
/* verify the the socket is closed */
result = Socket('Terminate')
/* Set error code values */
initialized = 0
/* Initialize */
result = Socket('Initialize','RSCLIENT',2)
parse var result src rest
say "Socket initialize ("result")"
/* check the socket return code */
if src=0 then initialized = 1 else exit 1
/* Initialize for receiving lines sent by the server */
result = Socket('Socket',2,'SOCK_STREAM','TCP')
say "Socket set to TCP/STREAM mode ("result")"
parse var result src sid rest
/* Setup the mainframe TCP/IP to use EBCDIC to ASCII conversion */
say "Socket set for ASCII translation ("result")"
result = Socket('Setsockopt', sid,'SOL_SOCKET', 'SO_ASCII','On')
parse var result src rest
result = Socket('Socketsetstatus','RSCLIENT')
say "Socket status is ("result")"
/* Connect to the Network IP socket */
result = Socket('Connect',sid,'AF_INET' port host)
parse var result src rest
say "Socket connect ("result")"
if src^=0 then exit 1
/* send the single line message */
result = Socket('Send',sid,string)
say "Socket send ("result")"
selectlist = 'Read' sid 'Write' 'Exception'
elapsed = 0
seconds = 5
say "Select List=("selectlist")"
do i = 1 to 6 by 1
elapsed = elapsed + seconds
result = Socket('Select',selectlist,seconds)
say i") Socket select ("result") elapsed="elapsed "seconds"
parse var rsn knt rest
if knt > 0 then leave
end
if knt > 0 then do
result = Socket('Read',sid)
parse var result
say "Socket read ("result")"
end
else do
say "Error--Time out waiting for acknowledgement"
end
/* Terminate and exit */
result = Socket('Close',sid)
say "Socket close ("result")"
result = Socket('Terminate')
say "Socket terminate ("result")"
exit 0
*********************************************
Here is the output:
*********************************************
Sending message to ito( sitop1.ameren.com:28985)
String is: MQSeries :%: normal :%: :%: SYSC :%: :%: :%: THIS IS A TEST.
Socket initialize (0 RSCLIENT 2 *INET)
***
Socket set to TCP/STREAM mode (0 1)
Socket set for ASCII translation (0 1)
Socket status is (0 RSCLIENT Connected Free 1 Used 1)
Socket connect (0)
Socket send (0 63)
Select List=(Read 1 Write Exception)
1) Socket select (0 0 READ WRITE EXCEPTION) elapsed=5 seconds
2) Socket select (0 0 READ WRITE EXCEPTION) elapsed=10 seconds
3) Socket select (0 0 READ WRITE EXCEPTION) elapsed=15 seconds
4) Socket select (0 0 READ WRITE EXCEPTION) elapsed=20 seconds
5) Socket select (0 0 READ WRITE EXCEPTION) elapsed=25 seconds
6) Socket select (0 0 READ WRITE EXCEPTION) elapsed=30 seconds
Error--Time out waiting for acknowledgement
Socket close (0)
Socket terminate (0 RSCLIENT)
***
Thank you,
Barry
*
* Barry Goldstein
* Ameren Services
* St. Louis, Missouri
* bgoldstein@ameren.com
* (314) 554-4351
*