USING

USING

In a set specification, qualifies a relationship.

Syntax

relationship («USING obj1 AS obj2»)

Parameters

relationshipThe name of the relationship being qualified.
obj1The name of an object used elsewhere in the set specification in which relationship appears. Must be the name or role name of an EntitySet, relationship, form, or application document. Must refer to same underlying object as obj2 (e.g., one is a role name for the other).
obj2The name of one of the objects associated by relationship. Must be the name or role name of an EntitySet, relationship, form, or application document. Must refer to same underlying object as obj1 (e.g., one is a role name for the other).

Comments

When a set specification includes a relationship, two principles are used to determine the validity of EntitySets associated by the relationship:

  1. If the relationship condition contains an EntitySet name, then that EntitySet name, or any role for it, may be used in set specification involving the relationship.
  2. If the relationship condition contains a role name, only that role name may be used in a set specification involving the relationship.

The USING subcommand helps to eliminate any ambiguity as to which objects are to be associated in a set specification. Ambiguity may develop when an object, or role for that object, appears more than once in a complex set specification.

Example

list all Employees WorkFor
Managers WorkFor (using Managers as Employees
using Bosses as Managers)
Bosses
Lists all bosses (managers of managers).
list all Employees WorkFor Managers
WorkIn (using Managers as Employees) Departments

The USING subcommand associates the departments with the managers, not with the employees.

See Also

– (Dynamic Rename)

COMPLETE

UNRELATED

SET (Field Attributes)

Modify certain attributes of fields.

Syntax

SET <fieldname> REQUIRED ON|OFF

SET <fieldname> FIELDLISTWIDTH <number>

SET <fieldname> HEADING <charstring>

SET <fieldname> MASKFIELD <charstring>

SET <fieldname> REMNAME <charstring>

Parameters

fieldnameThe name of a field.
ON or OFFSpecifies if the field can have the value $null. This is equivalent to changing the REQD field to “yes” or “no”.
numberAn integer constant.
charstringA character string.

Comments

This SET command enables users to modify certain attributes of fields without doing an ERASE and CREATE command. These SET commands modify the operational state of the fields and are in effect until the field’s owner is erased.
The SET REQUIRED command changes if a field can have the value $null. This is equivalent to changing the REQD field to “yes” or “no”.
SET FIELDLISTWIDTH alters the list width of a field.
SET HEADING and SET MASKFIELD alter the heading and mask patterns for a field. Setting HEADING and MASKFIELD to the zero length string ” effectively deletes any heading or mask that was previously defined.
SET REMNAME specifies a new remote name for the field or deletes the existing remote name if the new setting is ”.
The SET SELECTIVITY is identical to the existing SET SELECTIVITY command, except that the is specified before the attribute SELECTIVITY rather than after.

See Also

SET SELECTIVITY

$Exist$

Checks whether a given Zim object exists in a Zim directory.

Syntax

$exist$([Zim directory name | Object Owner], object name, object type)

Parameters

Zim directory name or Object OwnerA character string or an expression that evaluates to a character string, naming the ZIM directory or the object owner to which the object would belong
object nameA character string or an expression that evaluates to a character string specifying the object name to be checked in the Zim directory name or within the object owner for its existence
object typeA number or an expression that evaluates to a number determining the type of the object name

Return Value

It returns a $True value if the object name is defined in the Zim directory and is of the specified object type.

It returns a $False value if the object name is not defined in the Zim directory or is not of the specified object type or the Zim directory name is already accessed.

If the object type is 0 (zero), the function will return the object type of the object for subsequent reading of the status of this object (see example).

If the object type is non-zero and the Zim directory name is empty (“”), then the return value is the owning directory name of that object.

Comments

The types of the object are described as the following table:

Object TypeMeaning
0Returns the Object Type
1A Null Object
2Shadow Directory
3Directory
4Entity Set
5Field
6Relationship with no Fields
7Relationship with Fields
8Set
9Document
10List
11Form
12Role
13Variable
14Display
15Virtual Field
16CSet
17Window
18Constant
19Menu

Examples

Check whether the directory “Accounting” is defined in Zim:

$exist$("ZIM", "Accounting", 2)

Investigate the type of the object “Customers” in directory Zim and then test whether it exists or not:

let Var = $exist$("ZIM", "Customers", 0)
out $exist$("ZIM", "Customers", Var)

SET XREF

Turns the output of cross-reference information on or off during parsing and compiling.

Syntax

SET XREF ON|OFF

Comments

The XREF option is set OFF by default.

When XREF is ON, the software sends dependency information to the current output when an application program is parsed or compiled. One line of output is generated for every object explicitly referenced by the program. The information is not saved (unlike the information produced when SET DEPENDENCY is ON).

