Language Summary

In this section:

 

This topic summarizes all Maintain language commands, grouping them by their primary use (such as transferring control or selecting records). Each command and system variable is described in detail later in this chapter.


Top of page

x
Defining a Procedure

The basic syntax consists of the commands that start and terminate a Maintain procedure. The commands are:

MAINTAIN

Initiates the parsing and execution of a Maintain procedure. It is always the first line of the procedure.

END

Terminates the execution of a Maintain procedure.


Top of page

x
Defining a Maintain Function (a Case)

The following command defines Maintain functions:

CASE

Defines a Maintain function. Maintain functions are also known as cases.


Top of page

x
Defining Blocks of Code

The following command defines a block a code:

BEGIN

Defines a group of commands as a single block and enables you to issue them as a group. You can place a BEGIN block anywhere individual commands can appear.


Top of page

x
Transferring Control

You can transfer control to another function within the current procedure, as well as to another procedure.

The commands that transfer control are:

PERFORM

Transfers control to another function. When the function finishes, control is returned to the command following PERFORM. You can also call a function directly, without PERFORM.

GOTO

Transfers control to another function or to a special label within the current function. When the function finishes, control does not return. You can also call a function directly, without GOTO.

CALL

Executes another Maintain procedure.

EXEC

Executes an external (non-Maintain) procedure.


Top of page

x
Executing Procedures

The following commands run procedures, or prepare them for execution:

CALL

Executes a Maintain procedure, and enables you to pass data from the calling procedure.

EXEC

Executes a WebFOCUS procedure.

MNTCON COMPILE

Compiles a Maintain procedure to increase its execution speed. This command is outside the Maintain language, but is described in this chapter for your convenience.

MNTCON EX

Executes an uncompiled Maintain procedure. This command is outside the Maintain language, but is described in this chapter for your convenience.

MNTCON RUN

Executes a compiled Maintain procedure. This command is outside the Maintain language, but is described in this chapter for your convenience.


Top of page

x
Encrypting Files

You can use the following commands to prevent unauthorized users from viewing the content of procedure files and Master Files.

ENCRYPT

Encodes procedure files and Master Files to prevent unauthorized users from viewing their content. This command is outside the Maintain language, but is described in this chapter for your convenience.

DECRYPT

Decodes files that have been encoded using the ENCRYPT command. This command is outside the Maintain language, but is described in this chapter for your convenience.


Top of page

x
Using Loops

The following command supports looping:

REPEAT

Enables a circular flow of control.


Top of page

x
Using Forms

The following command is responsible for presentation logic:

Winform

Displays a form by which end users can read, enter, and edit data, and manipulate control properties.


Top of page

x
Defining Classes

The following command enables you to define classes:

DESCRIBE

Defines classes and data type synonyms.


Top of page

x
Creating Variables

The following commands enable you to create variables:

DECLARE

Creates local and global variables, including objects.

COMPUTE

Creates global variables, including global objects. It can also assign values to existing variables.


Top of page

x
Assigning Values

Maintain enables you to assign values to existing variables using the following command:

COMPUTE

Assigns values to existing variables.


Top of page

x
Manipulating Stacks

Maintain provides several stack commands to manage the contents of stacks. Unless otherwise specified, each command operates on all rows in the stack. The following example copies the contents of the Indata stack to the Outdata stack:

FOR ALL COPY FROM Indata INTO Outdata;

One row or a range of rows may be specified to limit which rows are affected. As an example

FOR 100 COPY FROM Indata(4) INTO Outdata;

copies 100 records of the Indata stack, starting from the fourth record, and places them into the stack Outdata.

The stack commands are:

COPY

Copies data from one stack to another.

STACK SORT

Sorts data in a stack.

STACK CLEAR

Initializes a stack.

INFER

Defines the columns in a stack.

In addition, there are two variables associated with a stack which can be used to manipulate individual rows or groups of rows in the stack. The stack variables are:

FocCount

Is the number of rows in the stack.

FocIndex

Is a pointer to the current instance in the stack.


Top of page

x
Selecting and Reading Records

The record selection commands retrieve data from the data source and change position in the data source.

The commands are:

NEXT

