Be kind as I've just started playing with REXX via ZOC to login to a list of devices and automate some commands. It's come up that I need to send some device output to a file and I'm getting stuck trying to figure the output part out. See below where the script collects a login and password, then reads a file containing some IP addresses. The script logs into each server in the list and runs pwd (as an example). How do I get the output of pwd into a file instead (or in addition) to showing up on the screen?
/*REXX*/
login= ZocAsk("Enter Login")
pwd= ZocAsk("Enter Password")
file = "c:\input\ipList.txt"
do while( lines(file) )
data=LINEIN(file)
Parse Var data v1
Call ZocTimeout 600
Call ZocSetDevice "Secure Shell"
Call ZocConnect login||":"pwd||"@"v1
Call ZocWait "[vt100]=>"
Call ZocSend "^M"
Call ZocSend "^M"
SLEEP 2
Call ZocSend "pwd^M" [highlight #FCE94F]<--- How to send this output to a file appending every time through the loop[/highlight]
SLEEP 2
Call ZocSend "exit^M"
END
EXIT
-CL
/*REXX*/
login= ZocAsk("Enter Login")
pwd= ZocAsk("Enter Password")
file = "c:\input\ipList.txt"
do while( lines(file) )
data=LINEIN(file)
Parse Var data v1
Call ZocTimeout 600
Call ZocSetDevice "Secure Shell"
Call ZocConnect login||":"pwd||"@"v1
Call ZocWait "[vt100]=>"
Call ZocSend "^M"
Call ZocSend "^M"
SLEEP 2
Call ZocSend "pwd^M" [highlight #FCE94F]<--- How to send this output to a file appending every time through the loop[/highlight]
SLEEP 2
Call ZocSend "exit^M"
END
EXIT
-CL