PERMISSION

Grants permission to other users to access your data.

Syntax #1

Sets permission for access to EntitySets or relationships.

PERMISSION object who [READ] [ADD] [CHANGE] [DELETE]

Parameters

objectSpecifies the name of an EntitySet or relationship.
whoIdentifies the users to whom the specified object permissions apply; who can be
OWNER
Anyone who shares the UserID under which object was created.
GROUP
Anyone who shares the GroupID under which object was created.
OTHER
Everyone else.
READGives the designated users permission to read the contents of object.
ADDGives the designated users permission to add to the contents of object (implies READ).
CHANGEGives the designated users permission to change the contents of object (implies READ).
DELETEGives the designated users permission to delete the contents of object (implies READ).

Syntax #2

Sets permission for access to fields or application directories.

PERMISSION object who [READ] [UPDATE]

Parameters

objectSpecifies the fully qualified name of an application directory of field.
whoIdentifies the users to whom the specified object permissions apply; who can be
OWNER
Anyone who shares the UserID under which object was created.
GROUP
Anyone who shares the GroupID under which object was created.
OTHER
Everyone else.
READGives the designated users permission to read the contents of object.
UPDATEGives the designated users permission to update the contents of object.

Comments

Only the owner of an object can reset that object’s permissions.

To access a directory, you must have READ or UPDATE permission. To CREATE, ERASE, or RENAME objects in a directory, you must have UPDATE permission. By default, all users have UPDATE permission in a directory.

Example

permission Employees owner add change

Gives only add or change permission to the owner.

permission Employees other

Gives no access by users outside the owner’s group.

permission Employees.LastName group read update

Users in owner’s group can read but not update.

permission MyDir group update

permission MyDir other

Users in the owner’s group can read the MyDir directory and can create, erase, or rename objects in it. Other users are to have no access to MyDir.

See Also

object permissions

WHILE

Enables repeated execution of a block of command.

Syntax

WHILE [expression]

commands

ENDWHILE

Parameters

expressionA logic expression.
If expression includes fields from the current set, then it is evaluated using the values of the specified fields in the current member of the set.
ENDWHILEMarks the end of the WHILE structure. A WHILE command must always have a corresponding ENDWHILE.
If a necessary ENDWHILE is missing, all subsequent commands in the current procedure are treated as part of the WHILE structure, and all of those commands continue to be executed as long as expression is true. When the end of the procedure is reached, the “open” WHILE command is closed.

Comments

The WHILE … ENDWHILE structure enables a block of commands to be repeatedly executed, as long as expression is logically true.

As soon as the software detects that expression is logically false, execution resumes at the first command following the ENDWHILE. To exit a loop before expression evaluates to false, use a BREAK command.

An open WHILE loop is automatically closed if

  • you exit a procedure in the middle of a WHILE structure (using a BYE, RETURN, STOP, or TRANSFORM command), or
  • a procedure ends before the ENDWHILE is encountered.

Example

% Commands to select and display form fDispEmp

%

——————————————————————-

find all Employees       % Create set of all Employees

while $setcount > 0      % Loop until end of set

  change fDispEmp from current  % Fill form with emp. data

  form display nolabel input    % Display form and start input

  if Event.EventName = “Escape”  % Check for Escape key

  return           % If so, finish

  endif

  if ThisForm.FormChanged = $true % Check if data modified

  change current from fDispEmp % Update current member

  endif

  next            % Go to next record

  let $setcount = $setcount – 1   % Decrement $setcount

endwhile

while Age > 20

 … other commands …

% Missing endwhile statement

… more commands …

last command in procedure

In the preceding example, the commands subsequent to the missing ENDWHILE command are executed as if they were a part of the WHILE structure. When the end of the procedure is reached without encountering the necessary ENDWHILE, it generates an error message.

form open fCustomers

while

 form display input

 … more commands …

 if Event.EventName = “Escape”

  break

 endif

…more commands …

endwhile

Notice in the preceding command that a BREAK (or BYE, RETURN, STOP, or TRANSFORM) command is required to exit a WHILE loop that contains no logic expression.

See Also

Boolean Expressions

Conditional Expressions

CONTINUE

LIST

Lists data from the database.

Syntax

LIST [ num] [ setspec] [EVALUATE clause ] [FORMAT expression [HEADING expression]] [-> clause]

Parameters

numThe number of records to be listed. 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.
If num is less than zero, or omitted, num defaults to 1.
setspecA set specification whose members are to be listed. If setspec is omitted, the current set (if available) is used.
expressionAny expression. Enclose complex expressions in parentheses.
heading

