Sergio,
If it does not violate your management policies (some companies do not
allow downloads of "shareware" code, even when the source codes is
available), you may want to download the VMFTP package from Slippery Rock
University at:
http://zvm.sru.edu/~DOWNLOAD/
It allows complete control of FTP commands and responses from CMS execs.
Every reply from FTP can be examined (for example, using: rexx "parse"),
to obtain the return codes from each FTP command.
Mike Walter
Hewitt Associates
The opinions expressed herein are mine alone, not my employer's.
"Sergio Lima" <[email protected]>
Sent by: "The IBM z/VM Operating System" <[email protected]>
06/16/2010 12:34 PM
Please respond to
"The IBM z/VM Operating System" <[email protected]>
To
[email protected]
cc
Subject
Test Return Code using FTP under VM/CMS
Hi List,
We made a EXEC here, that do a automation.
This exec work with WAKEUP RDR, then Receive files, and next do a FTP to a
Windows Server Machine.
Here is the REXX code :
volta:
DO FOREVER
'WAKEUP (RDR '
IF RC = 4 THEN DO
'EXECIO * CP (STEM LINES. STRING QUERY RDR * ALL'
end
Do i=1 to Lines.0
if word(lines.i,1) = 'ORIGINID' then nop
else do
fn = word(lines.i,1)
numero = word(lines.i,2)
data = word(lines.i,8)
hora = word(lines.i,9)
ft = substr(data,1,2) || substr(data,4,2) || ,
substr(hora,1,2) || substr(hora,4,2)
fm = a
"cp spool c nohold"
read fn ft "a" "(replace"
if rc <> 0 then exit
call FTP1 fn ft
signal volta
end
end
Here, the FTP1 EXEC :
/* */
arg fn ft
queue "anonymous a...@a"
queue "put "fn"."ft".a "fn"."ft".printlog.txt"
queue "quit"
ftp "172.16.11.6"
if rc <> 0 then do
"cp msg operator .... danger message ... "
exit
end
if rc = 0 then do
call gravalog
end
return
gravalog:
data = date(u)
hora = time()
campo = data || ' ' || hora || ' ' || fn || ' ' || ft
queue campo
'EXECIO 1 DISKW' printlog log a
return
If the FTP don't run well, We need get the Return Code, but when FTP fails
the Return Code also was 0, this the test :
USER (identify yourself to the host):
>>>USER anonymous
331 Anonymous access allowed, send identity (e-mail name) as password.
>>>PASS ********
230 Anonymous user logged in.
Command:
Local file not found or cannot be accessed.
Command:
>>>QUIT
221
12 *-* if rc <> 0
>>> "0"
18 *-* if rc = 0
>>> "1"
*-* then
*-* do
19 *-* call gravalog
24 *-* gravalog:
26 *-* data = date(u)
>>> "06/16/10"
27 *-* hora = time()
Anybody already used this ?
Thanks very much.
Sergio Lima Costa
Sao Paulo - Brazil
TRANSFORME SUAS FOTOS EM EMOTICONS PARA O MESSENGER. CLIQUE AQUI E VEJA
COMO.
The information contained in this e-mail and any accompanying documents may
contain information that is confidential or otherwise protected from
disclosure. If you are not the intended recipient of this message, or if this
message has been addressed to you in error, please immediately alert the sender
by reply e-mail and then delete this message, including any attachments. Any
dissemination, distribution or other use of the contents of this message by
anyone other than the intended recipient is strictly prohibited. All messages
sent to and from this e-mail address may be monitored as permitted by
applicable law and regulations to ensure compliance with our internal policies
and to protect our business. E-mails are not secure and cannot be guaranteed to
be error free as they can be intercepted, amended, lost or destroyed, or
contain viruses. You are deemed to have accepted these risks if you communicate
with us by e-mail.