Example 1
Use an indirect command file to execute a frequently used query:
$ TY EMPADDR.RDO
!
! This command file generates information for a mailing list.
!
INVOKE DATABASE FILENAME 'DISK2:[DEPT32]MF_PERSONNEL.RDB'
SET OUTPUT 'DISK2:[DEPT32]MAILLIST.DOC'
FOR E IN EMPLOYEES
PRINT E.FIRST_NAME, E.MIDDLE_INITIAL, E.LAST_NAME,
E.ADDRESS_DATA_1, E.ADDRESS_DATA_2, E.CITY, E.STATE, E.POSTAL_CODE
END_FOR
$ RDO:== $RDO
$ RDO
RDO> @EMPADDR
Example 2
You can use a logical name to run a command file:
$ SET DEFAULT DISK1:[FORESTER]
$ DEFINE COUNT "DISK2:[DEPT3]COUNT.RDO"
$ TYPE DISK2:[DEPT3]COUNT.RDO
!
! This command file counts the records in
! each relation in the MF_PERSONNEL database.
!
SET NOVERIFY
SET OUTPUT COUNT.LOG
INVOKE DATABASE FILENAME 'DISK2:[DEPT3]MF_PERSONNEL.RDB'
PRINT " "
PRINT "Statistics for the MF_PERSONNEL database follow: "
PRINT " "
PRINT "Count of Employees -------> ", COUNT OF X IN EMPLOYEES
PRINT "Count of Jobs ------------> ", COUNT OF J IN JOBS
PRINT "Count of Degrees ---------> ", COUNT OF D IN DEGREES
PRINT "Count of Salary_History --> ", COUNT OF SH IN SALARY_HISTORY
PRINT "Count of Job_History -----> ", COUNT OF JH IN JOB_HISTORY
PRINT "Count of Work_Status -----> ", COUNT OF W IN WORK_STATUS
PRINT "Count of Departments -----> ", COUNT OF D IN DEPARTMENTS
PRINT "Count of Colleges --------> ", COUNT OF C IN COLLEGES
PRINT "Count of Resumes ---------> ", COUNT OF R IN RESUMES
PRINT " "
PRINT "Statistics Complete for Database - written to COUNT.LOG"
PRINT " "
PRINT " "
$ !
$ RDO:== $RDO
$ RDO
RDO> @COUNT
Statistics for the PERSONNEL database follow:
Count of Employees -------> 100
Count of Jobs ------------> 15
Count of Degrees ---------> 166
Count of Salary_History --> 729
Count of Job_History -----> 274
Count of Work_Status -----> 3
Count of Departments -----> 26
Count of Colleges --------> 16
Count of Resumes ---------> 0
Statistics Complete for Database - written to COUNT.LOG
RDO>
Notice that the default OpenVMS directory is not the same as the
directory containing the command file. You define the process
logical name to point to the correct command file. Then you use
the logical name as the object of the @ command.