Copyright 1991-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 October, 1991 VMS PENTOTHAL By Kevin G. Barkes If you're a fan of DCL lexical functions, then you have to like VMS 5.4. DEC's added several features to a number of "old" functions and unveiled some brand new lexicals, too. F$TYPE has new return values that reveal if symbols were created by calls to the F$PID or F$CSID lexicals. (F$CSID is a new function that returns the cluster identification numbers for nodes in a cluster.) F$GETSYI has a new parameter, cluster_id, which allows you to obtain certain types of information about other nodes in a cluster. It also has new item codes: AVAILCPU_CNT, which returns the number of CPUs recognized by a symmetrical multi-processing system; ACTIVECPU_CNT, which returns the number of CPUs active in an SMP system; SYSTEM_RIGHTS, which contains the contents of the system rights list; and several other codes which provide information about any vector processors in a system. Vector item codes were also added to F$GETJPI, as were some long-awaited items which return process rights information. F$GETDVI now knows about VT4xx-class terminals, thanks to the TT_DECCRT4 item. The volume-shadowing status of shadowed disks can now be interrogated with a half-dozen or so SHDW items. Three new items codes were added to F$ENVIRONMENT. DISIMAGE reports whether the process executing the lexical is operating from an account which allows images to be activated using RUN, MCR, or foreign commands. RESTRICTED is another boolean item which shows if the process is logged into a restricted account. VERB_SCOPE reports the process' current verb scoping state, which is affected by the SET SYMBOL command. My favorite addition is the F$DEVICE lexical, a new function that returns the names of devices on the system by using the $DEVICE_SCAN system service. In its most rudimentary usage, F$DEVICE can spew forth a complete listing of every device on a system with a few lines of straightforward DCL (Program 1). This little procedure, run on my VAXstation 3100, revealed 62 devices; everything from disk drives to mailboxes to pseudo-devices to some thingies that appear to be hyperspatial in nature and are simply unfathomable to a mere mortal such as myself. For a more practical exercise, I wrote PENTOTHAL.COM (Program 2), a procedure which causes a VAX to reveal quite a lot about itself. It's a lot easier than doing repeated SHOW commands, and even handier when you get plopped into a unknown environment. Running it on my VAXstation produced what you see in Figure 1. Figure 2 shows a typical display from an eight-node VAXcluster. (You can direct the output of the procedure to a file using the appropriately-named /OUTPUT=filename qualifier to the "@" command.) F$DEVICE can return information on disks, tapes, synchronous communications devices, card readers, terminals, line printers, mailboxes... just about every device on the system. A full description of the lexical can be found in the DCL Dictionary. This modest hack got me into some minor trouble with a client. A non-technical management type wandered by, saw his multi-million dollar investment spilling its guts in intimate detail, and called the system manager on me. When we explained to the blue suit that the procedure was non-privileged and that anyone could use it, he directed the manager to disable all lexical functions on the system. I don't want to be around the next time the poor guy has to run AUTOGEN. ****************************** Kevin G. Barkes is an independent consultant and insomniac. 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. ************************** PROGRAM 1: $ LOOP: $ OUTPUT = F$DEVICE() $ IF OUTPUT .EQS. "" THEN EXIT $ WRITE SYS$OUTPUT OUTPUT $ GOTO LOOP $ EXIT ************************** PROGRAM 2: $!PENTOTHAL.COM $ SET NOON $ SAY:= WRITE SYS$OUTPUT $ SAY "You are on a ",F$GETSYI("HW_NAME")," named "- ,F$GETSYI("NODENAME")," running Version "- ,F$EDIT(F$GETSYI("VERSION"),"TRIM")," of VMS." $ SAY "It was last booted on ",F$GETSYI("BOOTTIME"),"." $ SAY "This system has ",F$GETSYI("AVAILCPU_CNT")," cpu(s);"- ," ",F$GETSYI("ACTIVECPU_CNT")," is/are active." $ IF .NOT. F$GETSYI("CLUSTER_MEMBER") $ THEN $ SAY "It is not a member of a VAXCluster." $ ELSE $ SAY "It is a member of a VAXCluster containing "- ,F$GETSYI("CLUSTER_NODES")," nodes." $ SAY "This VAXcluster has a total quorum of "- ,F$GETSYI("CLUSTER_QUORUM")," and "- ,F$GETSYI("CLUSTER_VOTES")," total vote(s)." $ SAY "This node's quorum value is ",F$GETSYI("NODE_QUORUM")- ," and it has ",F$GETSYI("NODE_VOTES")," vote(s)." $ ENDIF $ SAY "This system contains the following disks:" $ DISKLOOP: $ DISK = F$DEVICE(,"DISK") $ IF DISK .EQS. "" THEN GOTO TAPE $ SAY DISK," type: ",F$GETDVI(DISK,"MEDIA_NAME")- ,"; maximum blocks: ",F$GETDVI(DISK,"MAXBLOCK")- ,"; free blocks: ",F$GETDVI(DISK,"FREEBLOCKS") $ GOTO DISKLOOP $ TAPE: $ SAY "This system contains the following tape drives:" $ TAPELOOP: $ TAPE = F$DEVICE(,"TAPE") $ IF TAPE .EQS. "" THEN EXIT $ SAY TAPE," type: ",F$GETDVI(TAPE,"MEDIA_NAME") $ GOTO TAPELOOP $ EXIT ************************** FIGURE 1 You are on a VAXstation 3100 named SPOCK running Version V5.4-2 of VMS. It was last booted on 20-SEP-1991 00:16:36.98. This system has 1 cpu(s); 1 is/are active. It is not a member of a VAXCluster. This system contains the following disks: _SPOCK$DKA100: type: DKX00; maximum blocks: 1304052; free blocks: 675279 _SPOCK$DKA200: type: RZ23; maximum blocks: 204864; free blocks: 170979 _SPOCK$DKA300: type: RZ23; maximum blocks: 204864; free blocks: 116327 _SPOCK$DUA2: type: RX23; maximum blocks: 2880; free blocks: 2856 This system contains the following tape drives: _SPOCK$MKA500: type: TK50 ************************** FIGURE 2 You are on a VAX 8800 named PICARD running Version V5.4-2 of VMS. It was last booted on 21-SEP-1991 13:16:22.12. This system has 2 cpu(s); 2 is/are active. It is a member of a VAXCluster containing 8 nodes. This VAXcluster has a total quorum of 2 and 3 total vote(s). This node's quorum value is 2 and it has 1 vote(s). This system contains the following disks: _CSA1: type: RD53; maximum blocks: 65535; free blocks: 0 _$1$DUA0: type: RA82; maximum blocks: 1011258; free blocks: 158724 _$1$DUA1: type: RA90; maximum blocks: 2300805; free blocks: 84105 _$1$DUA2: type: RA90; maximum blocks: 2300805; free blocks: 693777 _$1$DUA3: type: RA81; maximum blocks: 495930; free blocks: 19326 _$1$DUA4: type: RA81; maximum blocks: 495930; free blocks: 37845 _$1$DUA5: type: RA90; maximum blocks: 2142360; free blocks: 115068 _$1$DUA6: type: RA82; maximum blocks: 1657500; free blocks: 948621 _$1$DUA7: type: RA90; maximum blocks: 2300805; free blocks: 435681 _$1$DUA8: type: RA90; maximum blocks: 2300805; free blocks: 850245 _$1$DUA9: type: RA81; maximum blocks: 3758732; free blocks: 2791000 _RIKER$DKB0: type: DKX00; maximum blocks: 1312344; free blocks: 1175475 _LAFORGE$DUA0: type: RA81; maximum blocks: 0; free blocks: 0 _CRUSHER$DUB0: type: RRD50; maximum blocks: 1216680; free blocks: 588333 _TROI$DUA0: type: RD54; maximum blocks: 311200; free blocks: 51906 This system contains the following tape drives: _$1$MUA0: type: TA78