Something I recently ran into … I use the Apache Commons Net library in some of my java code.

I ran into a problem where, when trying to upload a save file to the host via FTP, I encountered an IOException with the message “501 Unknown extension in database file name”.

Turns out someone had change the FTP server configuration to use *PATH for the NAMEFMT instead of the default *LIB.

This causes FTP output to default to ‘/QSYS.LIB/LIBRARY.LIB/FILE.FILE/MEMBER.MBR’ format instead of ‘FILE.MEMBER’.

As I didn’t want my code to be dependent on the server’s configuration, I had to change the code to set the correct name format.

When using a standard FTP client, you can issue the ‘quot site namefmt 0’ command to change the name format to *LIB (‘quot site namefmt 1’ changes it to *PATH).

So … in my code, after I establish the FTP connection, I have ‘ftpClient.sendSiteCommand(“namefmt 0”);’.  This sets the naming format for the current FTP session.

About David:
David is a Principal Software Engineer for PTC, Integrity Business Unit. He cut his teeth on the S/36 and has more than 25 years of experience on the IBM i / System i / iSeries / AS400. He primarily works in Java and ILE RPG specializing in cross platform integrations. David has received the COMMON Distinguished Service award and was named an IBM Power Systems Champion. David is an active volunteer with the American Diabetes Association's Tour de Cure fundraising bike ride. He is currently captain of Team RED Chicago. David runs and maintains His personal blog is Geeky Ramblings.