www.orati-systems.com
Table of Contents Summary Features Requirements Installation and configuration Rebuild and deploy Java Debugging Summary isftp is an open source toolset developed by Orati Systems Ltd for the transfer of files via SFTP. isftp utilises the JSch Java Secure Channel open source package which provides a pure Java implementation of SSH2. Jsch is developed, maintained and administered by JCRAFT. An open source implementation of the SSH2 protocol has been selected to provide complete visibility of all aspects of the SFTP process. Further details of JSch and the latest packages can be found at http://www.jcraft.com/jsch/. Features - Utilises the JSch Java Secure Channel open source package which provides a pure Java implementation of SSH2. - Easy to use API s facilitate sending files quickly and easily from your RPG program using SFTP. - Unlimited transfers via SFTP channel. - Fast, secure implementation of SSH2 via JSch package. - Open source provides full visibility of packages and processes.
Need more features? isftppro is an Enterprise version of the iseries isftp open source toolset developed by Orati Systems Ltd. isftppro has the following features: - Utilises the JSch Java Secure Channel open source package which provides a pure Java implementation of SSH2. - Single JVM in batch significantly improves performance. There is only ever one JVM running on the machine for isftppro vs. having each signed on job require a separate JVM. - Easy to use API s facilitate sending files quickly and easily from your RPG program using SFTP or standard FTP. - Extensive logging and debugging information generated. - Cross reference values can be passed into the isftppro server to tie values sent to resulting logs. - Unlimited transfers via SFTP channel. - Fast, secure implementation of SSH2 via JSch package. - Open source provides full visibility of packages and processes. More details can be found at www.orati-systems.com. Requirements isftp was created on a iseries running V5R4 of OS/400. This version of isftp requires at least V5R1 of the operating system. The licensed programs required on your machine are as follows: 5722JV1 Java Developer Kit 1.5 installed.
Installation and configuration 1. Sign on with QSECOFR authority. 2. Create save file (SAVF) objects in QGPL; CRTSAVF FILE(QGPL/SFTPOBJ) CRTSAVF FILE(QGPL/SFTPIFS) 3. FTP the SFTPOBJ SAVF file and SFTPIFS SAVF to the iseries in BINARY mode: CD QGPL LCD A:\ [local directory] BIN PUT SFTPOBJ.SAVF PUT SFTPIFS.SAVF QUIT 4. Create the CSVSFTP library: CRTLIB LIB(CSVSFTP) 5. Restore the isftp objects: RSTOBJ OBJ(*ALL) SAVLIB(CSVSFTP) DEV(*SAVF) SAVF(QGPL/SFTPOBJ) RSTLIB(CSVSFTP) 6. Restore the IFS directory: CD DIR(/) RST DEV('/QSYS.LIB/QGPL.LIB/SFTPIFS.FILE') OBJ((CSVSFTP)) ALWOBJDIF(*ALL) 7. Delete the SAVF objects: DLTF FILE(QGPL/SFTPOBJ) DLTF FILE(QGPL/SFTPIFS)
Testing the SFTP process. In order to test the installation and operation of isftp, the following steps should be taken: Add the isftp object library to the top of the library list ADDLIBLE LIB(CSVSFTP) Run the PUTSFTP command PUTSFTP HOSTNAME('123.456.789.012') PORT(22) USERID(USERNAME) PASSWORD(PASSWORD) LOCAL('/frompath/') REMOTE('/topath/') FILE(FILENAME) Note that the first time you run the command, run times may be slightly longer due to the initialisation of the java processes.
Run the GETSFTP command GETSFTP HOSTNAME('123.456.789.012') PORT(22) USERID(USERNAME) PASSWORD(PASSWORD) LOCAL('/topath/') REMOTE('/frompath/') FILE(FILENAME) Note that the first time you run the command, run times may be slightly longer due to the initialisation of the java processes.
Rebuild and deploy Java The java classes can be rebuilt by calling program CRTSFTP. This CLLE program removes the old classes from /csvsftp/com/rpgsftp and then recreates them in the same location. CLLE Program BUILDSFTP can be used to recreate the various files, create the binding directory and rebuild the various modules, data queues and data areas. This program should be used with care. Debugging The process can be debugged as follows: Submit the command as a held job: SBMJOB CMD(PUTSFTP HOSTNAME('123.456.789.012') PORT(22) USERID(USERNAME) PASSWORD(PASSWORD) LOCAL('/frompath/') REMOTE('/topath/') FILE(FILENAME)) HOLD(*YES) Retrieve the job details: Job: DSPJOBD User: USER Number: 095790 Start a service job: STRSRVJOB JOB(095790/USER/DSPJOBD) Start debugging: STRDBG PGM(SFTPPUT) The source for program SFTPPUT should appear. Exit the source and release the held command. The following screen should appear: Job: DSPJOBD User: USER Number: 095790 The serviced job has been released from the job queue. Press Enter to start the job or F10 to enter debug commands for that job.
Press command key F10, then: DSPMODSRC Set a breakpoint at line 51: then exit the debugger and press ENTER to run. The program will break at line 51.
Press command key F14 to work with the module list: Work with Module List System: TEST Type options, press enter. 1=Add program 4=Remove program 5=Display module source 8=Work with module breakpoints Opt Program/module Library Type 1 *LIBL *CLASS SFTPPUT CSVSFTP *PGM SFTPPUT *MODULE Selected Enter option 1, type *CLASS: Enter Class File Name Type class file name, press enter. com.rpgsftp.rpgsftp The class should now appear: Work with Module List System: TEST Type options, press enter. 1=Add program 4=Remove program 5=Display module source 8=Work with module breakpoints Opt Program/module Library Type *LIBL *CLASS <ftp.rpgsftp *CLASS SFTPPUT CSVSFTP *PGM SFTPPUT *MODULE Selected
You should now be able to use option 5 to examine the java source and set breakpoints/examine variables: After completing debugging: ENDDBG ENDSRVJOB