GOTO PREVIOUS

Branches from an exception handler to the command that caused the exception.

Syntax

GOTO PREVIOUS

Comments

GOTO PREVIOUS is used only in an exception handler and only to branch to the command that caused the exception to occur. GOTO PREVIOUS exits the exception handler, and closes it in the same way as ENDON.

Example

Note: In this example, all transactions are assumed to be implicit transactions (i.e., single commands).

procedure UpdateDB()

 on deadlock

  output “The database is busy.”

   output “Do you want to try again? ( y/ n):” ;

   input Response

  if Response = ” y”

goto previous

  else

   return

  endif

 endon

 … the rest of the commands in the procedure …

endprocedure

If a deadlock condition occurs, the exception handler asks the application user if the transaction should be attempted again. If the answer is yes, the GOTO PREVIOUS command causes the application program to retry the command that caused the deadlock condition. If the answer is no, the procedure terminates.

See Also

GOTO

GOTO NEXT

ON

SET INPUT FORMAT

Establishes the format for data input.

Syntax

SET INPUT FORMAT NORMAL|COMMADELIMITED

Comments

The INPUT FORMAT option is NORMAL by default.

Normally, the ADD and CHANGE commands look for input whose format is a simple data stream, separated by delimiter characters. SET INPUT FORMAT enables these commands to read data in “comma delimited” format from unstructured application documents.

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

Fields that match the current NULLVALUE string (without text delimiters) are evaluated as $Null. Fields comprising of two text delimiters are evaluated as $Null or zero, depending on the field being assigned.

Example

set save
set input format commadelimited
set nullvalue “$null”
add Customers from UnstructuredDoc
set restore

See Also

ADD

SET DELIMITER

SET NULLVALUE

SET OUTPUT FORMAT

SET TEXTDELIMITER

PAGE FOOTING

Specifies the page footing for a report.

Syntax

PAGE FOOTING reportitem [:format:]

Parameters

reportitemAny valid expression. Complex expressions must be enclosed in parentheses. When you specify more than one expression, each must be separated from the next by at least one space.
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 PAGE FOOTING command causes a footing to be displayed at the bottom of every page of a report. Report items in this command can include individual data values only from the last record processed on the current report page; however, summary information computed over all the members on the current report page can be displayed in the footing.

See Also

BREAK (Reports)

How to Use The Report Generator

PAGE HEADING

REPORT FOOTING

Report Item Format Options

SET TEXTDELIMITER

Specifies the current text delimiter for comma-delimited format.

Syntax

SET TEXTDELIMITER character

Parameters

character

Any valid character, or a variable containing a valid character. Reserved characters (e.g., space, backslash, etc.) must be enclosed in quotation marks.

Comments

The TEXTDELIMITER option is set to the double quotation mark (“) by default.

The specified character is used as the delimiter, marking the boundaries of character-type fields in the comma-delimited format. The delimiter is used by the INPUT command (input from the terminal), by the ADD and CHANGE commands (input from an unstructured application document), and by the LIST and OUTPUT commands (output to the terminal or an unstructured application document) in COMMADELIMITED format.

If TEXTDELIMITER is set to the space character, the double quotation mark is used as the text delimiter for both input and output.

Example

set textdelimiter “/”

 

See Also

ADD

CHANGE

INPUT

LIST

OUTPUT

SET DELIMITER

SET INPUT FORMAT

SET OUTPUT FORMAT

SET SPECIALSCAN

SORT

Sorts the members of an existing result set.

Syntax

SORT [setname>] BY expression [ASCENDING|DESCENDING]

Parameters

setname

The name of a result set. If setname is not specified, the current set is used.

expression

An expression that identifies a field to be used as a sort key. Complex expressions must be enclosed in parentheses.

ASCENDING or DESCENDING

Specifies how the sort on the associated key is to be performed.
ASCENDING (default)
Sorts in “alphabetical order” (A-Z, 0-9).
DESCENDING
Sorts in “reverse alphabetical order” (Z-A, 9-0).

Example

find all Employees where Name = Smith -> SmithNames

sort SmithNames by Salary

The preceding two commands could be combined into one by using a SORTED BY subcommand.

sort SmithNames by FirstName DeptNum Salary descending

The preceding command sorts the employees named Smith by first name (ascending order), department (ascending order), and salary (descending order).

 

See Also

SORTED BY

$or

Performs a bit-wise OR of two values.

Syntax

$or(char1,char2)

Parameters

char1a character string, or an expression that evaluates to a character string
char2a character string, or an expression that evaluates to a character string

Return Value

Character string.

Comments

The $or function combines the bit patterns of two characters in the fashion of a Boolean OR and returns the resulting character.

If the char1 or char2 string contains more than one character, only the first character in the string (one byte) is processed. You can express char1 and char2 as hex codes (e.g., 6E).

Example

$or("E","F")

The bit pattern of hex 0E is 00001110 and of hex 0F is 00001111. The above expression returns the bit pattern 00001111 (hex 0F).

See Also

$and

$not

