ACCESS

Opens an application directory to use the objects contained in it.

Syntax

ACCESS dirname [READ|UPDATE]

Parameters

dirname

Specifies the name of an application directory.

READ

Specifies that you can only read object definitions in dirname, not update object definitions. If neither READ nor UPDATE is specified, READ is the default value.

UPDATE

Specifies that you can read and update object definitions in dirname.

Comments

Initializing an application database (New Database) creates a base application directory called zim. Additional application directories are defined as objects in the application database. To access any directory other than the base application directory, you must issue an ACCESS command for that directory.

Once a directory has been accessed, objects in that directory are available for use. To close a directory (and its objects) to further access, use the RELEASE command.

Use the CREATE, ERASE, RENAME, PERMISSION, ENCRYPT, DECRYPT, COMPILE, UNCOMPILE, SET SIZE, and SET SELECTIVITY commands to change object definitions only in an application directory accessed using the UPDATE option.

By accessing a directory using the READ option, you prevent unwanted modification of the directory contents. Foreign directories can be accessed using READ only.

Example

To access directory ProjectControl in read-only mode, use

access ProjectControl read

or

access ProjectControl

To access the directory Personnel in update mode, use

access Personnel Update

 

See Also

$dirpath

COMPILE

CREATE

DECRYPT

ENCRYPT

ERASE

PERMISSION

RENAME

SET SELECTIVITY

SET SIZE

UNCOMPILE

UPDATE

( ) Parentheses

Alters the order of evaluation of expressions, or groups expressions, or both.

Syntax #1

Alters the order of evaluation in expressions.

(expression)

Within a larger expression, a single expression placed in parentheses changes the order of execution (which normally depends on the precedence of operators).

Parameters

expressionan arithmetic or logic expression

Syntax #2

Groups expressions.

(expression1, expression2)

Parentheses can be used to group several expressions, each of which is evaluated; the grouped expression takes on the value of the last individual expression in the group.

Parameters

expression1any expression
expression2any expression

Comments

Use parentheses to group one or more expressions, each of which is evaluated. The grouped expression takes on the value of the last expression in the group.

Examples

7 * 8 - 5^2
31
7 * (8 - 5)^2
63
not Salary > 30000 or Age < 25

Result: Logically true when Salary is 29,000 and Age is 21.

not (Salary > 30000 or Age < 25)

Result: Logically false when Salary is 29,000 and Age is 21.

w = ( (let x = 5+3), (let y = 5-3), (let z = 5^3), 5.0/3.0 )

Values: x=8, y=2, z=75, w=1.7

See Also

Conventions

How To Construct Logic Expressions

How To Use Logic Expressions

$distinct

Returns the unique values from a series of successive values.

Syntax

$distinct(expression)

Parameters

expressionany expression

Return Value

This function returns the unique values from a series of successive values. For each instance of its argument, $distinct returns a value that depends on the immediately previous value of the argument. If the previous and current values of the argument are equal, $distinct returns $Null. Otherwise, $distinct returns the current value of the argument.

Comments

It is important to sort the argument’s source values before using $distinct, because the value returned by the expression depends on the order in which the source values are processed.

Example

find Emps sorted by LastName
list all format LastName Salary

Prints the last names and salaries of all employees.

find Emps sorted by LastName
list all format $distinct(LastName) Salary

Prints the last names and salaries only of the employees who appear first in the list with a particular name.

find Emps sorted by LastName
list all where $distinct(LastName) is not $null format LastName

Prints a list of the last names of employees without repeating identical names.

report from Emps sorted by DeptNo LastName
break 1 DeptNo
footing
"No. of distinct last names in " deptno
"is" $count($distinct(LastName))
endreport

When used in a BREAK heading or footing, $distinct is reset for each break group. As a result, the first record in each break group is considered to be new, even if the value of the argument to $distinct is the same as the last value in the previous group. In the above report, even if the last employee in one department is named Smith and the first employee in the next is also Smith, the values are still considered to be distinct.

See Also

Functional Expressions

INTERSECT