The SET XREF command is not affected by the SET RESET and SET RESTORE commands.

Each line of output contains six sections of information, with fourteen fields in total:

  • Section 1 consists of one field that contains the output flag.
  • Section 2 contains information about the specific object that is being parsed or compiled.  This section consists of three fields, the Document Name (name of program), the Object Type (for the document name) and the Zim Directory Name (directory in which the object is located).
  • Section 3 contains information about the ownership of the specific object that is being parsed or compiled.  This section consists of three fields, the owner Object Name,  the owner Object Type and the owner Object Directory.
  • Section 4 contains information about the internal object (object within a specific object ) that is being parsed or compiled.  This section consists of three fields the internal Object Name, the internal Object Type and the internal Object Directory.
  • Section 5 contains information about the owner of the internal object that is being parsed or compiled. This section consists of three fields, the Object Name of the internal object owner, the Object Type of the internal object owner and the Object Directory of the internal object owner.
  • Section 6 consists of one field that contains the line number or sequence number in which the reference occurred.

Example

A simple application program can contain the following two lines:

% This is a test program named ServBye
list fields format SN FieldName

In which case, the commands shown below produce the indicated output:

> set xref on
> set output terminal
> parse ServBye
P ServBye Document ZIM ZIM Directory ZIM Documents EntitySet ZIM ZIM Directory ZIM 1

See Also

COMPILE

DEPENDENCY

PARSE

SET OUTPUT

INSERT

Adds a single record to EntitySets or relationships ( ISQL option only).

Syntax

INSERT INTO object [( field)] VALUES(expr1 | NULL)

[EVALUATE clause] [clause]

Parameters

objectThe name of an EntitySet or relationship with fields to which you want to add a record. A role name can be used.
fieldA target field in object. If more than one field is used, the names must be separated from one another by commas. If the field list is omitted, values are assigned to the fields in the order defined in the Object Dictionary.
The number of values must not exceed the number of fields. If field is omitted, it is an error to specify more values than there are fields in object.
expr1An expression whose value is to be assigned to the corresponding field in the field list; or, if the field list is omitted, to the corresponding field in the Object Dictionary sequence.
Expressions or simple constants can be used. Any number of values can be given, separated from one another by commas. If field is omitted, it is an error to specify more values than there are fields in object.
Fields not explicitly assigned a value become $Null or take their default values. A required field that has no default value must explicitly be assigned a value (unless a SET CHECKNULLS OFF command has been issued).
NULLThis value explicitly sets the corresponding field to $Null.

Comments

INSERT adds a single record to the specified object.

Example

insert into Employees ( LastName, Salary) values (“Smith”, 25000)

add Employees let LastName = “Smith” Salary = 25000

The above examples are equivalent.
The following example adds a new employee record for Fred Jones, age 36, whose salary is $30,000.

insert into Employees values (“Jones”, “Fred”, 36, 30000)

 

See Also

ADD

Conventions

SET CHECKNULLS

SELECT

Lists selected data from the database.

Syntax

SELECT [ALL] [DISTINCT] values FROM SQLsetspec [-> setname]

Parameters

ALLAn optional keyword indicating that all records of the specified type are to be listed. But, even if ALL is omitted, all records are processed by default.
DISTINCTSpecifies that only the records that contain unique values in the fields being displayed are to be listed.
valuesCan be:
*
An asterisk indicates that all fields in the listed records are to be displayed.
«expr »
One or more expressions whose values are to be displayed for each listed record. Each expression must be separated from the next by a comma.
SQLsetspecAn SQL set specification.

Comments

The SELECT command is the SQL equivalent of the LIST command.

You can include sub-queries using the SELECT command in SQLsetspec.

Example

select LastName,FirstName from Employees,Departments
where Employees.DNo = Departments.DNo

list Employees WorkIn Departments format LastName FirstName

The preceding two commands produce equivalent results.

select $max(Salary) from Employees group by DNo
having $average(Salary) > 30000

In the preceding command, the keywords GROUP BY and HAVING produce a list of the highest-salaried employees within each department number where the average salary is greater than $30,000.

select * from Emps order by LastName

The preceding command lists all the fields in each employee record. The records are listed in alphabetical order by last name.

select distinct LastName,FirstName from Emps

The preceding command lists the first and last names of all employees, eliminating duplicates where two or more employees have exactly the same first and last name.

See Also

Conventions

DELETE FROM

FIND

INSERT

LIST

UPDATE

SET RESET

Resets most global application settings to their default state.

Syntax

SET RESET

Comments

