Fun with VBScript, ftp and other stuff
Some time ago I was involved in the review of some hands on lab work that was associated with an introduction to z/OS course. The lab requires that some files be available on the z/OS system and the easiest way to get them there is to have the files as xmit copies on the PC and to transfer them to the host, then simply receive them to restore the original files to the students TSO userid so that each student has their own copy of the files.
In principle this is fine but the number of files and the fact that whoever is doing this is pretty new to z/OS anyway meant that many students were having difficulty following the instructions. Too many files, too many differences between systems, too many instructions. You get the idea. So the developers of the lab work asked for some help, which is where I come in (again!).
Whenever I have to do this sort of thing more than once or twice I usually end up writing a tool to do it. Typically in the past I have used a combination of windows BAT files to do the main work like drive the ftp commands and VBS (VBScript) files to do the windows stuff like select the files to be sent, issue messages in pop up dialogs and ask for confirmations of actions with a simple yes/no windows dialog box.
While this works, the end result is really just a script running in a dos window. Fine for a personal tool but not that great for general use, especially when used by total newbies!
In order to ‘dumb it down’ as much as possible I was just going to do everything in a single VBScript file, then I remembered that Windows has these things called HTML Applications (.HTA files). Basically a web page running inside it’s own scripting engine on the desktop with access to the file system etc. Really it’s a Windows application but using HTML to define the GUI. Much like Adobe AIR except without the run time download and install requirement since the scripting engine is already on the Windows box. This means that it is Windows and IE only. However those limitations are not a problem in this instance.
Once I’d figured out how to drive the FTP command, the rest was pretty easy. Yeah, Right! In fact most of the ‘problems’ I had related to the different configurations of FTP on the target host systems I was working with. Having got it all working with my main development system, I switched to a different host and watched it all fail. Such is life I guess.
In many ways though, that failure was blessing in disguise. My ‘application’ needs to submit a job to the host and then wants to monitor the job’s progress. I found that with the correct setup, not only can you see the state of the job (ftp DIR command), you can get its output from the JES queue when it ends. This means my application can grab the job output from JES and analyze it for any failures. I could add more but right now it can detect non zero return codes, abends, jcl errors and canceled before execution conditions.
The ultimate accolade came from my wife, a complete technophobe when it comes to computers. I showed it to her and she said that even she could use it. It doesn’t get any better than that!
I was later thinking about how I’d actually developed this application and I decided it was the ultimate in Test Drive Development (TDD). Since most of the time I had NO idea what I was doing and only a vague idea of where I was going, it was very much a case of code something, test it, fix the problem, test it again etc. The whole development process was interactive from start to end with almost no design work except a little thinking about how I wanted the user to experience the work flow maybe, certainly nothing written down. I’m not sure if this is a good thing or a bad thing but either way, I think the final application turned out to be pretty neat, even if I do say so myself!