SET SEQUENCENUMBER

Controls the way Automatic Sequence Numbers operate.

Syntax

SET SEQUENCENUMBER {object | ALL} {number | variable | ON | OFF}.

where

object

The name of an Entity-Set Relationship with fields that contains an ASN defined

ALL

Refer to all Entity-Sets and Relationships with fields that contain ASNs defined

number

a positive number from 1 up to 15-digit number

variable

a variable containing a positive number from 1 up to a 15-digit number. If the contents of the variable is $null, the number is assumed to be 1.

Comments

The command sets an initial number, enables or disables automatic sequential numbers to the mentioned object or to ALL the objects that contain ASN.

Examples

SET SEQUENCENUMBER ALL 1

Resets all existing ASN to 1.

LET MyVar = 1000
SET SEQUENCENUMBER Customer MyVar

Initializes the ASN for Customer to the value of 1000.

SET SEQUENCENUMBER ALL OFF

Disables all ASN.

SET SEQUENCENUMBER Customer ON

Enables the ASN for the Customer object and $ZimSeqNum returns the current sequence number available for Customer

$ServerFunction

Executes server-side functions.

Syntax

$serverfunction (server specific syntax [«,parameters»])

Parameters

server specific syntax

A character string or an expression that evaluates to a character string containing a server-specific syntax for execution on the server side.

parameters

Zero or more expressions to satisfy the usage of the server-specific syntax.

Return Value

A value created by the server-specific syntax.

Comments

$ServerFunction executes the specific syntax (for a particular server) using the parameters.

The syntax is not parsed and checked, but rather passed through directly to the Server and, therefore, must be accepted and understood there.

Examples

$ServerFunction ("sysfun.left(?,3)",var1)

This will is accepted as is by Oracle.

$ServerFunction("sysfun.left(cast(? as VARCHAR(20),3)",var1)

This syntax is accepted by DB2.

See Also

Server Side Functions with Input Parameters

The Benefits of $ServerFunction

$and

Performs a bit-wise AND of two values.

Syntax

$and(char1,char2)

Parameters

char1a character string, or an expression that evaluates to a character string
char2a character string, or an expression that evaluates to a character string

Return Value

Character string.

Comments

The $and function combines the bit patterns of two characters in the fashion of a Boolean AND and returns the resulting character. If the char1 or char2 string contains more than one character, only the first character in the string (one byte) is processed. You can express char1 and char2 as hex codes (e.g., 6E).

Example

$ and("E","F")

The bit pattern of hex 0E is 00001110 and of hex 0F is 00001111. The above expression returns the bit pattern 00001110 (character hex 0E).

See Also

$not

$or

About Character Literals

About Functional Expressions

SET OUTPUT

Specifies the current output.

Syntax

SET OUTPUT docname [APPEND] [FILEPATH options]

Parameters

docnameThe name of the application document to which all output is to be sent. Can also be one of the two pre-defined application documents, terminal or printer.
APPENDSpecifies that new output to docname is to be appended to the output already existing in the application document (if any).
FILEPATH optionsSpecifies that the input document will be governed by the options as follows:

file://<the full path of a text file> – subsequent ZIM statements referring to the docname above will read this physical file instead;

port://name:speed:bits:parity:stopbits:CTS – It only works for Linux environments and specifies a serial port to be read;

connector://IP address:port – reads from the specified IP address (or URL) using that port number;

pipe://<OS command> – executes the OS command.

fifo://<FIFO name> – reads records from the FIFO name.

Comments

The SET OUTPUT command specifies the application document that is to receive the output from all subsequent FORM REPORT, GENERATE, LIST, OUTPUT, PRINT, REPORT FROM, and SELECT commands. The setting remains in effect until changed by a subsequent SET OUTPUT command.

The software provides two pre-defined application documents, terminal and printer, that correspond to your terminal screen and default printer, respectively. OUTPUT is set to Terminal by default. If set to printer, the SET OUTPUT command has no impact on the format in which the report prints; use $setproperty to change print properties for a report.

The APPEND option is not valid in combination with the option FILEPATH.

The FILEPATH “file:…” is an excelent way of providing an output file without creating a new document.

The FILEPATH “pipe:…” allows to execute any operating system command without creating a specific document for it.

The FILEPATH “fifo:…” writes records to a FIFO (in memory) for subsequent read by another Zim program using SET INPUT FILEPATH “fifo…”. Many programs (producers) can write to a FIFO, but usually only one (consumer) reads from it.

Example

set output MyDoc append
set output printer
report from ...
... other commands ...
endreport
set output terminal

This example shows how to write a document anywhere in the system. The first SET OUTPUT sets the output to “c:\myDir\FirstFile.txt” while the second sets it to “c:\myDir\SecondFile.txt”.

set output MyDoc filepath "file://c:\\myDir\\FirstFile.txt"
list 20 zimprof
set output MyDoc filepath "file://c:\\myDir\\SecondFile.txt"
list all AnotherDoc
set output terminal

See more examples in the command SET INPUT.

en_CAEnglish