Some REXX basic:

 1. REXX is strictly call by value. When you need a name, the caller has to 
pass a string containing the name. So in your call to bpxwunix you need to pass 
expressions evaluating to the names. In your case simple string literals will 
do.

 2. The name of a stem ends in a period. The string 'ipaddr.i' refers to a 
compound variable in ipaddr., not to the stem.

 3. There is a convention in REXX to simulate arrays using compound variable 
with the subscript as the tail and for tail 0 to contain the number of 
remaining elements.

So I assume that you need something like

address TSO /* not needed if already in TSO environment */
'Execio * Diskr input (STEM ipaddr. finis'
 Do i = 1 to ipaddr.0
    call bpxwunix 'host' ipaddr.i, , 'out.' /* extra comma because 'in.' is 
omitted */
    say 'inaddr ' ipaddr.i
    say 'first output line ' out.1
 'Execio 1 Diskw ddout (STEM out. '
 End
 "EXECIO 0 DISKW ddout (FINIS)"
 Exit


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of J 
Ellis [0000020d5fbe36e0-dmarc-requ...@listserv.ua.edu]
Sent: Wednesday, May 20, 2020 3:56 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: REXX and BPXWUNIX()

i would like to use the bpxwunix function to run, either HOST or DIG or 
nslookup commands, seems pretty straightforward ...
but I can not get the put to com back to me, it has to be something silly i am 
overlooking, any help would be appreciated

/*  rexx  */
say 'hostname running'
RC = SYSCALLS('ON')
If RC<0 | RC>4 Then Exit RC
address TSO 'Execio * Diskr input (STEM ipaddr. finis'
Address SYSCALL
 Do i = 1 to ipaddr.0
    call bpxwunix 'host ',ipaddr.i,out.
    say 'inaddr ' ipaddr.i
    say 'out ' out.
 Address tso
 'Execio 1 Diskw ddout (STEM out. '
 End
 "EXECIO 0 DISKW ddout (FINIS)"
 Exit
the input is for example, the ipaddr.0 is number of lines, then the IP's i wish 
to query.
2
8.8.8.8
8.8.4.4

for the host command under omvs/ishell, i get EZZ8321I dns.google has addresses 
8.8.8.8
i am expecting that returned back to my out. stack



i get the same null results in TSO interactive as batch, here's the JCL

//@TSOSYSP EXEC PGM=IKJEFT01,REGION=8M,
// PARM='HOSTNAME'
//SYSEXEC DD DISP=SHR,DSN=SYSEXEC
//SYSTSPRT   DD SYSOUT=*
//SYSTSIN    DD DUMMY,LRECL=80
//STDOUT     DD SYSOUT=*
//STDERR     DD SYSOUT=*
//DDOUT      DD SYSOUT=*
//INPUT      DD DISP=SHR,DSN=MYOMVS.PDSE(STDIN)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to