.. _tn201905: How to activate and use the FTP File Transfer function of Virtel ================================================================ Introduction ------------ VIRTEL Web Access v4.59 introduces support for FTP file transfer. This function consists of the following elements: - One or more templates that Virtel uses to generate FTP parameters. These can be configured by the Virtel administrator. - A Virtel scenario that generates the FTP parameter file, when the function is called via a button on the toolbar of from an option on the Virtel administration menu. - A Windows desktop script that executes the file transfer, using the FTP parameters that have been generated by Virtel. How does it work? ^^^^^^^^^^^^^^^^^ Virtel runs in a browser and as such does not provide direct FTP connection to the mainframe. The Virtel FTP function centralizes the FTP file transfer parameters, where they can be configured by the Virtel Administrator. When an end-user requests for an FTP transfer to be initiated, an FTP parameter file is downloaded to the browser default download directory. The file transfer can then be executed by calling a batch script on the user-s desktop, that will use the parameter file as an input. Pre-requisites ^^^^^^^^^^^^^^ - The user workstation must be able to run Microsoft's ftp.exe program. - The user must be authorized to run batch (BAT) and Power shell scripts - The Virtel Entry point(s) must be defined to load scenarios from the SCE-DIR directory. This is normally the default. - A directory to keep the ancillary programs should be created on the users PC. This could be something like c:\virtel\ftp. See Appendix A for me details on the ancillary post processing programs. Installing and configuring the FTP function ------------------------------------------- Download and apply the Virtel 4.59 UPDT5799 update from the Virtel FTP website. This should apply they latest maintenance to Virtel which includes the FTP feature. Stop Virtel. Add the following Virtel transactions: - :: //INIARBO EXEC PGM=VIRCONF,PARM=LOAD //STEPLIB DD DISP=SHR,DSN=SPTHOLT.VIRT459.LOADLIB //SYSPRINT DD SYSOUT=* //VIRARBO DD DISP=SHR,DSN=SPTHOLT.VIRT459.ARBO //SYSIN DD * TRANSACT ID=W2H-04E, - NAME=FTPPARM, - DESC='FTPPARM ', - APPL=$NONE$, - TYPE=2, - TERMINAL=DELOC, - STARTUP=1, - SECURITY=0, - TIOASTA=&/S, - EXITSTA=FTPPARM TRANSACT ID=CLI-04E, - NAME=FTPPARM, - DESC='FTPPARM ', - APPL=$NONE$, - TYPE=2, - TERMINAL=CLLOC, - STARTUP=1, - SECURITY=0, - TIOASTA=&/S, - EXITSTA=FTPPARM The new transactions will provide the support for the FTP feature. The external/internal is FTPPARM |image1| *FTP transaction definition for FTP file transfer* The FTPPARM scenario, FTPPARM.390, should be loaded up into the SCE directory. It is a part of the UPDT5799 update. Defining the FTP templates ^^^^^^^^^^^^^^^^^^^^^^^^^^ The FTP function provides default templates for Upload and Download FTP requests. These can be customized to your site specifications and then re-uploaded to the W2H-DIR directory. Example: sendipnw.txt. (Send new file to target with IP address) :: OPEN {{{CURRENT-VALUE-OF "IPDSN"}}} USER {{{CURRENT-VALUE-OF "USERFTP"}}} ? <==== Optional Password Trigger! {{{CURRENT-VALUE-OF "TYPFTP"}}} quote site blksize={{{CURRENT-VALUE-OF "BSZFTP"}}} lrecl={{{CURRENT-VALUE-OF "LRLFTP"}}} recfm={{{CURRENT-VALUE-OF "RFMFTP"}}} {{{CURRENT-VALUE-OF "SPCFTP"}}} pri={{{CURRENT-VALUE-OF "PRIFTP"}}} sec={{{CURRENT-VALUE-OF "SECFTP"}}} PUT {{{CURRENT-VALUE-OF "LOCALFILEFTP"}}} {{{CURRENT-VALUE-OF "REMOTEFILEFTP"}}} QUIT The third line of the template defines the optional user password character. If it is set to "?", then the user will be prompted for a password when running the FTP PSVirtelFtp.ps1 script on the workstation. Template Variables ^^^^^^^^^^^^^^^^^^ The following variables can be used in the FTP templates: :: {{{CURRENT-VALUE-OF "USERFTP"}}} = Screen field <%HOMEDRIVE%%HomePath%\Downloads\Log_Ftp_%dateLog%_%timeLog%.log REM Delete params rem del %HOMEDRIVE%%HomePath%\Downloads\FTPPARAM.txt #. **VirtelFtp.ps1** - Ancillary Power Shell script. #. **VirtelFtp.vbs** - Ancillary Visual Basic program. #. **PSVirtelFtp.bat** - Initial Bat file which triggers the FTP process. Should be defined as a short-cut on the desktop. Will process the FTPPARM.TXT file that has been created in the users -Download- directory. This file contains all the details of the FTP request built from the Virtel FTP screens. The file is used by the ancillary programs to initiate and perform the FTP operation. PSVirtelFtp.bat kicks off a power shell script VirtelFtp.ps1. :: echo off move %USERPROFILE%\Downloads\ftpparam.txt c:\virtel\ftp start /W /B powershell -file VirtelFtp.ps1 %1 rem del %USERPROFILE%\Downloads\ftpparam.txt Appendix B ---------- Debugging --------- **Power Shell authority** Users may find that the following error message appears when invoking the Power Shell Script:- |image12| This can be corrected by issuing the Windows command: **Set-ExecutionPolicy Bypass** Appendix C ---------- Advanced Features ^^^^^^^^^^^^^^^^^ The UPDT5799 package ships with an electron directory which contains a Node JS electron program that can monitor the uses Download directory. When a FTPPARAM.TXT file arrives from the -browser- the batch file PSVirtelNodeFtp.bat is automatically invoked to perform the FTP transfer. This functionality removes the need for the user to manually trigger the FTP processes through a desktop shortcut. To install this feature you must be familiar with Node JS, NPM and Electron web tools. This knowledge is outside the remit of this newsletter. Installation ~~~~~~~~~~~~ #. Copy the files in the electron directory to c:\Virtel\Ftp. #. Issue the command NPM INSTALL to created the Node JS/Electron environment. #. Start the FTP Watcher program with the command -Node Main-. The watcher program will now start. Whenever a new -FTPPARAM.TXT- hits the download directory the FTP process will begin. Here is an example. :: c:\virtel\ftp>node main Starting FTP Watcher on C:\Users\Holt\Downloads\ Processing FTP Request.... VIRU099I - Batch command executed for C:\Users\Holt\Downloads\FTPPARAM.TXT c:\virtel\ftp>echo off Child exited with code 0 .. |image1| image:: images/media/image1.png :width: 16.0cm :height: 9.5cm .. |image2| image:: images/media/image2.png .. |image3| image:: images/media/image3.png .. |image4| image:: images/media/image4.png .. |image5| image:: images/media/image5.png .. |image6| image:: images/media/image6.png .. |image7| image:: images/media/image7.png .. |image8| image:: images/media/image8.png .. |image9| image:: images/media/image9.png .. |image10| image:: images/media/image10.png .. |image11| image:: images/media/image11.png .. |image12| image:: images/media/image12.png