MINUS

UNION

OR

Performs a Boolean OR of two logic expressions.

Syntax

expression1 OR expression2

Parameters

expression1A logic expression using conditional and Boolean operators. If the expression is complex, it must be enclosed in parentheses.
expression2A logic 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 ORExpression1
TrueFalse
Expression2TrueTrueTrue
FalseFalseFalse

Example

The following expression is logically false only if Salary is 30,000 and Bonus is 0. In all other cases, the expression is logically true.

Salary <> 30000 or Bonus <> 0

See Also

About Boolean Expressions

About Conditional Expressions

\ (Escape)

Causes the following character to be treated literally, or as a hex code in a character string; indicates continuation of a command on the subsequent line.

Syntax #1

Causes the character that follows it in a string to be treated literally.

\char

Parameters

charany single character that is to be treated literally in a character string

Syntax #2

Causes certain characters that follow it in a string to be treated as hexadecimal code.

\char1char2

Parameters

char1either digits from 0 to 9, or letters from A (a) to F ( f), that together comprise a hexadecimal character code
char2either digits from 0 to 9, or letters from A (a) to F ( f), that together comprise a hexadecimal character code

Syntax #3

Indicates the continuation of a command onto a subsequent line.

commandstart \
remainder

Parameters

commandstartany portion, from the beginning, of one command
remainderthe remaining portion(s) of the same command

Comments

In a character string, the escape operator causes the next character to be treated literally or as a hex code. Outside of a character string, it indicates that a command continues on the next line.

Example

"This is a quote (\"); this is a backslash (\\)"
output "\0F"
let x = 10 \
    y = 5 \
    z = 2

See Also

About Character Literals

DOWN

Moves the current member pointer one or more members “down” in a result set.

Syntax

DOWN [num] [setname]

Parameters

numThe number of members farther “down” into setname that the current member pointer is to be moved. Num can be
an integer constant (15, 200);
a variable, form field, or parameter that evaluates to an integer;
the word ALL.
The default value for num is 1. If num is negative, DOWN num actually moves the current member pointer “up” in the set.
setnameThe name of the result set whose current member pointer you wish to move. If setname is omitted, the current set is used.

Comments

NEXT is a synonym for DOWN.

Example

down 10

Moves the current member pointer 10 members “down” towards the end of the set.

down 5

delete 5

Moves the current member pointer five members “down” and then deletes five members (starting with the new current member).

find Customers -> CustSet

form open fCustomer

form set accelerator F1 F2 Escape

while

change fCustomer from CustSet

form display input

if Event.EventName = “escape”

break

else    % use $direction as a handy variable

let $direction = {-1 where Event.EventName = “F1”, 1}

endif

down $direction CustSet

endwhile

Finds a set of customers and then displays the records in the set one at a time.

See Also

$currentmember

BOTTOM

LOCATE

NEXT

PREVIOUS

TOP

UP

$left

Extracts a segment from the front of a character string.

Syntax

$left(source,length)

Parameters

sourcea character string or an expression that evaluates to a character string
lengtha number or an expression that evaluates to a number

Return Value

Character string, consisting of a string containing length characters from source, starting in the first position.

Comments

Use $left to produce a string consisting of length characters from source, starting in the first position.

If source is not of a character data type, it is converted to a character data type before processing.

If length is zero or negative, the result is the null string. If length is longer than source, the result is source.

Example

$left("abcdefgh",5)

Evaluates to “abcde”.

$left(9999,1)

Evaluates to ” “, because numbers are converted to character strings containing seventeen characters before being processed by $left.

$left(1234567890,10)

Evaluates to ” 123″. Number literals convert to character strings containing seventeen characters before being processed by $left.

See Also

$concat

$delete

$insert

$position

$replace

$right

$substring

$toalpha

$tocharacter

$translate

% (Wildcard)

Used with the LIKE operator to construct patterns for matching.

Comments

Used with the LIKE operator in logic expressions, the % wildcard matches zero or any number of subsequent characters when the pattern on the right is compared to expression1.

Example

