Good morning,
I recently downloaded ftpapi 2.8 and started using it.
I debugged it and got this error:
MCH1210 in the function
dcl-proc do_iconv_real export; present in the FTPTCP member of the QRPGLESRC file.
In particular, I found the error when running:
Hi,
I solved MCH by changing the definition of RC from int(10) to uns(10)
However I have a problem during ftps, the commands are taken correctly, but as soon as "TYPE I" is written the system does not recognize the command.
Checking in debug I see that the RC of the iconv in the do_real_iconv procedure is 4294967295, could this be the problem? Why does it happen?
Cinzia wrote: ↑Mon Dec 09, 2024 9:23 am
Checking in debug I see that the RC of the iconv in the do_real_iconv procedure is 4294967295, could this be the problem? Why does it happen?
iconv() was designed strangely. It returns uns(10) normally, but for errors return -1. uns(10) means "unsigned", whiuch means it cannot have a negative value. So it is a strange design.
In the C prgoramming language a signed value of -1 is the same as an unsigned value of 4294967295. so if the variable contains 4294967295, you could check it against -1 in C and it would work. In RPG you have to check it against 4294967295, however.
I can fix that, but a bigger question is, why is iconv() failing to begin with?
Is is trying to convert the string "TYPE I" from EBCDIC to ASCII to send it to the FTP server. When converting, iconv() is returning ICONV_FAIL, so it is return an empty string '', that's why you see the message "Subcommand <blank> not valid" because TYPE I is now translating to blank.
I can't imagine how that would happen, as TYPE I is entirely made of invariant characters.
Please tell me how I can reproduce this on my own system.
I tried using the SendLine2 procedure instead of the SendLine procedure (so using ToASCII instead of iconv) and in this way the connection occurs correctly.
Hi,
I enabled only the FTPS connection between two systems in both directions (CHGFTPA ALWSSL(*ONLY)) and set the certificates correctly.
I tested the FTPS in iterative and it works correctly.
These are the steps that the procedure takes:
0: FTPAPI version 2.8 released on 2024-09-09
1: 220-QTCP at LOOPBACK.
1: 220 Connection will close if idle more than 5 minutes.
1: > USER SKLEMENT
1: 331 Enter password.
1: > PASS **********
1: 230 SKLEMENT logged on.
1: > RCMD CRTSAVF DSCOBJDCMW/WO00050521
1: 250 Command CRTSAVF DSCOBJDCMW/WO00050521 successful.
1: > TYPE I
1: 200 Representation type is binary IMAGE.
1: > EPSV
1: 229 Entering Extended Passive Mode (|||45685|).
1: > STOR /qsys.lib/DSCOBJDCMW.lib/WO00050521.file