beautypg.com

2 creating a noninteractive application, Example 2–1 dcl command procedure filename.com, Example 2–2 dcl command procedure fortran_ts.com – Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual

Page 24

background image

Getting Started with DECTPU
2.2 Invoking DECTPU from a DCL Command Procedure

Example 2–1 shows a DCL command procedure that ‘‘remembers’’ the last file
that you were editing and uses it as the input file for DECTPU. When you edit a
file, the file name you specify is saved in the DCL symbol last_file_edited. If you
do not specify a file name when you invoke the editor the next time, the file name
from the previous session is used.

Example 2–1 DCL Command Procedure FILENAME.COM

$ IF P1 .NES. "" THEN last_file_edited == P1
$ WRITE SYS$OUTPUT "*** ’’last_file_edited’ ***"
$ DEFINE/USER SYS$INPUT SYS$COMMAND
$ EDIT/TPU/COMMAND=DISK$:[USER]TPU$COMMAND.TPU ’last_file_edited’

Example 2–2 establishes an environment that specifies tab stop settings for
FORTRAN programs.

Example 2–2 DCL Command Procedure FORTRAN_TS.COM

$ IF P1 .EQS. "" THEN GOTO REGULAR_INVOKE
$ last_file_edited == P1
$ FTN_TEST = F$FILE_ATTRIBUTES (last_file_edited,"RAT")
$ IF FTN_TEST .NES. "FTN" THEN GOTO REGULAR_INVOKE
$ FTN_INVOKE:
$

DEFINE/USER SYS$INPUT SYS$COMMAND

$

EDIT/TPU/COMMAND=FTNTABS ’last_file_edited’

$ GOTO TPU_DONE
$ REGULAR_INVOKE:
$

DEFINE/USER SYS$INPUT SYS$COMMAND

$

EDIT/TPU/ ’last_file_edited’

$ TPU_DONE:

2.2.2 Creating a Noninteractive Application

In some situations, you may want to put all of your editing commands in a
file and have them read from the file rather than entering the commands
interactively. You may also want DECTPU to perform the edits without
displaying them on the screen. You can do this type of editing from a batch
job; or, if you want to see the results of the editing session displayed on your
screen, you can do this type of editing from a DCL command procedure. Even
though the edits are not displayed on your screen as they are being made, your
terminal is not free while the command procedure is executing.

Example 2–3 shows a DCL command procedure named INVISIBLE_TPU.COM,
which contains a single command line that uses the following qualifiers to invoke
DECTPU:

/NOSECTION—This qualifier prevents DECTPU from using a section file. All
procedures and key definitions must be specified in a command file.

/COMMAND=gsr.tpu—This qualifier specifies a command file that contains
the code to be executed (GSR.TPU).

/NODISPLAY—This qualifier suppresses screen display.

2–4 Getting Started with DECTPU