|
Putting your COPYLIB on the Web The main idea of what I am doing this month is taking a COBOL COPYLIB file, reading through it, storing up each entry, and creating a hypertext table of contents at the front of the file. There are a number of interesting things going on in this months sample program (which will open in another browser window. First off, Im not making any attempt to verify whether the file name you provide currently exists, so you may want to stick a little error checking in there. The next point is that I am creating my ultimate output file with HPFOPEN and specifying that it is a Posix type file. What this means is that if you enter COPYLIB.DATA as the name, and you are in the PUB group, you will end up with a file name that is /ACCOUNT/PUB/COPYLIB.DATA. In other words, .DATA is part of the file name, not the group. I did this for my own convenience, so you may want to make changes there. The HPFOPEN also creates the file as a bytestream file this is just to simplify the HTML generation. Some browsers tend to perpetually load when the file is fixed length and comes off the HP 3000. Next we throw out some HTML header stuff to put a date/time stamp and file name in the header of the page. Next I put out some copyright information (which I would appreciate if you left in the program). Now for each entry in the copylib, we create the HTML tag for our table of contents into our table, and then write the data out to our temp file. Each section will have its name centered, and written in larger text so its easier to read. I also strip out the name at the beginning, and the numbers at the end of each line. Once weve made our first pass at the file, we go back and dump the table we loaded into the actual HTML file, and then read our temp file and dump it to the HTML file as well. As you can see, none of this is very hard to do. The only really hard part is finding the correct HTML tags to get the desired results from your file. One of the things I like to do on an IT-oriented support intranet is to get Apache/iX set up and running on the development 3000. I then schedule a job to run every Sunday which runs my little program to dump out the copylib, then run DBHTML (a free utility from www.allegro.com that takes an IMAGE root file and produces an HTML file describing the database) on each of my databases, and also copy them into the intranet. This allows people to query information quickly that be useful while doing development. I can think of some system management-oriented type things you could also dump; for example, some of VeSOFTs Security/3000 information, and other types of things. Hopefully this months example will start you thinking on how to take more advantage of all the goodies that are now available for the HP 3000. I have a bad feeling you could do this program in 10 lines of Perl code, but I dont know Perl. Next month Im going to make a trip to Sendmail/iX myself. Ive put together some pretty handy utilities recently, and thought I would share these with everyone. Shawn Gordon, whose S.M. Gordon & Associates firm supplies HP 3000 utilities, has worked with 3000s since 1983.
Copyright The 3000 NewsWire. All rights reserved. |