This topic summarizes all Maintain Data 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.
The basic syntax consists of the commands that start and terminate a Maintain Data procedure. The commands are:
Initiates the parsing and execution of a Maintain Data procedure. It is always the first line of the procedure.
Terminates the execution of a Maintain Data procedure.
The following command defines Maintain Data functions:
Defines a Maintain Data function. Maintain Data functions are also known as cases.
The following command defines a block a code:
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.
You can transfer control to another function within the current procedure, as well as to another procedure.
The commands that transfer control are:
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.
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.
Executes another Maintain Data procedure.
Executes an external (non-Maintain Data) procedure.
The following commands run procedures, or prepare them for execution:
Executes a Maintain Data procedure, and enables you to pass data from the calling procedure.
Executes an App Studio procedure.
The following command supports looping:
Enables a circular flow of control.
The following command is responsible for presentation logic:
Displays a form by which end users can read, enter, and edit data.
The following command enables you to define classes:
Defines classes and data type synonyms.
The following commands enable you to create variables:
Creates local and global variables, including objects.
Creates global variables, including global objects. It can also assign values to existing variables.
Maintain Data enables you to assign values to existing variables using the following command:
Assigns values to existing variables.
Maintain Data 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. For example, the following copies 100 records of the Indata stack, starting from the fourth record, and places them into the Outdata stack.
FOR 100 COPY FROM Indata(4) INTO Outdata;
The stack commands are:
Copies data from one stack to another.
Sorts data in a stack.
Initializes a stack.
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:
Is the number of rows in the stack.
Is a pointer to the current instance in the stack.
The record selection commands retrieve data from the data source and change position in the data source.
The commands are:
Starts at the current position and moves forward through the data source. NEXT can retrieve data from one or more rows.
Searches the entire segment for a matching field value. It retrieves an exact match in the data source.
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:
Signals the success or failure of a NEXT or MATCH command.
You can use the following commands to directly interface with a DBMS:
Turns off preliminary database operation checking before an update.
Determines whether prematch checking is on or off.
Passes SQL commands directly to a DBMS.
Retrieves a DBMS return code after an operation.
The conditional commands are:
Issues a command depending on how an expression is evaluated.
Determines the action to take when the prior MATCH command succeeds.
Defines the action to take if the prior MATCH fails.
Defines the action to take if the prior NEXT command succeeds.
Defines the action to take if the prior NEXT command fails.
The commands that can be used to control transactions are:
Adds one or more new data source records.
Updates the specified data source fields or columns. Can update one or more records at a time.
Adds new records to the data source and updates existing records.
Deletes one or more records from the data source.
Makes all data source changes since the last COMMIT permanent.
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:
Signals the success or failure of a COMMIT or ROLLBACK command.
Signals the success or failure of an INCLUDE, UPDATE, REVISE, or DELETE command.
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:
Turns off preliminary database operation checking before an update.
Determines whether prematch checking is on or off.
Passes SQL commands directly to a DBMS.
Retrieves a DBMS return code after an operation.
You can communicate with the Reporting Server using the following commands:
Sets Reporting Server parameters. This command is outside the Maintain Data language, but is described in this chapter for your convenience.
Sets Reporting Server parameters, without having to set them in EDASPROF.
You can import libraries using the following command:
Imports a library of shared class definitions or functions into a Maintain Data procedure.
You can write messages to files, consoles, and forms using the following commands:
Writes messages to a file or to the default output device.
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 Data procedures, except for the starting procedure and external procedures:
Contains messages posted by Maintain Data and App Studio procedures.