Define SF

PURPOSE:  A System File (SF) may be created externally or within ACCENT R by using the DEFINE SF command, which invokes the edit level where the lines that make up the SF are entered.

A SF can contain any line that could be entered at the terminal, including data, commands, editing commands or comments.

Once they are defined and saved, SF’s can later be modified with the MODIFY SF command, which also invokes the edit level.

SYNTAX

DEFINE SF name [ENTER /IN DBL/]

name

assigns a name to the SF established with this command.  The default file name extension is CMD.

[ENTER /IN DBL/]

specifies that the name of the SF to be stored in the Date Base Library (DBL) for documentation purposes.

EXAMPLE

*DEFINE SF TRAIL
--10  ENABLE CPU TRACE
--20  ENABLE CM TRACE
--30  DISABLE ERROR ABORT
--40  SET 1000 TO @TERM_LINE
--50  DISABLE SF INPUT
--60  TYPE ‘ENTER CURRENT REPORT DATE: ;NOCR
--70  ACCEPT @VDATE(1)
--80  ENABLE SF INPUT
--90  USE DS BANK
--100 REPORT VIA MONEY
--SAVE

NOTES:  If an SF by the specified name already exists, ACCENT R displays an error message and aborts the command.

The CREATE SF command, described earlier in this chapter, establishes or attaches an SF, but does not call up the edit level for text entry.  From the ACCENT R frame of reference, every file that resides on disk is a SF.

System Files for Command Control

ACCENT R provides the ability to accept command from a text file.  It will also accept data intermingled with the command text.

ACCENT R identifies these files simply as System Files (SF).  SF’s can contain any ACCENT R command.  If the command STORE is used in a SF, it must include the option NEXT.  Several commonly used commands could be stored in a SF with the STORE NEXT AS name command.  After declaring the SF, any of the commands could be invoked with the INVOKE name command.

The TYPE SET and ACCEPT commands are permitted with conditional clauses.  System fields, declared Global Storage (GS) fields, literals, constants, functions, and expressions can be included in the TYPE ACCEPT or SET commands.

A SF cannot contain the control statements IF; UNLESS, START, LEAVE, or REPEAT.

Data Set (DS) fields, GS fields, and system fields can be referenced where the syntax of the command permits.

SF’s are not compiled when they are saved.  The only way to check a command file for logical or semantic errors is to execute it.  A given SF can contain data as well as commands.

SF’s can call other SF’s, that which can in turn call other SF’s up to ten levels.  When a SF calls another SF control immediately passes to the next level SF.  When the next level SF runs to completion, it then returns control to the line following that, which called it in the first SF.  However, a USE NO SF command in any SF breaks out of all SF’s and returns control immediately to the interactive command level or the calling CM.

Within a SF, the USE DBL command causes the current DBL to close, and all further lines in the System File must operate only in the DBL declared by the USE command.  A later USE DBL command could return processing to the first DBL, or could pass to a third DBL.

The command TERMINAL can be included in an SF to allow a command to be entered interactively during SF execution.  There is no limit to the number of TERMINAL commands that can be included in an SF and they can follow one another.  The SF cannot control the execution of the line entered.  If terminal input is erroneous, ACCENT R does not permit reentry, but continues processing with the next SF line.

When a System File is executed, any lines that ACCENT R would normally display on the terminal are displayed, but the lines of the System File are not themselves displayed unless ENABLE SF TRACE is in effect.

EXAMPLE

The following example shows a System File (SF) that declares a Data Set (DS), then counts the records in it.  The SF is invoked with TRACE disabled (the default), then with TRACE enabled.

*LIST SF CHCK
00100  USE DS SALES_DBM2
00110  COUNT
*USE SF CHCK
21 RECORDS
*ENABLE SF TRACE
*USE SF CHCK
<<SF  00100 USE DS SALES_DBM2
<<SF  00110 COUNT
21 RECORDS

NOTES:  When an SF is executing, ACCENT R displays any error or warning message that would have occurred if the command had been entered interactively.  The SF aborts if an error occurs in a command.  Control is returned to the terminal.  The command DISABLE ERROR ABORT can be used to force continued execution regardless of command errors.

SEE ALSO:  STORE, INVOKE, TERMINAL, ENABLE/DISABLE SF INPUT