*** OpenVMS Tips for newbies *** History: This file I created originally for the Murdoch University MINCS club's VMS S.I.G. after Jeff Murphy (jeff0) demanded (exceptionally strongly in his generally strong and rather colourful way), that I commit these "factoids" to a text file and make it available as opposed random IRC outbursts in #mincs or as comments at a club gathering. Sadly, a few years later jeff0 passed away from a road accident and his extensive computer collection was donated to the club, along with his old AlphaServer 1000 (266Mhz EV45) which became the second VMS and first non-VAX VMS shell and dev environment used mostly for club members who wanted to start fiddling around on the club VMS systems, or alternatively on their own hardware/emulator, this file was intended for use by them. The Alpha system was "bert", joining "earnie" (VAX/VMS 6.x), "elmo" the BSD email/shell box, inferno (HPPA + Vector Processor), "cookie" the frequently cracked E3 web server/news/forums. There's a one-sideded history/nostalgia waxed on the main page. This file has changed somewhat over the years and it has also become a frequent non-volitile memory storage for those very infrequent and non-day-to-day tasks I perform on my VAX and Alpha's here at home. I hope it is of some use to newbies and it is still maintained. ---------------------------------------------------------------------- * DCL command comments: $! This is a comment. DCL will ignore anything with a bang. $ WRITE SYS$OUTPUT "Like a unix echo statement. Not commented" $! WRITE SYS$OUTPUT "this one is commented and will not print" * Mount a CD: $ SET PROC/PRIV=ALL $ MOUNT/OVER=ID DKA500: /OVERRIDE=IDENTIFICATION $! /OVERRIDE=IDENTIFICATION means ignore the vol lable/id and just mount $! DKA500 is SCSI chain A and scsi ID 5 on my system. See below for $! coments on device name/numbering and the SHOW DEV command. * Unmount and eject a tape or cd: $ DISMOUNT/UNLOAD MKA700: * Goto the root of the CDROM's file system: $ SET DEFAULT DKA500:[000000] $! SIX ZERO's!! * Search for a file, equivelent to "find . -print | grep -i someting" under unix: $ DIR/NOHEAD/NOTRAIL [...]*FOO*.*;* $! Search now from the root of a volume/dir assuming permissions to read $ DIR/NOHEAD/NOTRAIL DKA100:[000000...]*FOO*.*;* * Search files for a string in it. Much like find . -print | xargs grep "fluffy" or on newer GNU tools grep -R "fluffy" * $ SEARCH /WINDOW=1 [...]*.*;* "FLUFFY" $! The /WINDOW= is how many lines to display in each file. Eg 0, 1, 2.. etc * Show me files by disk size: $! Default size unit is the 512byte block $ DIR/SIZE fluffy.* Directory SYS$COMMON:[TEMP] FLUFFY.TXT;1 7 Total of 1 file, 7 blocks. $! As above showing me KiloBytes as the unit type $ DIR/SIZE=UNITS=BYTES FLUFFY Directory SYS$COMMON:[TEMP] FLUFFY.TXT;1 3KB Total of 1 file, 3KB * Set my terminal to be vt100 $ SET TERM/VT100 * Try and guess my terminal by querying the capabilities (if any!) $ SET TERM/QUERY * File protections - The old way - Display and Set them $ DIR FOO.EXE/PROT FOO.EXE;1 (RWED,RWED,RE,) $ SET FILE/PROT=WORLD=RE $ DIR FOO.EXE/PROT FOO.EXE;1 (RWED,RWED,RE,RE) * File protections - The new way - Display and set them $ DIR/SECURITY FOO.EXE;1 (RWED,RWED,RE,) $ SET SECURITY/CLASS=FILE/PROTECTION=(WORLD:R) FOO.EXE;* $ DIR/SECURITY FOO.EXE;1 (RWED,RWED,RE,R) $! Works the same way for directories, add .DIR Eg: $ SET SECURITY/CLASS=FILE/PROT=(WORLD:RE)/LOG TCPIP$NTP.DIR * Ownership - Change an ownership of a directory $ SET SECURITY/OWNER=someone FRED.DIR * VMS Device Types frequently spotted int he wild: * DU - Generic Disk * DK - SCSI Disk * DI - DSSI Disk * DS - Shadowed Disk ("Host" based shadowing) * MU - Generic Tape * MK - SCSI Tape * MI - DSSI Tape * List all devices with all details the system can see: $ SHOW DEV/FULL/PAGE * List only the system devices currently mounted: $ SHOW DEV/MOUNT * List only my tape drives: $ SHOW DEV MK * VMS flavoured tail -f $ TYPE/CONTINIOUS FILE.TXT !$ can also say /CONTINIOUS=10 for checking every 10 seconds. 30 is default * VMS background/SPAWN a process. $! Say I want to TYPE/CONT the VMSBUILD.LOG from a compile session of $! nethack. $ SUBMIT VMSBUILD.COM $! This spools output from SYS$BATCH to the log file in SYS$LOGIN $ SPAWN/NOWAIT TYPE/CONT SYS$LOGIN:VMSBUILD.LOG * Leave the List & Asm from a C compile (It's interesting to see the ASM). $ CC/LIST/MACHINE_CODE foo.c !$ check the foo.lis file * Create a user $! We need to edit the system user access file SYSUAF $ SET DEF SYS$SYSROOT:[SYSEXE] $ RUN AUTHORIZE UAF> add games/password=temp/owner="games"/dev=dkb0/dir=[gaes]/uic=[202,202]/flag=nodisuser UAF> EXIT $! add for SYSTEM priv: /priv=all * Migrate LMF Licenses to new ones before it expires and goes tits up: Start with a fresh LDB and load only the PAKs I intend to use, then I do a LICENSE LOAD: $ RENAME LMF$LICENSE *.yyyy ! "yyyy" for the year $ LICENSE CREATE $! Execute my PAK extract at this point $ LICENSE LOAD Also.. $ LICENSE DELETE * ..will delete all lic's * Modify the password expiry time to infinite. $ RUN [VMS$COMMON.SYSEXE]AUTHORIZE.EXE UAF> MODIFY SYSTEM/PWDLIFETIME=NONE ;;for ever! --or-- UAF> MODIFY SOMELUSER/PWDLIFETIME="120-" ;;120 days, no hours etc. * Modify the node license for OPENVMS-ALPHA or VAX to include the current node for the base license. $ LICENSE MODIFY /INCLUDE=RHINOX OPENVMS-ALPHA !$ then you need to load the license so it's active. $ LICENSE LOAD OPENVMS-ALPHA * Delete a license PAK $ LICENSE DELETE OPENVMS-ALPHA * Set the maximum number of RMS versions for a file. $ SET FILE/VERSION_LIMIT=3 FOO.TXT $! The above will fail if the file is in use. * List and Delete multiple files: DUA3:[HOMES.BOYANICH.COBOL.MULTI.USR.REC-LOCK]$ DIR *.EXE, *.OBJ DUA3:[HOMES.BOYANICH.COBOL.MULTI.USR.REC-LOCK] SPIN-LOCK.EXE;9 MU-TEST.EXE;49 SPIN-LOCK.OBJ;17 MU-TEST.OBJ;61 Total of 4 files. DUA3:[HOMES.BOYANICH.COBOL.MULTI.USR.REC-LOCK]$ DEL *.EXE;*, *.OBJ;* DUA3:[HOMES.BOYANICH.COBOL.MULTI.USR.REC-LOCK]$ DIR *.EXE, *.OBJ %DIRECT-W-NOFILES, no files found DUA3:[HOMES.BOYANICH.COBOL.MULTI.USR.REC-LOCK]$ * Set the maximum number of RMS versions for all files in a dir. $ SET DIRECTORY/VERSION_LIMIT=3 [.SRC.6502.ASSEMBLER] * Purge all bar the most recent 2 versions of a file: $ PURGE/KEEP=2 *.TXT * Logicals: Create a logical $ ASSIGN/NOLOG DUA0:[000000] ROOT$DIR: $ SHOW DEV $ ASSIGN/NOLOG DUA0:[000000] ROOT$DIR: $ SET DEF SYS$LOGIN $ SHOW DEF DUA0:[USERS.URIDIUM] $ SET DEF ROOT$DIR: $ SHOW DEF DUA0:[000000] !$ the /NOLOG means don't notify if the older version !$ of the logical was overwritten. The def behaviour !$ is to /LOG * Logicals: List all defined logicals starting with sy* $ SHOW LOGICAL SY*/PAGE * Batch Queues with SYS$BATCH. It's not created by default after an install. Verify the queue manager is running and create the queue then start it. Observe! $ START/QUEUE/MANAGER !$ Alternatively: !$ $ START/QUEUE/MANAGER/NEW_VERSION !$ if there's no SYS$SYSROOT:[SYSEXE]QMAN$MANAGER.DAT $ SHOW QUEUE SYS$BATCH $! -- errors and grumbles $ INITIALIZE/QUEUE/BATCH SYS$BATCH $ START /QUEUE SYS$BATCH $ SHOW QUEUE SYS$BATCH /FULL $! Also check SYSTARTUP_VMS.COM for $! an appropriate START cmd for SYS$BATCH * VMS equiv of truss. Requires CMEXEC priv's. $ SET WATCH FILE/FILE=quux $!--where quux within: $! ALL/ATTACHED/ATTRIBUTES/CONTROL/DIRETORY/DUMP/MAJOR/NONE/QUOTA * Foreign Symbols and MCR. Foreign symbols are required for running exe's and com files outside the SYSEXE path. You define them either on the fly or use MCR. eg: $ UNZIP:==$DKA100:[OPT]UNZIP.EXE $! --or-- $ MCR DKA100:[OPT]UNZIP.EXE $!..I'm not sure on how MCR works. No HELP docs that I can see but $!there is mention of it on my RSX-11M docset. To be investigated. * XRUN. The RUN command cannot take parameters. So you can either define a foreign symbol directly or via MCR, or define an XRUN command. Eg: $ XRUN:==MCR "SYS$DISK:[]'" --then simply: $ XRUN exe params * Resetting a user password other than the current logname is not possible unless the user has PROC/PRIV=ALL. To reset for example the SYSTEM user's password and reset expiry & lifetime flags: $ SET PROC/PRIV=ALL $ SET DEF SYS$COMMON:[SYSEXE] $ RUN AUTHORIZE UAF> MODIFY SYSTEM/PASSWORD=SHHSECRET/FLAGS=NOPWD_EXPIRED/PWDLIFETIME=NONE %UAF-I-PWDLESSMIN, new password is shorter than minimum password length %UAF-I-MDFYMSG, user record(s) updated UAF> exit * UNIX O/S's frequently have an activity viewer called top or nmon. VMS comes with a similar facility, conceptually closer to nmon. It is called "MONITOR". It is activated thus: $ MONITOR SYSTEM It also has a file logging facility for capacity planning/logging and may be interrupted by ^Z. * Monitor may also be used to: $! Monitor the top processes hogging CPU $ MONITOR PROCESS/TOPCPU * Monitor is a topic for an entire conversation. It's *VERY* powerful and can monitor down to such a fine-frained level as RMS file attributes and log all this data to a capture file. That capture file can even be replayed at a later date! Despite an insane level of functionality, I've only ever seen Monitor take 4% CPU on my uVAX-II. The VAX4000/M90 is sub 1% CPU and the Alpha/IA64 machines I've seen it's not worth i considering the overheads. * VMS can use pipes! These may appear weird to UNIX centric people but it can become quite powerful, I feel more-so than UNIX. So, to take the output from one script and pipe it to a pager I might: $ PIPE @MyChattyDCLScript.com | TYPE/PAGE SYS$INPUT * Naturally I can also turn this into a redirect via the /OUTPUT qualifier such that: $ PIPE @MyChattyDCLScript.com | TYPE/OUTPUT=fred.txt SYS$INPUT * set -x. In UNIX scripts, especially korn and bourne shell, during the development of said scripts it is common to turn on script debugging via set -x. VMS has an evem more elaborate script (and executable!) runtime verification system. The former examples of the PIPE command are particulary useful. So I can: $ SET VERIFY $ @MyDCLScript.com $!... lots of output $! And then to turn it off $ SET NOVERIFY $! See also PROCEDURE and IMAGE parameters in HELP * Backup users home directories to a tape. User home dirs exist on DKA300:[USERS], and the tape is MKA700: $! First initialize/format the tape and label the vol $ INITIALIZE MKA700: TAPE06 $! Now backup all files/versions recursively $ BACKUP/LOG DKA300:[USERS...]*.*;* MKA700:USERS.BCK - _> $ /COMMENT="USER dirs on system mirage"/LABEL=TAPE06 $! use the /IGNORE=INTERLOCK qualifier to override and backup files $! which are currently open by other processes and users. * AUTOGEN based upon modified [VMS$COMMON.SYSEXE]MODPARAMS.DAT and reboot: $ @SYS$UPDATE:AUTOGEN GETDATA REBOOT CHECK_FEEDBACK * Mount a volume that persists after logout and that it is available to the system and all users: $ MOUNT/SYSTEM DUA3: USER$DATA * MessyDOS has COPY CON and UNIX has cat > fred.txt to write text from STDIN to a file. VMS, not to be left out of the cool kids crowd can do this also: $! ^Z Will end input $ TYPE SYS$INPUT /OUTPUT=FRED.TXT * Sometimes, you get a VAX or Alpha that has been well secured by means of a forgotten SYSTEM passwd. So, we need to have what's called a "Conversational Boot", this is similar to booting a UNIX system up in single user mode. This is done by setting a flag state in the boot flag NVRAM setting. An example of a conversational boot on a VAX System, boot it and reset the SYSTEM password to "PASSW0RD": $! At Sarge on VAX: >>> SET BFLG 00000001 $! Now boot it in the usual manner. Eg: >>> BOOT DKA100: $! This will boot it to the IPL. Do the following: SYSBOOT> SET/STARTUP OPA0: SYSBOOT> SET WINDOW_SYSTEM 0 SYSBOOT> SET WRITESYSPARAMS 0 SYSBOOT> SET STARTUP_P1 "MIN" SYSBOOT> CONTINUE $! This will dump you at the OPA0: DCL prompt. Spawn a new process $ SET NOON $ DEFINE/SYSTEM/EXEC DECW$IGNORE_WORKSTATION TRUE $ SPAWN $ @SYS$SYSTEM:STARTUP $! Much beeping and when we are returned to the DCL prompt: $ RUN SYS$SYSTEM:AUTHORIZE UAF> MODIFY SYSTEM/PASSWORD=PASSW0RD UAF> EXIT $! We are now at the DCL prompt, logout and test the login. $ LO Username: SYSTEM Password: PASSW0RD $! Now reboot. Set the BFLG back to 0 $ SHUTDOWN >>> SET BFLG 00000000 >>> BOOT $! Now we probably need to autogen to set things back to normal * Daylight Savings Time (DST) annoys me. SYS$MGR there's 3 utils. One to change the timezone differential and UTC$TIMEZONE_SETUP.COM which also needs to be run. It sets/changes something. Also there is UTC$TIME_SETUP.COM in there. * Set a default welcome banner, like /etc/motd[.net],/etc/issue[.net] In SYSTARTUP_VMS.COM: $ DEFINE/SYSTEM SYS$ANNOUNCE "@SYS$MANAGER:ANNOUNCE.TXT" * Show detailed license failures to OPCON: $ DEFINE/SYS/EXEC LMF$DISPLAY_OPCOM_MESSAGE TRUE * Equiv to DOS's COPY CON and UNIX's cat > myfile.txt $ CREATE MYFILE.TXT blah blah rah rah ^Z * AUTOGEN and SYSGEN Often when I change [SYSEXE]MODPARAMS.DAT, I need to autogen, reboot and sysgen then reboot. $ SET DEF SYS$UPDATE $ @AUTOGEN GETDATA REBOOT NOFEEDBACK $! ..later after the reboot $ RUN SYS$SYSTEM:SYSGEN $! ..edit params $ SET DEF SYS$LOGIN $ REBOOT Written by Al Boyanich on a MicroVAX 4000/M300 Last updated: 7-OCT-2017 First Edit: Sometime 2003 Copyright: Yes. Already spotted this copied in a few places online without attribution including my spelling mistakes.