INFER

In this section:

How to:

Reference:

Stacks are array variables containing rows and columns. When defining a stack and its structure, provide a name for the stack and a name, format, and order for each of the columns in the stack.

Stacks can be defined in two ways:


Top of page

x
Syntax: How to Use the INFER Command

The syntax of the INFER command is

INFER path_spec INTO stackname [;]

where:

path_spec

Identifies the path to be defined for the data source. To identify a path, specify its anchor and target segments. If the path contains only one segment, the anchor and target are identical. Simply specify the segment once. (For paths with multiple segments, if you wish to make the code clearer to readers, you can also specify segments between the anchor and target.)

To specify a segment, provide the name of the segment or of a field within the segment.

stackname

Is the name of the stack that you wish to define.

;

Terminates the command. Although the semicolon is optional, you should include it to allow for flexible syntax and better processing. For more information about the benefits of including the semicolon, see Terminating Command Syntax.



Example: Inferring Two Stacks

In the following called procedure, two INFER commands define the EmpClasses and ClassCredits stacks:

MAINTAIN FROM EmpClasses INTO ClassCredits
INFER Emp_ID Ed_Hrs Date_Attend Course_Code INTO EmpClasses;
INFER Emp_ID Course_Code Grade Credits INTO ClassCredits;
.
.
.
END

Top of page

x
Reference: Commands Related to INFER

Top of page

x
Defining Non-Data Source Columns

To define stack columns in a procedure for non-data source fields (fields created with the COMPUTE command), you do not need to provide a value for the column. The syntax is:

COMPUTE stackname.target_variable/format = ;

Note that the equal sign is optional when the COMPUTE is issued solely to establish format.

In the following example, the stack column TempEmp was passed to the called procedure. The COMPUTE is issued in the called procedure to define the variable prior to use:

COMPUTE EmpClasses.TempEmp_ID/A9 ;

WebFOCUS