A character string or an expression that evaluates to a character string.

Comments

The LIST command outputs num members of source to the current output device (usually the terminal).

By default, each column has a heading consisting of the field name. Headings can be suppressed using the SET HEADINGS command.

The width of each column is determined by these rules:

  • Unless a “LIST width” has been defined, character values occupy a width equal to their defined object length.
  • Unless a “LIST width” has been defined, number values are converted to their character equivalents, using the maximum width required for the particular data type (e.g., INT converts to eight characters).
  • If defined, the “LIST width” determines the width of a column (if 0 or $Null, the implicit width is used; if -1, the field is not LISTed).
  • If headings are to be output, widths are appropriately extended for longer headings.
  • If a character-manipulating function reduces the length of values being output, the output width is not reduced.
  • The $toalpha and $tocharacter functions can be used to specify the width of a column in LISTed output.

The HEADING option, always used in conjunction with FORMAT, establishes the heading that will be displayed above the corresponding expression, in place of any other heading that ZIM otherwise would be displaying. This option particularly useful whenever the expression is not a single field, thus normally not displaying any headings.

Output is also controlled by the SET PAGESIZE, SET PAGEWIDTH, and SET PAUSE commands.

Example

list all Employees format LName FName (($date – BirthDate)/365)

The complex expression is enclosed in parentheses.

list all Employees format LName heading “LastName” FName(($date-BirthDate)/365)

It will list three fields whose headings are: “Last Name”, “FName” and “Age of Employee”.

list

The current member of the current set is listed.

list all format $count(“”) LName FName Age

All members of the current set are listed with sequence numbers.

See Also

OUTPUT

REPORT FROM

SELECT

SET PAGESIZE

SET PAGEWIDTH

SET PAUSE

DEPENDENCY

Produces or deletes object dependency information.

Syntax

DEPENDENCY [RESET] [FOR] [object]

Parameters

RESET

Instructs the software to delete all saved dependency information for the specified object(s). If no object is named, all dependency information is deleted.

object

The name of an object for which you want to output dependency information, or whose dependency information you want to delete.

Comments

Object dependency information is captured during ERASE, CREATE, COMPILE, and PARSE commands if a SET DEPENDENCY ON command has been issued. The DEPENDENCY command either deletes this information or sends it to the current output. When dependency information is output, each dependency occupies one line and the output contains the following fields:

Flags

The first character can be
S if the dependency is for a system-defined object.
P if the dependency results from a reference by an application program.
O in all other cases (the dependency is an owner-object).
The second character can be
X if the dependent object is more recent than the time of program compilation (for a program dependency) or the time of creation of the owner-object (for an owner dependency).

ObjectName

The name of object (whose dependent objects are being displayed).

ObjectType

The object type of ObjectName

ObjectDirName

The application directory location of OwnerObjectName.

OwnerObjectName

The name of the object that owns object (i.e., if object is a field, then OwnerObjectName is the name of the EntitySet, relationship, or application document that owns that field).

OwnerObjectType

The object type of OwnerObjectName.

OwnerObjectDirName

The application directory location of OwnerObjectName.

DepObjectName

The name of an object that depends on ObjectName.

DepObjectType

The object type of DepOwnerObjName.

DepObjectDirName

The application directory location of DepObjectName.

DepOwnerObjName

The object name of  DepObjectName.

DepOwnerObjType

The object type of DepObjectName.

DepOwnerObjDirName

The application directory location of DepOwnerObjName.

Example

Consider a one-line application document called Test:

list e1

To produce dependency information for Test, enter

> set dependency on      % on by default

> parse TestProg

> dependency for TestProg

that outputs

O Test Document ZIM ZIM Directory ZIM

P Test Document ZIM ZIM Directory ZIM e1 EntitySet ZIM ZIM Directory ZIM

 

See Also

$compilestatus

COMPILE

PARSE

SET DEPENDENCY

SET OUTPUT

SET XREF

 

SYSTEM

Sends a command to the operating system.

Syntax

SYSTEM expression [RESET|CLOSE] [INVISIBLE] [BACKGROUND | REMOTE]

Parameters

expressionAny expression that evaluates to a character string. Expression may include constants, variables, parameters, functions, and so on.
RESETCauses all of the software’s internal data buffers to be flushed to disk.
CLOSEThe CLOSE option does not do anything anymore and it is ignored.
INVISIBLEAllows the command specified in expression to be executed without affecting the screen display.
BACKGROUNDIndicates that the command specified in expression is to be executed asynchronously while Zim continues to run. Many operating system commands can be processed concurrently.
When BACKGROUND is omitted, execution is suspended while the operating system executes the specified command.
REMOTEOnly applicable to Zim Thin Client, it executes the operating system command specified in expression in the server side.

