Curious effect on RunProgram
Posted: Tue Apr 02, 2013 10:32 am
Hi,
For testing pourposes I've write this program, calling "FTP.EXE":
The TEST.FTP file contains this lines (however, the content is not important)
When I run this program FROM a CMD.EXE window, the log file shows correctly (host 194.179.49.2 is unreachable)
But, and this is the funny thing, if I run this program calling it from another, without CMD.EXE, the order of log lines is completely different:
WHY????
For testing pourposes I've write this program, calling "FTP.EXE":
Code: Select all
nlog = CreateFile(#PB_Any, "TEST.LOG")
Program.s = "FTP.EXE"
Parameter.s = " -s:TEST.FTP 194.179.49.2"
WriteStringN(nlog, Program+Parameter)
npgm = RunProgram(Program, Parameter, ".", #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
if isProgram(npgm)
while ProgramRunning(npgm)
while AvailableProgramOutput(npgm)
textline.s = ReadProgramString(npgm)
if len(textline): WriteStringN(nlog, textline): endif
wend
wend
else
WriteStringN(nlog, "NO PGM: "+Program+Parameter)
endif
if isProgram(npgm): CloseProgram(npgm): endif
CloseFile(nlog)
END
Code: Select all
USER
PASSWD
put XXR1780.RPGLE QGPL/QRPGSRC.GCR1780
quote rcmd CALL PGM(QGPL/COMPILE) PARM('GCR1780' 'RPGLE')
get QGPL/TOPC XXR1780.LST
quit
Code: Select all
FTP.EXE -s:TEST.FTP 194.179.49.2
ftp> Desconectado.
ftp> USER
Comando no válido.
ftp> PASSWD
Desconectado.
ftp> put XXR1780.RPGLE QGPL/QRPGSRC.GCR1780
Desconectado.
ftp> quote rcmd CALL PGM(QGPL/COMPILE) PARM('GCR1780' 'RPGLE')
Desconectado.
ftp> get QGPL/TOPC XXR1780.LST
quit
Code: Select all
FTP.EXE -s:TEST.FTP 194.179.49.2
Desconectado.
Comando no válido.
Desconectado.
Desconectado.
Desconectado.
USER
PASSWD
put XXR1780.RPGLE QGPL/QRPGSRC.GCR1780
quote rcmd CALL PGM(QGPL/COMPILE) PARM('GCR1780' 'RPGLE')
get QGPL/TOPC XXR1780.LST
quit
WHY????