Copyright 1994-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 Quirks and Curiosities Originally published December, 1994 By Kevin G. Barkes The DCL command interpreter is a complex piece of code, containing all sorts of interesting quirks and curiosities. As a complement to the periodic "Stupid DCL Tricks" feature, we're adding a new one... just plain "Stupid DCL", highlighting screwy things about our favorite CLI. Not surprisingly, many of DCL's idiosyncracies surface in its program control related commands. DCL wasn't originally intended to be a full-blown programming language. But as users began using it for more and more complex applications, DEC added IF-THEN-ELSE, GOSUB, and other control constructs to the language. Kevin Martin, of Brass Cannon Consulting, wrote to report that one of his co-workers "ran into something that is probably obvious, but he bet me a nickel I couldn't find it documented. "He's writing some DCL with a poor-man's case statement, based on the idea that you can use a symbol as a label: $ GOSUB 'case' "What drove him bonkers is what happens if 'case' is undefined. Even though there is no value after the GOSUB, it remains pending -- and the next time he uses a GOSUB, its RETURN statement brings him back to the line after *this* one. "His fix is to clear the stack by forcing a RETURN, like so: $ on warning then goto label_ng $ GOSUB 'case' $ goto case_null $ label_ng: $! We are here due to a "gosub" with a bad label -- but we still $! have to clear it with a RETURN statement: $ RETURN $ case_null: $! If 'case' was invalid or not defined, we'll end up here. "Could be a subtle bug to find, especially if you just added a second GOSUB into a routine that only had one before! "PS: He won the nickel." Those of you with any other peculiarites are invited to send them in. The Stupid DCL Tricks pile is a bit anemic as well. Remember, command procedures should be short, non-site-specific, and debugged. ------ KERMIT and Democracy When 94 million Brazilians went to the polls on October 4 to elect a new president, the official count required about a quarter of the time required for the last election, thanks to Kermit software. 3,800 Digital Equipment Corporation DECpc personal computers with modems, special data entry software, and Columbia University's MS-DOS Kermit software were installed at 2,000 data entry and transmission sites in all parts of Brazil, some of them so remote that they could only be reached by boat or small plane. Approximately 300,000 data files, one for each ballot box, were transmitted by telephone from these stations via Kermit protocol to Hewlett-Packard UNIX systems, running Columbia's C-Kermit 5A(190) software, and from these to the central site in Brasilia. The application exploited a number of Kermit's biggest features: 1. The software is free; 2. Kermit is robust enough to work over very poor quality phone lines, of which Brazil has more than its share; 3. The software is available for virtually all computer platforms; 4. Kermit's powerful scripting language allowed automating the entire communications process of logon, transfer and logoff; 5. The protocol ran on top of TCP/IP is some locations, allowing it to be used in different communication environments with the same interface; and 6. The lines used could be dial-up, leased, or X.25 PAD. If Kermit can work in a difficult situation like this, you can imagine what it can do in your shop. Don't be led astray by the old versions of Kermit floating around. The newest MS-Kermit and C-Kermit programs have features and speeds rivaling the leading commercial software packages. I use a number of DCL command files and Kermit script files to transfer multiple-megabytes of data between my business and clients automatically each day. For the latest info on Kermit check out www.columbia.edu/kermit. ------ (Update: This is a joke. Really.) Learning Unix is now a marvelously simple task, thanks to a wonderful piece of MACRO-32 code posted on the Usenet comp.os.vms newsgroup by Ehud Gavron, one of its more noted participants. GAVRON.MAR (program) was uploaded to the CompuServe VAXforum a few months back and is also available from a number of places on the Internet, including kgbreport.com. It's elegantly simple to use. Put the source file, GAVRON.MAR, in your login directory. Then compile and link it: $ MACRO GAVRON $ LINK GAVRON Next, add these symbol definitions to your login.com to access the emulator: $ cd == "$sys$Login:gavron cd" $ ls == "$sys$Login:gavron ls" ... $ command == "$sys$Login:gavron command" For a quick test, type $ cd and you'll fully experience the wonders and utility of the Unix operating system. Happy holidays! ******************* Kevin G. Barkes is an independent consultant who wishes a happy holiday season to his readers and gently reminds them that his shoe size is 10, his shirt size is 18 1/2, and the THX letterboxed Jurassic Park CAV laserdisc makes a wonderful gift any time of the year. Kevin lurks on comp.os.vms and can be reached at kgbarkes@gmail.com. Program. .library /sys$Library:lib.mlb/ pc7: .ascid "save registers" pc5: .ascid "maintain status" .macro exec_m calls #1,g^lib$put_output .endm pc1: .ascid "handler u$x" .entry exec,^m movab pc1,r0 moval @4(r0),r6 pushl r6 movl #^x6D756420,B^04(R6) movw #^x6572,B^02(R6) addl3 #5,(sp),r7 movw #^x6570,B^03(R7) addl2 #4,sp movw #^x6F43,(R6) movw #^x2064,B^05(R7) movl r0,-(sp) exec_m .end exec