Comments

SYSTEM sends the command represented by expression to the operating system. For expression to be successfully executed, it must be meaningful to the operating system. Any software required for the execution of expression must be available to the system.
The SYSTEM command runs synchronously by default; the BACKGROUND subcommand can be used to force any SYSTEM command to execute asynchronously.

Note: For batch files, precede the command with an exclamation mark (!).

Note: There is no sense issuing the command SYSTEM with CMD, COMMAND or SH and the option BACKGROUND because it will require user interaction but there is no visible window to do it. The result is that Zim will wait for an event (closing the operating system window) that will never occur.

Note: The CLOSE option is ignored in Zim 9. Until Zim 7.x, it was intended to be able to copy Zim files around while guaranteeing that they would not be in a volatile state. Now, ZimServer possesses all Zim files and they cannot be closed or moved around at will because this creates breaches in the database security. In a well maintained working environment, users never have access to the Zim database files located in the server machine, thus ensuring maximum safety and security of the database. The only exception is when dealing with PER USER files: in this case, there is the statement INITIALIZE PERUSER which creates per user file on the fly without the need of copying any Zim files around nor saving “blank” copies of these files.

Example

find Customers where LastName = “Smith” and FirstName = “John”

system $concat(“archive “, fCustomers.cc, “.dat”)

If the cc value is 7592, then this command invokes a program called “archive” to archive the data file by passing the command archive 7592.dat to the operating system.

system “erase c:\\file.dat”

In systems where the path delimiter character is the backslash, remember that the backslash is also the escape character in character strings. Two backslashes are required, as shown above, to send the backslash to the operating system.

set escapechar off

system “erase c:\\file.dat”

set escapechar on

In the above example, SET ESCAPECHAR is used to turn off use of the escape character in character strings. Or, use SET SPECIALSCAN to switch off use of all reserved characters in text strings.

Note: See the user documentation for your operating system.

See Also

EDIT

GRAPH

INITIALIZE PERUSER

ERASE

Erases an object from an application directory.

Syntax #1

Erases an object from an application directory.

ERASE object name [FROM dirname] [KEEP]

Parameters

object

One of
constant, directory, display, document, EntitySet, form, menu, relationship, role, set, variable, window

name

The name of the object.

dirname

The name of the application directory from which object is erased.

KEEP

The database file associated with objname is not erased from the file system.

Comments

The ERASE command erases an object from an application directory. If dirname is not specified, object is erased from the base application directory, zim.

The target directory must have been accessed in update mode. You cannot erase objects from foreign directories.

For ERASE to proceed, the explicit dirname in the ERASE command (or the implicit directory zim) must match the owner-directory of object. Qualifying the name of object is a recommended programming practice.

Syntax #2

Erases an index belonging to a specified object.

ERASE INDEX ownername.fieldname

Parameters

ownername

The name of the EntitySet, relationship with fields, or structured application document to which fieldname belongs.

fieldname

The name of the field whose index is to be erased.

Syntax #3

Erases a field belonging to a specified object.

ERASE FIELD ownername fieldname

Parameters

ownername

The name of the EntitySet, relationship with fields, or structured application document to which fieldname belongs.

fieldname

The name of the field to be erased. Only virtual fields can be erased.

Comments

Only virtual fields can be erased.

If you erase an EntitySet or relationship with fields, all data in that object is lost. To save the data, copy it to another object (usually an EntitySet or application document), or use the UNLOAD or RELOAD programs to temporarily store the data elsewhere.
If you erase an application document, the data in the associated disk file remains untouched.

Example

erase entityset Employees from Personnel

Erases the EntitySet Employees from the Personnel directory.

erase relationship BelongsTo

Erases the relationship BelongsTo from the Zim application directory.

 

See Also

CREATE

CURSOR

PERMISSION

RENAME

CONNECT

Establishes a connection to Zim Integrated Server or an SQL database.

Syntax

connect to [ “ZIMSERV” | “JDBCSAM” | alias name ] using (database name, SQL server name,

userid, password, server name, domain name)

alias nameis or as defined in the configuration file “zimalias.zim”.
database nameis the logical database name is either the database name serviced the Zim Server process or the instance name as known by SQL database servers.
SQL server nameis the generic name of the SQL database server like Oracle, MySQL, SQLServer, etc. When connecting to Zim Server, this parameter is ignored.
useridis the login name as known by the server being connected to. It cannot be left blank or $NULL.
passwordis the password associated with the user that is connected to the server.
server nameevaluates to the port number on which the server is listening. This can be a service name from the services file or the physical number of the port on which the server is listening.
domain nameis the domain name, physical address or internet address where the database is located and where the server boss process must already be running.

