Please run DSPCMD FTP and post the "Where allowed to run" section here. You don't show us the i5/OS version you're running, so I can't tell if you'll run into a command proxy chain. If you do, then run DSPCMD <proxyLib>/FTP instead.
It's possible that your FTP command allows execution in a program in batch but not as a batch command.
Also, I wouldn't run the OVRDBF commands separately from the FTP command. There's no guarantee that they'll run in the same job nor that the override will still be in effect when the FTP command runs. Both should be in a program together.
And AFAIK, the FTP command is not threadsafe up through at least V7R1. You might run into unpredictable results trying to run it this way.
Tom
Hi Tom,
thank you for the answer, and, yes, sorry I didn't post the system OS version it is V6R1M0.
I do agree with you on OVRDBF, if nothing else I think OVRDBF and FTP command maybe should run in the same job. But, as FTP command can be run in batch mode as well as interactive, I hope we could find a way to do so this way. :)
And on DSPCMD FTP i get this:
Display Command Information
Command . . . . . . . : FTP Library . . . . . . . : QSYS
Target command . . . . . . . . . . . . : FTP
Library . . . . . . . . . . . . . . : QTCP
Text . . . . . . . . . . . . . . . . . : Start TCP/IP File Transfer
Current proxy chain . . . . . . . . . : QSYS/FTP
QTCP/FTP
OVRDBF command and FTP Command should run in same job else OVRDBF will have no effect.
And yes FTP command can be run interactively and as well as in Batch
Current proxy chain . . . . . . . . . : QSYS/FTP
QTCP/FTP
On V5R4 and later, commands can be "proxies" instead of being "duplicates". That is, you can copy a command with CRTPRXCMD instead of with CRTDUPOBJ. A proxy command is more like a symbolic link back to the original command than a new object that is a copy of the old one.
The 'Current proxy chain' above shows that the real FTP command is in QTCP, not QSYS. So you run DSPCMD QTCP/FTP to locate the “Where allowed to run” section.
There seem to be two likely possibilities. First, the “Where allowed to run” attribute allows your FTP command to be run in batch if it's in a program. Second, the OVRDBFs are not in effect when the FTP runs, so it tries to communicate with a terminal session.
Other possibilities might exist, but we should try to make sure that those two are eliminated before digging deeper.
And just in case, you probably should run WRKOBJ *ALL/FTP just to make certain that no other versions of the command exist in any other libraries.
Tom
@Ddaswani
I'll try to rearrange my code so OVRDBF's are in the same job as FTP RMTSYS.
@TimiLiotta
As for "where allowed to run" part of the FTP command, this is what it says:
Where allowed to run . . . . . . . . . : *IMOD *BMOD *IREXX
*BREXX *BPGM *IPGM
*EXEC *INTERACT *BATCH
Also, mode(s) in which valid:
Mode(s) in which valid . . . . . . . . : *PROD
*DEBUG
*SERVICE
Or maybe this setings could be of the interest:
Enabled for graphical user interface . : *YES
Threadsafe . . . . . . . . . . . . . . : *NO
Multithreaded job action . . . . . . . : *SYSVAL
I'm not sure if setting this could help. I'll try to do some changes and I'll get beck to you with some results :)
I think the problem has to do with the lack of overrides in effect for the INPUT and OUTPUT files. We do use FTP in batch programs & haven't had any problems.
If there are no other FTP commands on the system, then the first possibility to handle is that the overrides are not in effect. The OVRDBF and FTP commands should be codded into a CL program. Then the program can be called through QCMDEXC.
If that is successful, then the problem is probably confirmed to be with the overrides. If it is not successful, then the CL program should posted here along with the joblog that shows the running of the program. You include a DSPJOBLOG command after the FTP command in the CL program to ensure that a joblog is spooled.
If the FTP fails and causes the program to fail before the DSPJOG command can run, you should include a MONMSG for the FTP error to make certain that the program continues.
Tom
Tom, we've got FTP running from inside an RPG/ILE program - the OVRDBF commands and the FTP command being executed using the QCAPCMD API. The override scope is *CALLLVL, but that's about the only thing slightly out of the ordinary.
we’ve got FTP running from inside an RPG/ILE program
That should be fine because the RPG program is guaranteed to execute the overrides and the FTP command in the same job. But PHP will be interpreted. I don't currently have a PHP setup to test, so I can't tell if the calls to QCMDEXC will always be executed in the same job or if they'll be handed off to different BCI jobs or if they'll be executed in different threads or what.
The CPD0772 error suggests that the FTP is being run as an *INTERACTIVE command, which suggests that FTP is trying to open a terminal session for the input script and for any output. The OVRDBFs look okay (though I can't tell because I don't know if they're really valid on that system).
If you simply submit a FTP command by itself to batch, you should see the same CPD0772 error. The text of the message is probably a little misleading in this case, but the meaning is appropriate.
Execute the commands within a single compiled program, such as your RPG, and it should work.
Tom
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 9  Replies