Copyright 1988-2016 by Kevin G. Barkes All rights reserved. This article may be duplicated or redistributed provided no alterations of any kind are made to this file. This edition of DCL Dialogue is sponsored by Networking Dynamics, developers and marketers of productivity software for OpenVMS systems. Contact our website www.networkingdynamics.com to download free demos of our software and see how you will save time, money and raise productivity! Be sure to mention DCL Dialogue! DCL DIALOGUE Originally published September, 1988 Hands Off By Kevin G. Barkes When I talk with readers at events such as DEXPO and encourage them to share their DCL procedures with others, many fear their efforts won't "measure up". As one fellow explained at the DEC Pro's booth during the Cincinnati DEXPO, "I'm afraid of getting ripped to shreds by the real DCL hackers. I know there are probably better ways of doing some of the things I do, but the procedures work and they do the job for me." While I've never "ripped to shreds" any submissions, I have returned some to their authors for reworking when the procedures didn't work properly. I am guilty of "tweaking" a few lines here and there to help improve performance or readability. One reader took me to task for modifying procedures which appear in this column. "I thought the idea was to see what techniques others use in writing DCL," my anonymous critic said. "How is that possible when you change things to conform to your concept of proper programming?" A good point, that. Most programmers are guilty of "improving" another's code when the opportunity presents itself, and I'm no exception. But I see the reader's concern, and it's certainly a valid one. From this point on, reader-submitted procedures will appear in their original form, with comments and suggestions limited to the text of the column. Your comments and suggestions are, as always, welcome and solicited. SUBCOM.COM This procedure (Program 1) was sent along by Sandy Felton, a Systems Analyst for BP North America Petroleum, Inc. in Houston, Texas. "The idea for the COM file came about by two personal needs," Sandy explains. "a) the desire to use batch processing to free up my terminal for other things, especially when the task is time-consuming; b) the need to monitor events taking place on all the nodes of our cluster. "I was tired of constantly having to use EDT or the CREATE command at DCL to write small files which I would then submit, having to type in the correct queue(s) and then having to remember to delete the small file... "SUBCOM prompts you for commands repeatedly until you hit return. DCL commands must be prefaced by $ and answers to program prompts are input without the dollar sign. You need to use double quotes if the command has quotes in it. SUBCOM writes these commands to a file called SUBCOM_HHMMSS.JOB. You are then prompted for which queue(s) to submit the job. You can select one queue or all queues. If you have more than three nodes in your cluster, you can modify SUBCOM to suit your needs. I changed the actual names of our nodes to NODE1, NODE2 and NODE3. So that you know which node the job ran on, the nodename is written to the log file as the first command executed. The submit command invoked has NOPRINT and DELETE (as well as NOTIFY). "After selecting queue(s), you are prompted for a time to submit the job. The default is NOW; input the time exactly as you would in DCL if you want to schedule the job. "Since many installations delete all .LOG files nightly, SUBCOM lets you save the log file (with an extension .SAVLOG) if the file is invoked with any parameter, e.g. @SUBCOM 1." Sandy's procedure is useful, and the tweakers among us can have a good time while essentially leaving the procedure intact. One of the drawbacks of using INQUIRE and WRITE statements in a procedure such as this is, as Sandy points out, the need to exercise care when using a command line containing quotes. For example, the command $ REPLY/BELL "This is a test" would have to be input as $ REPLY/BELL """This is a test""" because of the way INQUIRE processes the input line. This problem can be circumvented by using READ statements instead of INQUIREs, or even using the COPY command to grab the text from SYS$INPUT and direct it to the appropriate SUBCOM file. Similarly, a COPY or TYPE command could replace the six separate "WS" commands following the ASK_QUEUE label. The method used by Sandy to trap invalid responses to the option question is valid, although a more efficient method might be to check OPT for values less than 1 or greater than 4. Responding with a "T" or "Y" would trick the procedure into thinking a "1" was entered, but any other non-numeric characters would be trapped. Using a one-second delay for /AFTER circumvents the problem of having the qualifier generate an error if no value is specified with it, although "00:00" could be used as well. Finally, Sandy's method of assigning SYS$OUTPUT and SYS$ERROR to the null device is a valid alternative to using the slower SET MESSAGE commands, although it would be preferable to use ASSIGN/USER rather than having to explicitly deassign the logicals. ----- MESSAGE Bugs For example, David Blanchard, an ARIS user and a regular on my own SYS$OUTPUT board, found a few bugs in the MESSAGE.COM utility which appeared in the June DEC Pro. "I recently dl'ed file MESSAGE.COM from ARIS, but was unable to get it to work," Dave reported. "I included some diagnostics in the file to track down the problem and found two of them. "1. When the user does not include a file, the program prompts the user for a message and creates a file of type .DAT. The batch program, on the other hand, is looking for a file of type .TXT. I fixed this by changing the following line from: FN = TMPDIR + RAWFN to FN = TMPDIR + RAWFN + ".TXT" "2. When the message file was included as P3, the program died when attempting to close MFILE. This file is only opened when the user interactively enters text. This problem was solved by moving the following: END_MESSAGE: CLOSE MFILE so that it is BEFORE label GOT_P3: "Otherwise, it works fine. Thanks for a nice routine." ----- Undocumented Checksum: Another ARIS and SYS$OUTPUT regular, Brian DeSantis, happened across an undocumented DCL command which returns a file's checksum. "I don't remember where I came across this," Brian reported. "I may have seen it in a DECUS publication or while looking through DCLTABLES. "The command form is $ CHECKSUM filename. The results are placed in the local symbol CHECKSUM$CHECKSUM." If anyone has any additional information regarding this command, how about passing it on here? ------ Philosophy 101: Several FidoNet VAX echo participants raise the perplexing question: if DECUS is pronounced "DEEK-US", why isn't DEC pronounced "DEEK"? ---------- Kevin G. Barkes is an independent consultant. He publishes the KGB Report newsletter, operates the www.kgbreport.com website, lurks on comp.os.vms, and can be reached at kgbarkes@gmail.com.