Starts at the current position and moves forward through the data source. NEXT can retrieve data from one or more rows.

MATCH

Searches the entire segment for a matching field value. It retrieves an exact match in the data source.

REPOSITION

Changes the data source position to be at the beginning of the chain.

In addition, there is a system variable that provides a return code for NEXT and MATCH:

FocFetch

Signals the success or failure of a NEXT or MATCH command.

You can use the following commands to directly interface with a DBMS:

SYS_MGR.PRE_MATCH

Turns off preliminary database operation checking before an update.

SYS_MGR.GET_PRE_MATCH

Determines whether prematch checking is on or off.

SYS_MGR.ENGINE

Passes SQL commands directly to a DBMS.

SYS_MGR.DBMS_ERRORCODE

Retrieves a DBMS return code after an operation.


Top of page

x
Conditional Actions

The conditional commands are:

IF

Issues a command depending on how an expression is evaluated.

ON MATCH

Determines the action to take when the prior MATCH command succeeds.

ON NOMATCH

Defines the action to take if the prior MATCH fails.

ON NEXT

Defines the action to take if the prior NEXT command succeeds.

ON NONEXT

Defines the action to take if the prior NEXT command fails.


Top of page

x
Writing Transactions

The commands that can be used to control transactions are:

INCLUDE

Adds one or more new data source records.

UPDATE

Updates the specified data source fields or columns. Can update one or more records at a time.

REVISE

Adds new records to the data source and updates existing records.

DELETE

Deletes one or more records from the data source.

COMMIT

Makes all data source changes since the last COMMIT permanent.

ROLLBACK

Cancels all data source changes made since the last COMMIT.

There are several system variables that you can use to determine the success or failure of a data source operation or an entire logical transaction:

FocCurrent

Signals the success or failure of a COMMIT or ROLLBACK command.

FocError

Signals the success or failure of an INCLUDE, UPDATE, REVISE, or DELETE command.

FocErrorRow

If an INCLUDE, UPDATE, REVISE, or DELETE command that writes from a stack fails, this returns the number of the row that caused the error.

You can use the following commands to directly interface with a DBMS:

SYS_MGR.PRE_MATCH

Turns off preliminary database operation checking before an update.

SYS_MGR.GET_PRE_MATCH

Determines whether prematch checking is on or off.

SYS_MGR.ENGINE

Passes SQL commands directly to a DBMS.

SYS_MGR.DBMS_ERRORCODE

Retrieves a DBMS return code after an operation.


Top of page

x
Setting WebFOCUS Server Parameters

You can communicate with the WebFOCUS Server using the following commands:

SET

Sets WebFOCUS Server parameters. This command is outside the Maintain language, but is described in this chapter for your convenience.

SYS_MGR.FOCSET

Sets WebFOCUS Server parameters (without having to set them in EDASPROF).


Top of page

x
Configuring a Shared Application Server

You can dramatically increase the speed of your applications if you set them up on a Shared Application Server. For more information on this technique, see the Developing WebFOCUS Maintain Applications manual.

The following commands set up your application to run under a Shared Application Server:

MNTCON COMPILE

Compiles a procedure to increase its execution speed. This command is outside the Maintain language, but is described in this chapter for your convenience.

MNTCON LOADIMAGE

Loads all of the Maintain procedures in a WebFOCUS Maintain application prior to running the application on a Shared Application Server. This command is outside the Maintain language, but is described in this chapter for your convenience.

MNTCON RUNIMAGE

Runs a Maintain procedure on a Shared Application Server. This command is outside the Maintain language, but is described in this chapter for your convenience.


Top of page

x
Using Libraries of Classes and Functions

You can import libraries using the following command:

MODULE

Imports a library of shared class definitions or functions into a Maintain procedure.


Top of page

x
Messages and Logs

You can write messages to files, consoles, and forms using the following commands:

SAY

Writes messages to a file or to the default output device.

TYPE

Writes messages to a file or a form.

In addition, there is a system stack that is automatically populated with messages posted to the default output device by Maintain procedures (except for the starting procedure) and external procedures:

FocMsg

Contains messages posted by Maintain and WebFOCUS procedures.


WebFOCUS