Comments

All parameters are strings or expressions that produce a string.

In the case of a multiple connection to more than one server possessing the same SAM name, an alias name should be defined in the configuration file “zimalias.zim”.

Example

For user “JOE” with password “PASSWORD” to connect to a Zim server, enter

connect to using (“Inventory”, “”, “JOE”, “PASSWORD”, “Joes_Server”, “LinuxAirport”)

To connect to MySQL (or any other SQL database server), you must use the JDBC SAM:

connect to using (“Sales”, “MySQL”, “TheUser”, “ThePassword”,”5455″)

If connecting to two servers of the same SAM name at the same time, one of them must be defined as an alias

See Also

DISCONNECT

GOTO

Branches to another location in an application program.

Syntax

GOTO labelname

Parameters

labelnameAn identifier that has been declared as a label in the procedure executing the GOTO command.

Comments

GOTO can be used only to branch forward or backward within the same procedure.

To declare a label, type the labelname, followed by a colon, at the appropriate point in the program. The labelname must be the first word on the line where the label is declared. Labels cannot be declared in or before an exception handler.

Exception Handlers and the GOTO Command

The GOTO command can be used within an exception handler to resume execution at an arbitrary point in the procedure body.

In the following example, when a deadlock occurs, the DEADLOCK handler restarts a transaction by using a GOTO command:

procedure MyProc5(Parm1,Parm2)

   on deadlock

     goto RetryTransaction

   endon

RetryTransaction:

   transaction

   … other commands …

   endtransaction

endprocedure

Note that the GOTO command uses a label name. All labels in a procedure must be declared following the last exception handler declaration. A GOTO cannot be used to branch into an exception handler, and an GOTO command executed in an exception handler must branch out of the exception handler to some point within the body of the procedure.

Any command in a procedure could potentially trigger an exception handler. After an exception condition has been handled, a developer typically wants the application program either

  • to retry the command that caused the exception, or
  • to skip the command that caused the exception and go on to the next command

One way to implement these requirements is to label each command line, and using the GOTO command, conditionally branch out of the exception handler to the appropriate command line. Alternatively, two implicit GOTO labels can be provided to address these requirements: GOTO PREVIOUS and GOTO NEXT.

The PREVIOUS and NEXT labels are defined dynamically to identify, respectively, the command line that caused the exception and the next command line. Note that the GOTO NEXT has the same effect as ENDON.

The GOTO NEXT and GOTO PREVIOUS commands can be used only within the body of an exception handler.

Example

The GOTO command is used to break out of a WHILE loop when an exit condition has been met.

while Quantity > 0

:

while ProdCode is not $null

:

if Event.EventName = “F3” % This key has been defined

   goto Exit       % as the “exit” key.

endif

:

endwhile

:

endwhile

Exit:

:

The GOTO command is used in an exception handler to restart a transaction that has been aborted as a result of a deadlock condition.

procedure MyProc (Param1, Param2)

 on deadlock

   goto retry_transaction

  endon

retry_transaction:

 transaction

 … other commands…

   endtransaction

endprocedure

The sequence of events is

  • a deadlock condition occurs while the application is attempting to execute a transaction
  • the ON DEADLOCK exception handler is triggered
  • the exception handler executes the GOTO command, that causes the software to skip the retry_transaction label
  • the application continues to process the commands that follow the label, effectively restarting the execution of the transaction

See Also

GOTO NEXT

GOTO PREVIOUS

ON

REPORT FROM

Selects data for a report and specifies overall report format.

Syntax

REPORT [num] FROM [setspec] [GRAPHIC [TEMPLATE name]] [orientation] [PAUSE n]

[format options] [-> clause]

Parameters

numPlaces a limit on the number of records from setspec used in the report.

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 of num is ALL. If num is less than zero, num is set to ALL.

