LOCATE

Locates a particular member of a result set and makes it the current member.

Syntax

LOCATE [num] [set] [WHERE clause]

Parameters

numThe number of records to be located. Num can be
an integer constant (e.g., 15, 200);
a variable, form field, menu item, or formal parameter that evaluates to an integer;
the word ALL.
The default value for num is 1.
setThe name of a result set. If not specified, the current set (if it exists) is used.

Comments

LOCATE starts searching at the current member of the set. The last member located becomes the current member of set. The system variable $Located is set to the number of members located, indicating the number of members in the result set.

The WHERE clause can be used to logically limit the members located.

Example

find all employees where location=”Detroit” -> DetroitSet

locate DetroitSet where FirstName=”John” and LastName=”Smith”

locate 2 DetroitSet where FirstName=”John” and LastName=”Smith”

Because LOCATE starts with the current member of any set it searches, the current member after the last LOCATE command is the third record containing the name John Smith.

find all Employees where LastName=”Smith” -> Smiths

locate all where FirstName=”John”

output $located

compute all Employees where LastName=”Smith” and FirstName=”John” valuate (“”)

output $membercount

find all Employees where LastName=”Smith” and FirstName=”John”

output $setcount

All three of the preceding examples determine how many employees have the name John Smith.

while

locate DetroitSet where LastName=”Smith” and FirstName=”John”

if $located = 0

  return    % checks if done

endif

ProcessEmp ( )  % program to process this John Smith

endwhile

Each John Smith record in the designated set is processed.

See Also

BOTTOM

DOWN

NEXT

PREVIOUS

TOP

UP

RETURN

Ends execution of an application program and returns to the “previous” command level.

Syntax

RETURN [TO procedure]

Parameters

procedureThe name of a procedure. Must be an ancestor (i.e., the “parent”, “grandparent”, “great-grandparent”, etc.) of the current procedure.

Comments

The RETURN command stops execution of the current procedure.

If a TO clause is omitted, execution control returns to the calling procedure (the “parent”) at the command immediately following the call that started execution of the current procedure.

If a TO clause is used, execution control returns to the specified procedure, provided that it is found along the chain of procedures that are “ancestors” of the current procedure. Execution resumes at the command immediately following the call that started execution of the offspring procedure in the current chain. If the specified procedure is not found along the chain of ancestors, execution control returns to the main prompt level.

If the RETURN command is entered at the main prompt level, the application session is ended (just as if a BYE command had been issued).

Example

To return control from the current procedure to the calling procedure when a FIND command returns an empty result set, enter

find all Employees where Salary > 10000

if $setcount = 0

 return

endif

To return to a grandparent procedure if a FIND command returns an empty result set, enter

01 procedure Grandparent ( )

02  Parent ( )        % goes to line 20

   … more commands …

18 endprocedure

19 %————————————————-

20 procedure Parent ( )

21  Child ( )        % goes to line 35

   … more commands …

33 endprocedure

34 %————————————————-

35 procedure Child ( )

36  find all Employees where Salary > 10000

37  if $setcount = 0

38    return to Grandparent  % goes to line 03

39  endif

   … more commands …

50 endprocedure

 

See Also

BYE

SET FLOW

STOP

TRANSACTION

TRANSFORM

AND

Performs a Boolean AND of two logic expressions.

Syntax

expression1 AND expression2

Parameters

expression1A logical expression using conditional and Boolean operators. If the expression is complex, it must be enclosed in parentheses.
expression2A logical expression using conditional and Boolean operators. If the expression is complex, it must be enclosed in parentheses.

Return Value

Logical, as follows:

Truth Table for Boolean ANDExpression1
TrueFalse
Expression2TrueTrueFalse
FalseFalseFalse

Comments

This AND is not the same as the AND used with the BETWEEN operator.

Example

ClaimType = ‘Auto’ and DamageCost > 3000 and LastName= ‘Andretti’

This Boolean expression is logically true only when the insurance claim type is Auto, the cost of the damage is greater than 3,000, and the last name of the person making the claim is Andretti. Otherwise, the Boolean expression is logically false.

See Also

[NOT] BETWEEN

NOT

XOR

OR

IN

DETAIL LINE

Specifies the fields that are selected for a report

Syntax

DETAIL LINE [colheadings] [GRAPHIC [TEMPLATE name]] reportitem [:format:] [WHERE clause]

Parameters

