.c.y.h INTRODUCTION TO COMMAND PROCEDURES .w by Arthur T. McClinton Jr. MITRE Corporation December 1982 .S .c.y.h WHAT IS A COMMAND PROCEDURE? .x.w - A file containing a group of DCL commands - It may be a series of frequently executed commands - It may be a series of complicated commands - SYSTEM STARTUP/SHUTDOWN - It may be a series of commands to be executed in the batch queue. .S .c.y.h SAMPLE COMMAND PROCEDURE .x.w $! LINK AND TEST VUS AND DVS $ $SET DEF [PROD.VUS] $LINK/EXEC=DVS VUS,LOGREQ,VUS1B,ARFVUS,SDRTV,[-.TESTARF]ARFLIB/LI $LINK VUS,LOGREQ,VUS1C,ARFVUS,SDRTV,[-.TESTARF]ARFLIB/LIB $PURGE VUS.*,ARFVUS.*,DVS.* $RUN VUS DCA 80 DCA DCAFT IADSD BWIUA ... .S .c.y.h WHY USE COMMAND PROCEDURES? .x.w - To simplify the typing of frequently used commands - To correctly execute complicated code - To document the method to execute a series of commands - To simplify commands - To create user commands - As a programming language style .S .c.y.h WHEN TO USE A COMMAND PROCEDURE .x.w - Required on all jobs submitted to the batch queue $FORTRAN WEATHER $LINK WEATHER $RUN WEATHER DCA 01 1246 76 78 .S .c.y.h WHEN TO USE A COMMAND PROCEDURE .x.w - Required on all jobs submitted to the batch queue - When you expect to execute the same commands more than once. ! command file CLGO $IF P1 .EQS. "" THEN INQUIRE P1 "FILE" $FORTRAN P1 $LINK P1 $RUN P1 .S .c.y.h WHEN TO USE A COMMAND PROCEDURE .x.w - Required on all jobs submitted to the batch queue - When you expect to execute the same commands more than once. - If you need to execute at a specified time $SUBMIT/AFTER=12:30 LUNCH .S .c.y.h WHEN TO USE A COMMAND PROCEDURE .x.w - Required on all jobs submitted to the batch queue - When you expect to execute the same commands more than once. - If you need to execute at a specified time - If yo havf a ard tme tyqing .S .c.y.h HOW TO EXECUTE A COMMAND PROCEDURE .x.w - @ is the symbol to execute a command procedure $@CLGO WEATHER .S .c.y.h HOW TO EXECUTE A COMMAND PROCEDURE .x.w - @ is the symbol to execute a command procedure - SUBMIT will submit to the batch queue $SUBMIT/PARAM=("WEATHER") CLGO .S .c.y.h HOW TO EXECUTE A COMMAND PROCEDURE .x.w - @ is the symbol to execute a command procedure - SUBMIT will submit to the batch queue - LOGIN.COM is automatically executed during login SYS$LOGIN:LOGIN.COM EDTINI.EDT .S .c.y.h HOW TO EXECUTE A COMMAND PROCEDURE .x.w - @ is the symbol to execute a command procedure - SUBMIT will submit to the batch queue - LOGIN.COM is automatically executed during login - Reading a deck of cards unsolicited input from card reader is sent to batch queue .S .c.y.h HOW TO EXECUTE A COMMAND PROCEDURE .x.w - @ is the symbol to execute a command procedure - SUBMIT will submit to the batch queue - LOGIN.COM is automatically executed during login - Reading a deck of cards - SPAWN of a subprocess $SPAWN/INPUT=COMMANDS/[NO]WAIT [/OUTPUT=...] .S .c.y.h CONTROL OF INPUT/OUTPUT .x.w - SYSTEM assigned logical names SYS$INPUT - program input - defaults to current command source SYS$OUTPUT - program and command output - terminal for interactive - log file for batch SYS$ERROR - originally the same as SYS$OUTPUT SYS$COMMAND - highest level command source .S .c.y.hCONTROL OF INPUT/OUTPUT .x.w - Common problems 1.While in a command file you want input from your terminal. $ASSIGN SYS$ERROR SYS$INPUT 2.Running an interactive job and want output to the printer. $ASSIGN/USER LP: SYS$OUTPUT 3.In a subdirectory and want to submit a command file to the batch queue. remember that the command file will not be run in the same environment (both verify and directory) 4.Want to suppress output NL: is the null device .S .c.y.h USING SYMBOLS .w.x - used to pass information from one command to another - rules for forming a symbol name - first character letter, _, $ - all letters translated upper - may contain numbers - length 1-255 characters - may be a formed by evaluating a symbol $USER_'P1'=P2 .S .c.y.h USING SYMBOLS .w.x - symbol types - character or integer - type assigned by context - lexical functions to translate F$STRING - integer to string F$INTEGER - string to integer - when is 1 + 2 not equal to 3? .S .c.y.h USING SYMBOLS When is 1 + 2 not equal to 3? .w.x $ONE="1" $TWO:=2 $THREE=ONE+TWO $SHOW SYM THREE THREE = "12" $TWO=2 $THREE=ONE+TWO $SHOW SYM THREE THREE = 3 Hex... .S .c.y.h SAMPLE USING SYMBOLS .w.x $TOP: $ASSIGN/USER ZZTEMP.LIS SYS$OUTPUT $SHOW USERS $OPEN/READ TEMP ZZTEMP.LIS $READ TEMP LINE $LINE=LINE - "VAX/VMS " - " - Total"- $_ + " " + F$TIME() $WRITE SYS$OUTPUT LINE $CLOSE TEMP $DELETE ZZTEMP.LIS.* $WAIT 0:01:00 $GOTO TOP Interactive Users = 1 11-NOV-1982 20:17: .S .C.Y.H.$(0 SYMBOLS TABLES .W.X lqqqqqqqqqqqqqqqqqqqqqk x GLOBAL SYMBOLS 5 x x x tqqqqqqqqqqqqqqqqqqqqqu x LEVEL 1 SYMBOLS 4 x tqqqqqqqqqqqqqqqqqqqqqu x LEVEL 2 SYMBOLS 3 x tqqqqqqqqqqqqqqqqqqqqqu x LEVEL 3 SYMBOLS 2 x tqqqqqqqqqqqqqqqqqqqqqu x LEVEL 4 SYMBOLS 1 x