setspecA set specification that defines the data to be used for the report. If omitted, the current set (if it exists) is used.
GRAPHICSpecifies that this report is to be generated using a graphical structure.
TEMPLATE nameFor graphical reports, the name of an optional template to define the layout of the report.
orientationOrientation can be
FORMAT DOWN
Specifies that the report is line-oriented. Successive records from setspec are placed on successive lines.
FORMAT ACROSS n
The report is column-oriented. Successive records from setspec are placed in successive columns across the report page. N specifies the number of columns; it must be a positive integer.
The default value of orientation is FORMAT DOWN.
PAUSE nPAUSE n causes a pause before the first page of the report is output, and another pause after each subsequent n pages have been output. Pauses are useful when the report is being output to a printer that is manually fed sheets of special paper, or when the report is being viewed on the computer one window-full at a time.
During a pause, the message Press to continue, q to quit appears on the terminal. To output the next n pages, press Return. To stop the output, press q.
The PAUSE message can be altered using the Language Customizer utility.
format optionsA list of options defining the overall appearance of the report. Can be one or more of
COLUMNSPACING , PAGESIZE , PAGELINES , TOPMARGIN , BOTTOMMARGIN , PAGEWIDTH , LEFTMARGIN or PAGELAYOUT .
In each case, n can be a constant, variable, form field, or parameter that evaluates to a positive integer.

Comments

The REPORT FROM command produces a set whose members are used as the source of data values for the report. The various clauses in the REPORT FROM command also specify the overall format of the report and determine if the report is line-oriented or column-oriented.

The format option PAGELAYOUT is only valid for graphical reports and specifies the layout of the page to be used for displaying or printing the report. is an expression that evaluates to a string containing eight parameters separated by semicolons like this example:

REPORT FROM Customers GRAPHIC TEMPLATE tCust PAGELAYOUT “2140;1950;1;1;0;0;0;0”
Other report commands…
ENDREPORT

The values in PAGELAYOUT mean (in tenths of millimeters): Height of the page; Width of the page; Number of Rows (for labels); Number of Columns (for labels); Top Margin; Left margin; Vertical distance between labels; Horizontal Distance between labels.

See Also

BREAK (Reports)

ENDREPORT

How to Use The Report Generator

Report Item Format Options

CREATE

Creates an object in an application directory.

Syntax #1

Creates an object in an application directory.

CREATE object name [IN dirname][$fn <filenumber>] [DELETE | KEEP]

CREATE object name [IN dirname]

Parameters

object
[one_fourth]
One of
constant, directory, display, document, entityset, form, menu, relationship, role, set, variable, window
nameThe name to be given to object.
dirnameThe name of the application directory in which object is to be created. If dirname is not specified, object is created in the base application directory, called zim.
filenumberThe number of the zim file created to contain the data. For example, if the CREATE command is invoked with $fn 400, Zim attempts to associate file zim0400 with the created object. It is sometimes useful to associate a particular filenumber with a particular object: if the object was erased with the KEEP option, the create command recreates it with the KEEP option.
DELETEWhen DELETE is specified, the existing database file, if present, is deleted before a new file is created. If DELETE is not specified and a file exists, an error message indicates that Zim is unable to create the object.
KEEPWhen KEEP is specified, the existing database file, if present, is kept instead of creating a new one. If the file does not exist, a new (empty) database file is created.

Syntax #2

Creates an index.

CREATE INDEX ownername.fieldname [UNIQUE]

Syntax #3

Creates a field.

CREATE FIELD ownername fieldname

Parameters

ownernameThe name of the EntitySet, relationship with fields, or application document to which fieldname belongs.
fieldnameThe name of the field in ownername to index or to create.
UNIQUEIf UNIQUE is specified, any duplicate key values are rejected and do not appear in the index.

Comments

The application directory named in a CREATE command must have been accessed in update mode (see ACCESS) and all information needed to define the object must exist in the Object Dictionary. For CREATE to proceed, the explicit dirname in the CREATE command (or the implicit directory zim) must match the owner-directory specified for object in the Object Dictionary; or, there must be no owner-directory specified for object in the Object Dictionary. In the latter case, object can be created in any or in every application directory available in the database (except foreign directories).
A field or form field cannot have the same name as an existing variable, EntitySet, relationship, role, directory, application document, window, constant, result set, form, menu, or display in the same application directory. Several fields or several form fields can have identical names, provided that each identically named field belongs to a different ownername.
There is an internal limit of 65000 CREATEs per Zim directory in Zim.  If this limit is exceeded, a 3029 error is generated. For more information, see Zim Error Codes.  To resolve this error, export all objects and import these objects into a newly initialized Zim database.  In a newly initialized database, the CREATE counter is reset to 0.

Example

create entityset Employees in Personnel

Creates an EntitySet called Employees in the application directory Personnel.

create index Employees.FirstName

Creates an index for an un-indexed field FirstName in the Employees EntitySet.

See Also

ERASE

PERMISSION

RENAME

pt_BRPortuguese