colheadingsCan be
COLUMN HEADING OFF
Specifies that column break headings are not to be re-displayed at the top of each report page.
LEVEL n [WIDTH n ]
LEVEL 0 causes level 0 column break headings to be printed at the top of each report page. This is the default break level.
LEVEL n causes column break headings to be printed for each break level n or higher in the hierarchy (n must be an integer greater than or equal to 0).
WIDTH n sets the width (in characters) of the space allotted to the column break heading.
TEMPLATE nameFor graphical reports, the name of an optional template to define the layout of the report.
reportitemAny value expression. If the expression is complex, it must be enclosed in parentheses.
formatA set of instructions defining the format for the associated reportitem. Format is enclosed in : (colons) and can consist of any valid combination of format options.

Comments

The DETAIL LINE command is executed for every record of the set specified in the REPORT FROM command.

The column headings for all reportitems specified in the DETAIL LINE command are displayed, subject to any colheadings specification.

Only one detail line is produced for each record of the report set. If more than one DETAIL LINE command is used in a report specification, the DETAIL LINE command that is executed for a particular record in the report set is the first DETAIL LINE without a WHERE clause, or the first DETAIL LINE whose WHERE clause is true for that record.

For more information on format, see Available Format Options.

See Also

Boolean Expressions

Conditional Expressions

BREAK (Reports)

COLUMN BREAK

How to Use The Report Generator

How To Use Value Expressions

HELP

Presents online help information.

Syntax

HELP [topic]

Parameters

For files that invoke the winhelp executable

topicA character string or a number, or an expression that evaluates to a character string or a number. Identifies a particular help topic in the help file.
If topic is a character string, the HELP command accesses the help file with topic as a keyword. If topic contains the pattern-matching wildcard character “%”, HELP uses the prefix of topic, up to the first “%” as the keyword. A partial key match is done, and matching keywords are displayed in a search window.
If topic is a number, it is assumed to represent a “context ID”. HELP accesses the help file using topic as the “context ID”.
If the keyword or “context ID” provided by topic is invalid, a warning message is displayed, followed by the help topic search window.
If topic is blank or $Null, HELP shows the first topic in the help file.

Note: For Explorer-style hypertext Help files, topic is a character string or a number, or an expression that evaluates to a character string or a number which identifies a particular help topic in the help file. It invokes the name of one of the .html files that were used to build the . chm file.

Comments

The HELP command displays online help about a given topic. By default, the command accesses the help file, ZDL.CHM, in the directory containing the software. To use another help file, set the system variable $ HelpFile to the name of the desired help file.

In the Windows environment, the HELP command determines, based on the extension of the help file, whether to invoke the Internet Explorer’s hypertext help viewer ( hh.exe) or to invoke the Windows help driver ( winhelp.exe) to display the help topics.

Winhelp help files

If the help topic is specified as a character string, the HELP command passes the string to the help driver as a keyword. If an exact match is not found, the help driver displays a warning message, following the topic search window.

If the character string contains the pattern-matching wildcard character $, HELP passes the string to the help driver, up to the first $ character, as a keyword prefix. Keywords that match the prefix are displayed in a topic search window for selection.

If the help topic is specified as a number (any numeric data type), HELP passes the number to the help driver as a topic identifier. If the identifier is invalid, the help driver displays a warning message, followed by the topic search window.

If no help file can be found, the software raises an error.

Hypertext help files

The hypertext help viewer accepts only strings as topic names and they must match the html files that were used to build the . chm file.

See Also

$HelpFile

PROCEDURE

Starts and defines a procedure.

Syntax

PROCEDURE procname ([IN|OUT|INOUT] parm) [LOCAL (var)]

Parameters

procname

A valid object name. Procname must be the name of the existing application document that contains this procedure and must not conflict with a system keyword.

IN, OUT, or INOUT

Designates the direction in which the associated parm passes a value: Into the procedure (IN), out of the procedure (OUT), or both (INOUT).
If omitted, IN is assumed.

parm

The name of a parameter (a type of variable used only to carry values into and out of procedures). When more than one parameter is specified, they are separated from one another by commas.
If no parameters are defined, the enclosing parentheses must still appear.
A corresponding expression for each parameter is provided in the call to the procedure.

var

The name of the local variable whose use is restricted to within the local procedure. Local variables must be separated from one another by commas.

Comments

PROCEDURE declares the start of a procedure program. (A procedure program can have many local procedures, but only one main procedure.)

