********************************************************************/ /* Program XFRDTAC */ /* Run the IBM i Access Client Solutions Data Transfer program */ /********************************************************************/ /* */ /* Copyright 2012, Craig Pelkie, ALL RIGHTS RESERVED */ /* craig@web400.com */ /* */ /* V1.01 - 2012-08-28 ORIGINAL VERSION */ /* V1.03 - 2012-11-14 UPDATE FOR OCT. 2012 ACSBUNDLE.JAR */ /* */ /********************************************************************/ /* You may freely make use of this program in any application that */ /* you develop, as long as you retain the copyright notice shown */ /* above. */ /* */ /* This program is provided for instructional purposes only. */ /* No warranty is expressed or implied. */ /* */ /* Craig Pelkie explicitly disclaims all responsibilty for your */ /* use of the program, and will not be held liable for any */ /* results or unforeseen consequences that result from your */ /* use of this program or any of the techniques that are */ /* demonstrated by this program. */ /* */ /* By using this program, you acknowledge that: */ /* */ /* 1. The techniques shown in this program have not been */ /* tested, documented, approved, or recommended by */ /* IBM. You should not expect any IBM support for */ /* the techniques shown in this program. */ /* */ /* 2. Running this program may result in changes to files */ /* on your system. The expected outputs include the */ /* data transfer output file in your IBM i IFS, and */ /* possibly one or more job log files. It is your */ /* responsibility to verify the outputs of running the */ /* program, and to ascertain that no other unwanted or */ /* unexpected changes occur on your IBM i as a result */ /* of running this program. */ /* */ /* 3. No support from Craig Pelkie is expressed or implied */ /* in the provision of this program and its accompanying */ /* documentation, if any. */ /* */ /* 4. If you do not understand how to use this program and */ /* the potential consequences of running it, DO NOT RUN IT. */ /********************************************************************/ XFRDTAC: PGM PARM(&jardir + &plugin + &xfrdsc + &file + &mbr + &clientfile) /*******************************************************/ /* The path, file name and extension of the stream */ /* file to transfer data to. */ /* */ /* This is only used with &direction CLDOWNLOAD */ /* (Command Line Download) */ /* */ /* Supported extensions: */ /* */ /* .csv - Comma Separated Variable */ /* .ods - Open Document Spreadsheet */ /* .xls - Microsoft Excel 97 - 2003 */ /* .xlsx - Microsoft Excel 2007, 2010 */ /* */ /* If an unsupported extension is specified, the */ /* default extension .csv is used. */ /*******************************************************/ dcl &clientFile *char 256 /*******************************************************/ /* The qualified name of the IBM i database file to */ /* transfer data from. This is only used with */ /* &plugin value *CLDOWNLOAD (Command Line Download) */ /*******************************************************/ dcl &file *char 20 /*******************************************************/ /* The IFS directory where the acsbundle.jar file */ /* is located */ /*******************************************************/ dcl &jardir *char 256 /*******************************************************/ /* The member in the IBM i database file to */ /* transfer data from. This is only used with */ /* &plugin value *CLDOWNLOAD (Command Line Download) */ /*******************************************************/ dcl &mbr *char 10 /*******************************************************/ /* The plugin to use for the transfer. */ /* */ /* *DOWNLOAD - transfer data from an IBM i database */ /* file to a stream file */ /* */ /* *CLDOWNLOAD - transfer the entire IBM i database */ /* file to a stream file */ /* */ /* *UPLOAD - transfer data from a stream file to */ /* an IBM i database file */ /*******************************************************/ dcl &plugin *char 11 /*******************************************************/ /* Variable used to set the value of the CLASS parm */ /* &jardir/acsbundle.jar */ /*******************************************************/ dcl &valCLASS *char 270 /*******************************************************/ /* Variable used to set the value of the /file parm */ /* /file= */ /*******************************************************/ dcl &valfile *char 262 /*******************************************************/ /* Variable used to set the value of the client file. */ /* clientfile= */ /*******************************************************/ dcl &valCfile *char 268 /*******************************************************/ /* Variable used to set the value of the host file/lib */ /* hostfile=/ */ /* hostifle=/() */ /*******************************************************/ dcl &valHfile *char 43 /*******************************************************/ /* Variable used to set the value of the /PLUGIN parm */ /*******************************************************/ dcl &valPLUGIN *char 18 /*******************************************************/ /* Variable used to set the value of the /system parm */ /* Used only with cldownload plugin */ /*******************************************************/ dcl &valSystem *char 17 + value('/system=LOCALHOST') /*******************************************************/ /* The path (directory) and file name of the transfer */ /* description file */ /* */ /* Example: file for upload */ /* .dttx = "transfer to IBM i" */ /* */ /* /path/upload_description.dttx */ /* */ /* Example: file for download */ /* .dtfx = "transfer from IBM i" */ /* */ /* /path/download_description.dtfx */ /* */ /*******************************************************/ dcl &xfrdsc *char 256 /*******************************************************/ /* Set the parameter values to pass to the data */ /* transfer program */ /*******************************************************/ chgvar var(&valCLASS) + value(&jardir *tcat '/acsbundle.jar') /*******************************************************/ /* Set values for cldownload (Command Line Download) */ /*******************************************************/ if (&plugin *eq '*CLDOWNLOAD') then(do) chgvar var(&valPLUGIN) + value('/PLUGIN=cldownload') chgvar var(&valHfile) + value('/hostfile=' *tcat + %sst(&file 11 10) *tcat + '/' *tcat + %sst(&file 1 10)) if (&mbr *ne '*FIRST') then(do) chgvar var(&valHfile) + value(&valHfile *tcat + '(' *tcat + &mbr *tcat + ')') enddo chgvar var(&valCfile) + value('/clientfile=' *tcat + &clientfile) enddo /*******************************************************/ /* Set values for download / upload */ /*******************************************************/ if (&plugin *eq '*DOWNLOAD') then(do) chgvar var(&valPLUGIN) + value('/PLUGIN=download') enddo if (&plugin *eq '*UPLOAD') then(do) chgvar var(&valPLUGIN) + value('/PLUGIN=upload') enddo if ((&plugin *eq '*DOWNLOAD') *or + (&plugin *eq '*UPLOAD ')) then(do) chgvar var(&valfile) + value('/file=' *tcat &xfrdsc) enddo /*******************************************************/ /* Run the data transfer */ /*******************************************************/ if (&plugin *eq '*CLDOWNLOAD') then(do) runjva class(&valCLASS) + parm(&valPLUGIN &valSystem &valHfile &valCfile) + chkpath(*IGNORE) monmsg msgid(CPF0000) enddo else cmd(do) runjva class(&valCLASS) + parm(&valPLUGIN &valfile) + chkpath(*IGNORE) monmsg msgid(CPF0000) enddo endpgm