The SET RESET command returns most global application settings to their default values.
The global application settings reset to their defaults by SET RESET include

SET AUTORETRYNOT APPLICABLESET CHECKNULLS
SET COLUMNSPACINGSET CURSORSET DELIMITER
SET DOCLINELENGTHSET EOFVALUESET ERRORS
SET ESCAPECHARSET HEADINGSSET INFORMATION
SET INPUT FORMATSET INPUT TIMEOUTSET MEMBERCOUNT
SET MEMBERINTERVALSET MESSAGESSET MESSAGES WINDOW
SET MOUSESET NULLVALUESET OUTPUT
SET OUTPUT FIELDLISTWIDTHSET OUTPUT FORMATSET OUTPUT MASKFIELD
SET OUTPUT TRIMSET OUTPUT VIRTUALFIELDSET PAGESIZE
SET PAGEWIDTHSET PAUSESET SPECIALSCAN
SET STRATEGYSET TEXTDELIMITERSET TIMEOUT
SET TRACE OUTPUTSET TRANSACTION FLOWSET WARNINGS

The SET RESET command does not record the state of the following settings:

SET BREAKABLESET CHECKSETSSET CURRENTSET
SET DEPENDENCYSET EXCEPTIONSET FLOW
SET LEXTRACESET QUOTINGSET RUNTIME
SET SELECTIVITYSET SINGLESTEPSET SIZE
SET STOP ERRORSSET TRACESET XREF

See Also

SET RESTORE

SET SAVE

$ObjRunMethod

Run the methods of an ActiveX object.

Syntax

$ObjRun[Method] (Object, MethodName, «Parameters»)

Parameters

Objectan object variable or formfield of type OLE
MethodNamea string or an expression that evaluates to a string
Parametersone or more optional arguments as per the specifications of the object

Return Value

Returns a result as per the specification of the object.

Note: Zim attempts to convert to the assigned type. Ensure a proper variable type is assigned.

Comments

Parameters can be named. If they are named, they do not need to be entered in any particular order. Named parameters contain the name of the parameter, an equal sign, and the value of the parameter.

$null can be used to maintain position of optional parameters in unnamed argument list. Unnamed parameters must precede named parameters in argument list.

If you require it, you can have OLE objects return values by reference, since ZIM passes all variables by reference to OLE objects.

Example

The add method of Treeview is described as having the following syntax:

INode* Add(
      [in, optional] VARIANT* Relative,
      [in, optional] VARIANT* Relationship,
      [in, optional] VARIANT* Key,
      [in, optional] VARIANT* Text,
      [in, optional] VARIANT* Image,
      [in, optional] VARIANT* SelectedImage);

Assume you have a form called treeview with a treeview component on it called tree.

Assume vNode is a variable of type object. The syntax to add a node to the treeview’s nodes object is provided below.

compute all myset wh $distinct (custs.cc) is not $null evaluate 
 ( let vNode = $ObjRunMethod ( vNodes, 'Add', 
     % placeholder for relative
     % placeholder for relationship
    $squeeze('', 'c',$trim(custs.cc)), %unnamed argument for Key
    $squeeze('','text=',$trim(custs.company)))) %named argument for Text

Assume the variables sWidth and sHeight are integers and the variable vole is an object. The following example retrieves the object’s width and height given a display with two months high and three months wide:

let vole = $ObjCreate("mscomctl2.monthview.2")
out $ObjRunMethod(vole,"ComputeControlSize",3,2,sWidth,sHeight)

Warning

COM objects are being discontinued by Microsoft and may not be available in future releases of Zim-X.

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

$translate

Replaces segments of a character string with new text.

Syntax

$translate(source,pattern,replace)

Parameters

sourcea character string, or an expression that evaluates to a character string
patterna character string, or an expression that evaluates to a character string
replacea character string, or an expression that evaluates to a character string

Return Value

Character string, consisting of source, with replace substituted for all occurrences of pattern.

Comments

Use $translate to substitute portions of source with replace. If source, pattern, or replace are not of a character data type, they are converted to a character data type before the function is applied.

If source is of data type ALPHA or VARALPHA, searches for pattern are case-insensitive; otherwise, searches for pattern are case-sensitive.

Example

$translate("the slow brown fox","slow","quick")

Evaluates to “the quick brown fox”.

% translates Smith to Smythe
list all Employees where LastName = "Smith"
format FirstName $translate(LastName,"ith","ythe")

Translates occurrences of Smith to Smythe in the field LastName.

See Also

$concat

$delete

$fill

$left

$position

$replace

$right

$squeeze

$substring

About Character Literals

About Functional Expressions

en_CAEnglish