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

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

SET OUTPUT FORMAT

Establishes the format for data output.

Syntax

SET OUTPUT FORMAT [ NORMAL  |  COMMADELIMITED  |  XML  |  XMLSIMPLE  |  JSON  |  JSONSIMPLE ]

Comments

The value of OUTPUT FORMAT is NORMAL by default. That is, the LIST and OUTPUT commands create output whose format exactly follows the Object Dictionary definitions of the individual fields being output. The SET OUTPUT FORMAT command can be reset to enable these commands to output data in comma-delimited format, XML, or XMLSIMPLE formats.

When using the comma-delimited format, database fields are separated from one another by the current delimiter character. This is normally a comma but can be changed using the SET DELIMITER command. Character-type fields have trailing blanks removed and are enclosed within a pair of text delimiters. This is normally double quotation marks but can be changed using the SET TEXTDELIMITER command. Numeric fields have leading blanks removed.

When using the XML format, database fields are printed using XML conventions. Each XML “record” describes all fields in full detail of the actual record being printed. In other words, each row being printed has sub-rows displaying each field of the row. In turn, each sub-row displays the content of each field.

When using the XMLSIMPLE format, database fields are printed using XML conventions in a simple format. Each XML “record” only describes the field names and their corresponding values.

Fields that are $Null are output using the current SET NULLVALUE string (without text delimiters). If NULLVALUE is a space character, fields that are $Null are output as a pair of text delimiters.

The formats JSON and JSONSIMPLE produce a JSON-structured output. JSONSIMPLE compresses all blanks whereas JSON outputs in a formatted way.

Remarks

The XML,  XMLSIMPLE, JSON, and JSONSIMPLE format options are only designed for output.

A header can be attached to the output document by using the command SET XMLHEADER.

The identification of each row being printed can be changed by means of the command SET XML ROWELEMENT.

Example

set save
set heading off
set nullvalue "$null"
set output fieldlistwidth off
set output maskfield off
set output virtualfield off
set output format commadelimited
set output UnstructuredDoc
list all Customers
set restore
set output maskfield on    % not saved by save/restore
set save
set output format xmlsimple
set xml rowelement "MyRow"
set output MyDoc
list 1 Doc
set restore

See Also

LIST

OUTPUT

$DDEFunction

Invokes and interacts with DDE services

Syntax

$DDEFunction ( p1, p2, p3, p4, ... )

Parameters

p1return type, longint
p2command, longint
p3server handle, longint
p4application command, string

Comments

Where p1, p2, and so on, indicate the desired DDE service and the data required by that service. The first parameter, p1, is entirely for Zim’s benefit and defines the data type of the value returned by the DDE service. The second parameter, p2, determines the desired service and the remaining parameters are used by the DDE service itself.

The first parameter, p1, is dependent on the DDE service you invoke and the application with which you are communicating. When using $DDEFunction, specify p1 in such way that sufficient space is allocated for the return value. For example, if you use $DDEFunction to invoke a DDE service that returns a long integer result, then the p1 you provide must be of type longint as well. If p1 were of type char 10, $DDEFunction would expect a result value of up to 10 characters in length.

The second parameter, p2, is a number that indicates the DDE service to invoke. The possible values for p2 are shown in the table below. The p2 parameter must be of type longint or int.

DDE Servicep2 ValueDescription
CONNECT1Start a conversation with an application and topic.
POKE2Set an item to a value.
DISCONNECT3Terminate a conversation.
PEEK4Retrieve the value of an Item.
EXECUTE5Execute an application.

The remaining parameters, p3, p4, and so on, are dependent on the DDE service you invoke and the application with which you are communicating.

See Also

About DDE Services

pt_BRPortuguese