Copyright 1987-2016 by Kevin G. Barkes All rights reserved. Non-commercial use is permitted, provided the preceding credit lines are included. Contact kgbarkes@gmail.com for other uses. Please note this article may have appeared in an issue other than the date indicated, and that there may be some differences between this version and the printed version. This is the original, unedited submission to the magazine. DCL DIALOGUE Originally published October, 1987 By Kevin G. Barkes "Where It's @" The DCL execute procedure command (@) has another function many users seem to overlook. What the "@" actually does is tell DCL to stop looking at SYS$COMMAND for its input, and to instead read the device or file following the at sign. This permutation is handy when using DCL commands containing a large number of qualifiers and arguments. As an example, look at a typical ACCOUNTING command: $ ACCOUNTING /USER=SMITH - /SINCE = YESTERDAY - /BEFORE = 12:00 - /QUEUE = SYS$PRINT - /OUTPUT = LOGFILES:PRINT.LOG You can create a command procedure containing the full command, of course; but you can also enter just the command qualifiers in a file: ! ACCQ.COM /SINCE = YESTERDAY - /BEFORE = 12:00 - /QUEUE = SYS$PRINT - /OUTPUT = LOGFILES:PRINT.LOG and then issue the command by entering: $ ACC /USER=SMITH@ACCQ $ ACC /USER=JONES@ACCQ The rules regarding the use of @ in this manner are very simple. If the file begins with command qualifiers (anything beginning with a "/"), there should be no space between the @ and the preceding command string. If the file starts with a command parameter, a space should be included: --------- ! LIST.COM *.OBJ,- *.LST,- *.EXE --------- $ DIRECTORY @LIST The lines containing command parameters and qualifiers should not begin with dollar signs. However, you can place additional DCL commands following the parameter and qualifier lines: ------- !PURGE.COM *.OBJ,*.LST,*.EXE $ INQUIRE/NOPUNC ANS "Purge files? " $ IF .NOT. ANS THEN EXIT $ PURGE/LOG *.OBJ,*.LST,*.EXE ------- $ DIR @PURGE Directory DISK1:[SMITH] 1.OBJ;1 1.OBJ;2 1.OBJ;3 Total of 3 files. Purge files? Y %PURGE-I-FILPURG, DISK1:[SMITH]1.OBJ;3 deleted (23 blocks) %PURGE-I-FILPURG, DISK1:[SMITH]1.OBJ;2 deleted (23 blocks) As you can see, this capability presents users with a great deal of versatility, and can help to reduce the number of symbols normally used to eliminate typing of long parameter/qualifiers on the command line. Have some spiffy command files you'd like to share? Send them on in, making certain to include your name and address. To help reduce the possibility of typing errors, we prefer getting the procedures on magnetic media. ----------- The May column contained a discussion concerning selective procedure verification; that is, a way to turn verification on or off prior to invoking a command file. Linda M. Book, a Programmer/Analyst for Monsanto Company in St. Louis, MO, cut through all the arguments about the use of lexicals, logicals, etc., with a devastatingly simple and wonderfully elegant suggestion. "Instead of defining a global symbol to contain all the file names for which you want verification enabled, and then adding at least five lines of code to parse and determine whether or not to verify, I have an easier way. "Use the statement $ sav_ver = f$verify('ver_test'+0) at the beginning of your procedure. Then, if you want to verify your procedure, enter $ ver_test = 1 at the DCL command level before invoking your procedure. To turn off verification, enter $ ver_test = 0. If you use this method, you never have to worry about whether or not the symbol ver_test has been defined. If not, it will have a null value, and verification will be off." Linda also suggested placing most of the documentation and help information after the final EXIT command in command files to help increase execution efficiency. "This results in speedier code," she notes, "plus the ability to include a large amount of documentation internal to the file." -------------- This month's user command file is from Gerald Soo of Shared Medical Systems, 2201 Broadway, Oakland, CA 94612. An active ARIS user and frequent contributor, Gerald's .COM file is used to print out files on LA50 printers slaved to VT220 CRTs. "You will probably think, 'Why does he need a command procedure to do this when all he has to do is hit Print Screen before and after the file is printed?'" Gerald notes. "Well, this command procedure will do that for you and if you use wild cards, form feeds will be printed between each file. When the file is being printed, [it] is not displayed on the screen; only to the printer." Since I don't have access to a VT220-printer combo, I didn't have an opportunity to completely test Gerald's procedures. You're encouraged to send you comments and suggestions to him directly at the above address. ----------------------------- ! TYPE_PRINT_FAST.COM ! By Gerald Soo ! ! Prints files to an LA50 printer attached to a VT220 terminal. ! Files being printed are not displayed on the terminal. ! To print in 16.5 c.p.i. mode, enter a "W" as the second ! parameter to the procedure. ! For help, enter "?" as the first parameter. ! .LIS is the default extension for files to be printed. ! Wild cards are permitted. ! Entering a "D" as the third parameter will cause the file ! to be deleted after it is printed. !--------------------------------------------------------------- $ put := write sys$output $ form_feed[0,8] = %d12 $ escape[0,8] = %d27 $ csi = escape + "[" $ on control_y then goto turn_off_printer_controller $ if p1 .eqs "" then goto get_input $ continue_init: $ if p1 .eqs. "?" then goto print_help $ if f$locate(".",p1) .eq. f$length(p1) then p1 = p1 + ".LIS" $ if f$locate("*",p1) .eq. f$length(p1) then goto check_file $ goto check_file_wild $ print: $ put "File size for ",f_name," = ",f$file(f_name,"eof")," block(s)" $ vfy = f$verify(0) $ put csi,"5i",csi,"0w" ! turn on printer controller at 10cpi $ set term/form/nobroad $ type 'f_name $ put form_feed,csi,"4i" ! print and turn off printer controller $ if p3 .eqs. "D" then delete/nolog 'f_name $ end_vfy = f$verify(vfy) $ if f$locate("*",p1) .eq. f$length(p1) then goto exit $ goto check_file_wild $ get_input: $ inquire/nopun p1 "File to print : " $ if p1 .eqs. "" then goto get_input $ if p1 .eqs. "ABORT" then goto exit $ goto continue_init $ check_file: $ f_name = f$search(p1,1) $ if f_name .eqs. "" then goto no_such_file $ if f$file(f_name,"org") .nes. "SEQ" then goto not_seq $ if f$file(f_name,"rfm") .nes. "VAR" then goto not_var $ if p2 .eqs. "W" then goto print_gt_80 $ goto print $ check_file_wild: $ f_name = f$search(p1,1) $ if f_name .eqs. "" then goto exit $ if f$file(f_name,"org") .nes. "SEQ" then goto not_seq $ if f$file(f_name,"rfm") .nes. "VAR" then goto not_var $ if p2 .eqs. "W" then goto print_gt_80 $ goto print $ print_gt_80: $ put "File size for ",f_name," = ",f$file(f_name,"eof")," block(s)." $ put csi,"5i",csi,"4w" $ set term/form/width=132/nobroad $ type 'f_name $ put form_feed,csi,"0w",csi,"4i" $ if p3 .eqs. "D" then delete/nolog 'f_name $ if f$locate("*",p1) .eq. f$length(p1) then goto exit $ goto check_file_wild $ not_seq: $ put "File ",csi,"7m",f_name,csi,"0m is not a sequential file." $ if f$locate("*",p1) .eq. f$length(p1) then goto exit $ goto check_file_wild $ not_var: $ put "File ",csi,"7m",f_name,csi,"0m is not a variable length file." $ if f$locate("*",p1) .eq. f$length(p1) then goto exit $ goto check_file_wild $ no_such_file: $ put "File ",csi,"7m",p1,csi,"0m not found" $ goto exit $ print_help: $ put " File to print on slave printer" $ put " A """W""" as this parameter indicates that WIDE mode" $ put " printing is to be used." $ put " A """D""" as this parameter will delete the" $ put " file after it has been printed." $ put " " $ put "NOTE: The file MUST be variable length and sequential." $ goto exit $ turn_off_printer_controller: $ put csi,"4i" $ exit: $ set term/noform/broad $ if p2 .eqs. "W" then set term/width=80 $ exit ---------- 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.