It connected with the alternate port when I tried it. My system is at V5R3.
FTP RMTSYS(SYSTEM2) PORT(10343)
Since we can’t see the CL program you run nor the joblog nor are we told any attributes of the job that runs the CL, there’s not much chance we can figure it out. In general, there is no reason it shouldn’t work the same, assuming the command is wrapped in a way that properly provides STDIN and STDOUT and there are no port restrictions for the job user and who knows what other possibilities.