robertb_NZ
Well-known member
When I enter this command into the command prompt: -
I'm trying to automate this using the following code (suggested by jmcilhinney - hopefully he'll reply): -
Now however JZFTPOUT.TXT contains
Why the difference? How do I get the FTP messages as in the Command Prompt example back to my program?
In both cases the FTP actually worked perfectly.
Any help gratefully accepted. I can't see anything in the MSDN documentation of the Process command that suggests what I'm doing wrong.
This is part of http://www.vbdotnetforums.com/vb-ne...p-ibm-mainframe-including-job-submission.html. Hopefully a reply here will close both queries.
FTP -d -s:c:\jzftpin.txt >jzftpout.txt
then FTP works perfectly, using the instructions that I pre-defined in the file C:\jzftpin.txt, and returning these results in jzftpout.txt: -
ftp> Connected to 192.86.32.59.
Open 192.86.32.59
220-FTPSERVE IBM FTP CS V2R1 at S0W1.DAL-EBIS.IHOST.COM, 01:52:43 on 2014-07-25.
220 Connection will close if idle for more than 5 minutes.
User (192.86.32.59
none)):
331 Send password please.
230 IBMUSER is logged on. Working directory is "IBMUSER.".
ftp> Quote Site Filetype=JES
200 SITE command was accepted
ftp> Put C:\CRDTA1.JCL
200 Port request OK.
125 Sending Job to JES internal reader FIXrecfm 80
250-It is known to JES as JOB00442
250 Transfer completed successfully.
ftp: 14890 bytes sent in Seconds Kbytes/sec.
ftp> 1.4310.41Quit
221 Quit command received. Goodbye.
Open 192.86.32.59
220-FTPSERVE IBM FTP CS V2R1 at S0W1.DAL-EBIS.IHOST.COM, 01:52:43 on 2014-07-25.
220 Connection will close if idle for more than 5 minutes.
User (192.86.32.59
331 Send password please.
230 IBMUSER is logged on. Working directory is "IBMUSER.".
ftp> Quote Site Filetype=JES
200 SITE command was accepted
ftp> Put C:\CRDTA1.JCL
200 Port request OK.
125 Sending Job to JES internal reader FIXrecfm 80
250-It is known to JES as JOB00442
250 Transfer completed successfully.
ftp: 14890 bytes sent in Seconds Kbytes/sec.
ftp> 1.4310.41Quit
221 Quit command received. Goodbye.
I'm trying to automate this using the following code (suggested by jmcilhinney - hopefully he'll reply): -
Dim myprocess As New Process
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
StartInfo.FileName = "cmd" 'starts cmd window
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.UseShellExecute = False 'required to redirect
StartInfo.CreateNoWindow = True 'creates no cmd window
myprocess.StartInfo = StartInfo
myprocess.Start()
Dim SR As System.IO.StreamReader = myprocess.StandardOutput
Dim SW As System.IO.StreamWriter = myprocess.StandardInput
Dim Command As String = "FTP -d -s:JZFTPIN.TXT >JZFTPOUT.TXT"
SW.WriteLine(Command) 'the command you wish to run.....
SW.WriteLine("exit") 'exits command prompt window
SW.Close()
SR.Close()
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
StartInfo.FileName = "cmd" 'starts cmd window
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.UseShellExecute = False 'required to redirect
StartInfo.CreateNoWindow = True 'creates no cmd window
myprocess.StartInfo = StartInfo
myprocess.Start()
Dim SR As System.IO.StreamReader = myprocess.StandardOutput
Dim SW As System.IO.StreamWriter = myprocess.StandardInput
Dim Command As String = "FTP -d -s:JZFTPIN.TXT >JZFTPOUT.TXT"
SW.WriteLine(Command) 'the command you wish to run.....
SW.WriteLine("exit") 'exits command prompt window
SW.Close()
SR.Close()
Now however JZFTPOUT.TXT contains
User (192.86.32.59
none)): Open 192.86.32.59
--->
USER IBMUser
--->
PASS ********
---> Quote Site Filetype=JES
Site Filetype=JES
---> PUT C:\crdta1.jcl
PORT 192,168,1,101,197,117
---> STOR CRDta1.JCL
---> Quit
QUIT
--->
USER IBMUser
--->
PASS ********
---> Quote Site Filetype=JES
Site Filetype=JES
---> PUT C:\crdta1.jcl
PORT 192,168,1,101,197,117
---> STOR CRDta1.JCL
---> Quit
QUIT
Why the difference? How do I get the FTP messages as in the Command Prompt example back to my program?
In both cases the FTP actually worked perfectly.
Any help gratefully accepted. I can't see anything in the MSDN documentation of the Process command that suggests what I'm doing wrong.
This is part of http://www.vbdotnetforums.com/vb-ne...p-ibm-mainframe-including-job-submission.html. Hopefully a reply here will close both queries.