The call to the procedure must contain a corresponding expression for each parameter. The order of the expressions in the call must match the order of the parameters in the procedure declaration. If the number of expressions in the call differs from the number of declared parameters, then the call is ignored. Within the procedure, formal parameters are treated as if they were variables.

A PROCEDURE command must always have a corresponding ENDPROCEDURE command that marks the end of the procedure.

The number of formal parameters, plus the number of local variables, must not exceed the maximum parameters entry in the configuration file. The parameter size entry in the configuration file determines the maximum size of each formal parameter and local variable.

Example

procedure MyProc (item1, in item2, out item3, inout item 4)

Item1 and item2 are formal IN parameters, item3 is a formal OUT parameter, and item4 is a formal INOUT parameter.

procedure Summarize (DeptName, out AvgSalary) local (WorkVar)

WorkVar is a local variable (known only to procedure Summarize).

 

See Also

LOCALPROCEDURE

LOCALPROCEDURE

Defines and marks the start of a local procedure within an application program.

Syntax

LOCALPROCEDURE procname> ([IN|OUT|INOUT] parm)[LOCAL(var)]

Parameters

procname

 

A valid object name. The name of the local procedure cannot conflict with a software keyword. When a local procedure name conflicts with a pre-defined object name, the local procedure name takes precedence, provided the software is currently operating within the program that contains the local procedure.

 

IN, OUT, or INOUT

 

Designates the direction in which the associated parm passes a value: into the procedure (IN), out of the procedure (OUT), or both (INOUT).
If omitted, IN is assumed.

 

parm

 

The name of a parameter (a type of variable used only to carry values into and out of procedures). When more than one parameter is specified, they are separated from one another by commas.
If no parameters are defined, the enclosing parentheses must still appear.
A corresponding expression for each parameter is provided in the call to the local procedure.

 

var

 

The name of the local variable whose use is restricted to within the local procedure. Local variables must be separated from one another by commas.

 

Comments

The body of a local procedure is a sequence of commands. A LOCALPROCEDURE must always end with a corresponding ENDPROCEDURE command.

Local procedure declarations must appear at the beginning of their application program document, before the main procedure or before the commands of a macro program. A local procedure cannot be nested within the body of another procedure or local procedure. Local procedures obey all the same call/return rules as standard procedures, and possess the same capabilities as a standard procedure.

A local procedure can call other procedures in the same application program document or in other program documents. However, a local procedure can be called only by other procedures defined in the same program document.

Example

localprocedure LocalProc1 ()

 transform LocalProc2 ()

endprocedure

%——————————————-

localprocedure LocalProc2 ()

 output “Hi from LocalProc2”

endprocedure

%——————————————-

procedure MainProc (Param1, Param2)

  LocalProc1 ()

  LocalProc2 ()

endprocedure

The main procedure calls two local procedures. The first local procedure transfers control to the second through a TRANSFORM command.

 

See Also

ENDPROCEDURE

PROCEDURE

COLUMN BREAK

Breaks the body of column-oriented reports into summary groups.

Syntax

COLUMN BREAK level [HEADING reportitem [:format:]]

[FOOTING reportitem [:format:]]

Parameters

levelThe break level number (an integer greater than or equal to zero).
In the hierarchy of breaks, the higher the level number, the more minor the break. (For example, a level 1 break also triggers breaks at level 2, level 3, and so on.)
HEADINGIntroduces the “heading clause” for the break level, which can consist of a break orientation statement, a number of report items and their format instructions, or both. The footing displays each time the break level is triggered.
FOOTINGIntroduces the “footing clause” for the break level, which can consist of a break orientation statement, a number of report items and their format instructions, or both. The heading displays each time the break level is triggered.
reportitemAny valid expression that yields a value for display in the break heading or break footing. The heading and footing can each display a series of reportitems. Each item has its own associated format.
formatA set of instructions defining the format for the associated reportitem. Format is enclosed in : (colons) and can consist of any valid combination of format options.

Comments

The COLUMN BREAK command breaks the body of a column-oriented report into summary groupings.

Each time a BREAK command triggers a break at a specified level, the COLUMN BREAK for that level and all levels lower in the hierarchy are triggered.

Report items in the COLUMN BREAK heading can include individual values from the first member of the current group. Report items in the COLUMN BREAK footing can include individual values only from the last member of the current group. However, summary data computed over all members of the group can be displayed in the footing. Use aggregate functions.