"_ ob%"

Matches any character string whose second and third letters are ob, followed by zero or more characters (i.e., “Robert”, “Bob”, “Cobbler”, etc.).

compute Employees where LastName like "_ a%n"

Processes all records whose LastName values are three characters or more, the second character being an a and the last character being an n.

Grade like "100\%"

Shows the percent sign being used literally in a string. (The first backslash “escapes” the second backslash, which, in turn, “escapes” the percent sign, turning it into a literal character.)

find Parts where PartDesc like "%\\%"

Finds parts whose part description contains a backslash.

FirstName like $ concat(" S_e%p", SuffixVariable)

Assuming that SuffixVariable is “%”, then the above expression is logically true if FirstName matches the pattern “S_e%p%”.

The LIKE Operator, The %Wildcard and SQL Servers

The LIKE Operator with %Wildcard sometimes operate differently in SQL servers than in ZIM. The following construction:

find Parts where PartDesc like "%e"

in some SQL servers might only retrieve records when the PartDesc ends exactly with an “e” in the last position of the field. If PartDesc is 5 characters long, the “rode” and “are” will not be retrieved, whereas “there” and “force” will be.

To solve this situation, the above construction must be written this way:

find Parts where $trim(PartDesc) like "%e"

See Also

Conventions

How To Construct Logic Expressions

How To Use Logic Expressions

$mask

Applies a mask pattern to the specified data item.

For a more detailed explanation of mask patterns and their relation to data types, see Masking.

Syntax

$mask(item,pattern)

Parameters

item
  • A value of any type or an expression that yields a value of any type; or
  • An field of any data type.
pattern
  • The mask pattern to apply to item.
  • alphanumeric;
  • a constant, a variable, a parameter, or a field.

Return Value

Character string, containing the masked value.

Comments

  • Mask patterns consist of special characters and fixed text characters;
  • Fixed text characters are always output as is;
  • The set of special characters available for use to mask a particular data value is determined by the data type of value being masked (character string, date, or number );
  • Most special characters are typically replaced by characters from item, but they can also output characters in their own right (e.g., the floating currency symbol: $, which can be customized);
  • The Language Customizer utility (ZIMLANG) can be used to redefine how certain special characters are displayed or output.
    For example, in numeric masks, the currency symbol $ normally outputs a dollar sign, but it can be configured to output other symbols, such as the pound sign £ or yen sign ¥.

Examples

list all Employees format FirstName LastName
($mask(DeptNum,”?epartment Number ??”))

Displays values of DeptNum, such as “D09”, as “Department Number 09”, instead of “D09”.

list all Employees format FirstName LastName
($mask(Salary,”$$$$$$9.99″))

Displays all values of Salary with a floating dollar sign.

$mask ($date, “MM-DD-YY”)

Evaluates to “08-18-98” if $Date is 19980818.

$tocharacter

Converts an expression to the character data type and sets the length of the result.

Syntax

$tocharacter(expression,length)

Parameters

expressionAny value, or an expression that yields any value.
lengthA number that specifies the number of characters in the resulting character string. Length can be a constant, a variable, a form field, or a parameter.

Return Value

Character (char), length bytes long.

Comments

Use $tocharacter to convert expression to the CHAR data type in an area length bytes long. If length is negative, the result string is set to the maximum possible length.

String comparisons involving this function are case-sensitive.

If expression is a number, the number is converted to character string form in an area length bytes long. If the given area is not large enough to hold the converted value, an error results.

Example

Assume LastName is “Smith “.

$tocharacter(LastName,3)

Evaluates to “Smi”.

$tocharacter(LastName,12)

Evaluates to “Smith “.

$tocharacter(50,2)

Evaluates to “50”.

$tocharacter(200+300,20)

Evaluates to ” 500″ (17 leading spaces).

$tocharacter(500,-2)

Evaluates to ” 500″ (14 leading spaces).

list all Emps format $tocharacter(FirstName,6), $tocharacter(LastName,9)

$tocharacter changes the width of values being output with a LIST command.

en_CAEnglish