No such path or directory on IFS

Discussions related to FTPAPI (An FTP client package for RPG programming.) http://www.scottklement.com/ftpapi/
Post Reply
buzzia
Posts: 2
Joined: Tue Jul 25, 2023 1:39 pm

No such path or directory on IFS

Post by buzzia »

Hi,
I'm trying the API to do ftp. For the libraries part I have no problem, for the IFS part, for every attempt I make the message is returned to me "This path or directory does not exist" even if with the WRKLNK the file and the path exist.
I'm using a lpar with V7R5M0
Scott Klement
Site Admin
Posts: 719
Joined: Sun Jul 04, 2021 5:12 am

Re: No such path or directory on IFS

Post by Scott Klement »

How can I reproduce this problem?
buzzia
Posts: 2
Joined: Tue Jul 25, 2023 1:39 pm

Re: No such path or directory on IFS

Post by buzzia »

Hi Scott,
here there is a small code that run over your api.

Code: Select all

**FREE

 Ctl-Opt decedit('0,') datedit(*dmy.);
 ctl-opt main(setlogadm);

 /COPY LIBFTP/QRPGLESRC,APIFTP
 /INCLUDE DEVSRC/UTIAPI,APISYS

 dcl-proc setlogadm;

   dcl-s sess int(10) inz(0);
   dcl-s to varchar(50) inz(*blank);
   dcl-s msg varchar(50) inz(*blank);
   dcl-s cmd varchar(50) inz('DLYJOB DLY(1)');
   dcl-s from varchar(50) inz(*blank);

   sess = FTP_conn('ftpserver': 'adm':'password');
   Msg = ftp_errorMsg(sess);
     dsply msg;

   if sess<0;
     dsply 'Connection error';
     return;
   ENDIF;

   from='/HOME/adm/ftpapi.savf';
   to='/HOME/adm/ftpapi.savf';
   dsply (':'+from+':');
   dsply (':'+to+':');

   FTP_binaryMode(sess: *on);
   FTP_quote(sess: 'rcmd '+CMD);
   FTP_NamFmt(sess: 1);
   FTP_chdir(sess:'/HOME/adm/');
   if FTP_put(sess:to:from)<0;
     dsply 'FTP error';
     Msg = ftp_errorMsg(sess);
     dsply msg;
     return;
   else;
     dsply 'OK';
   ENDIF;

    ftp_quit(sess);
 end-proc;
I use 2 dsply in order to check that there aren't any white spaces. Using a DB2 path (/qsys.lib/...) I don't have any problem. With IFS, it returns me "This path or directory does not exist", probably cpe3025.
Scott Klement
Site Admin
Posts: 719
Joined: Sun Jul 04, 2021 5:12 am

Re: No such path or directory on IFS

Post by Scott Klement »

Thanks!

You've found a bug. FTPAPI tries to rename files that end in .SAVF to .FILE -- it does this because if you transfer a .SAVF from a library, the actual file type is .FILE -- so it adjusts the path accordingly.

However, it should only do that when the file is in a LIBRARY, not when it's in the IFS... which is the bug, it's doing it for IFS files as well, and shouldn't be.

I fixed it, and uploaded a new copy to the website. (First change to FTPAPI in 2 years!) Please see if that works for you. http://www.scottklement.com/ftpapi/
Post Reply