If both the heading and footing clauses are omitted, a column break at the indicated level causes report formatting to recommence at the left-hand side of the page, beneath any previously formatted columns.

See Also

DETAIL LINE

ENDREPORT

REPORT FOOTING

REPORT FROM

REPORT HEADING

CASE

Enables conditional execution of commands.

Syntax

CASE

WHEN expression

commands1

[OTHERWISE

commands2]

ENDCASE

Parameters

expressionA logical expression (using conditional or Boolean operators).
commands1Commands that are executed if expression is logically true.
commands2Commands that are executed if expression is logically false.

Comments

A CASE command must always have a corresponding ENDCASE. Any number of WHEN clauses can appear between CASE and ENDCASE.

The WHEN phrases between CASE and ENDCASE are evaluated in order. Execution control transfers to the commands associated with the first WHEN clause whose expression is determined to be logically true. If none of the WHEN phrases contain an expression that evaluates to “true”, the commands associated with OTHERWISE (if used) are executed. Execution then resumes at the first command following ENDCASE.

If a WHEN expression includes fields from the current set, then the expression uses the values found in the current member of the current set.

If a BYE, RETURN, STOP, or TRANSFORM command exits a procedure in the middle of a CASE structure, the “open” CASE command is automatically closed. Also, if the end of the current procedure is reached before a necessary ENDCASE is encountered, the “open” CASE command is closed.

If the ENDCASE is missing, all subsequent commands in the current procedure are treated as part of the CASE structure.

Example

If the value for salary is neither less than 20,000, nor between 20,00 and 30,000, the first and second set of commands are skipped, and the third set of commands executed.

case

when salary < 20000

… first set of commands …

when Salary between 20000 and 20000

… second set of commands …

otherwise

… third set of commands …

endcase

The following program fragment illustrates how WHEN conditions in a CASE command can handle an application user’s choice of accelerator keys in an application. Depending on the key pressed by the application user, a particular procedure is executed.

form display input

case

when Event.EventName = “F3”

return

when Event.EventName = “F1”

AddNewRecord ()

when Event.EventName = “F2”

ChangeRecord ()

when Event.EventName = “F4”

DeleteRecord()

otherwise

GiveHelp ()

endcase

FIND

Finds records that match specified conditions, producing a result set.

Syntax

FIND [ num] [ setspec] [EVALUATE clause] [-> clause]

Parameters

numThe number of records to be found. Num can be
an integer constant (15, 200);
a variable, form field, or parameter that evaluates to an integer;
the word ALL.
If num is omitted, or less than 0, it defaults to ALL.
setspecThe set specification that defines the records to be found. If omitted, the current set (if it exists) is used.

Comments

Sets found using the FIND command are not stored permanently; they exist only for the current application session or until a DISPOSE SET command is executed.
If the -> clause is omitted, a result set is still produced. The unnamed result set can be referred to as CurrentSet for as long as it remains the current set.
Changes made to a record in an EntitySet or relationship are reflected in the result set, and vice versa.
$ SetCount and $ MemberCount are assigned a value equal to the number of members in the result set found by the FIND command.

Example

To find all employees whose last name is Smith, enter

find all Employees where LastName = “Smith” -> SmithSet

If you are working interactively at the command prompt, you could find it convenient to use the current unnamed result set when narrowing down a set of records. In the repeated FIND command, the second and third commands use the current set as their implicit setpsec:

> find Employees where Location = “Canada”

2019 selected

> find where LastName = “S”?

146 selected

> find where DeptNum = “D01”

7 selected

The name CurrentSet can also be used explicitly.
In application programs, you should explicitly name the result sets that you create with a FIND command. This technique is especially useful if you plan to compile a program that contains FIND commands:

procedure GetSet1 (a, b)

if a=b

find all Employees WorkIn Department -> KeepEmps

else

find all Employees WorkIn Department where LastName = a -> KeepEmps

endif

list all KeepEmps

endprocedure

You can use the FIND command to locate data, as shown in the following example:

find all Employees where LName = fEmployees.LastName

if $ setcount > 0

list all

else

  output “Nobody who works here is named: ” fEmployees.LastName

endif

You can also use FIND with forms as shown below:

find fItems where fItems.Qty > 0  % find values entered

See Also

$MemberCount

$SetCount

COMPUTE

INTERSECT

MINUS

UNION

en_CAEnglish