DELETE

Deletes data from EntitySets or relationships with fields.

Syntax

DELETE [num] [setspec] [EVALUATE clause] [-> clause]

Parameters

numCan be
an integer constant (15, 200);
a variable, a form field, or a parameter that evaluates to an integer;
the word ALL.
If num is omitted, or less than 0, it defaults to 1.
setspecThe set specification for the simple set whose records you want to delete. If omitted, records are deleted from the current set (if it exists).

Comments

Records cannot be deleted from a composite set. Data cannot be deleted from application documents or forms.
If the target of DELETE is a set object or result set, deletion always starts at the current member of the set.

Data removed from the database by a DELETE command cannot be recovered.

Example

delete

Deletes the current member of the current set.

delete 5 Employees where DeptNum = D01

Deletes the first five records in Employees where the department number is D01.

See Also

$MemberCount

DELETE FROM

DELETE FROM

Deletes records from EntitySets or relationships with fields.

Syntax

DELETE [ALL] FROM SQLsetspec [EVALUATE clause] [-> clause]

Parameters

ALLOptional. Whether or not you include the ALL argument, all records in SQLsetspec are deleted.
SQLsetspecAn SQL set specification. If omitted, records are deleted from the current set (if it exists).

Comments

DELETE FROM is the SQL version of the DELETE command.
Records cannot be deleted from a composite set. Data cannot be deleted from application documents or forms.
DELETE FROM acts by default on all records in SQLsetspec. By contrast, DELETE acts by default on only the first record in a set.

Warning: You cannot recover data deleted by the DELETE FROM command. If no backup copy of the data exists, the data is permanently lost.

Example

delete from Employees where LastName = “Smith”

Deletes every employee whose last name is Smith.

delete from Fields where Length > (select avg (length) from Fields)

Deletes every field whose length is greater than the average length of all fields.

See Also

$MemberCount

DELETE

$dirpath

Returns information about the currently accessed application directories.

Syntax

$dirpath()

Return Value

Character string.

Comments

$dirpath returns a character string consisting of the names of all currently accessed application directories and their access types (U for update, R for read). Information about each directory is enclosed in semicolons (;). The directory name appears first, followed by the access type in parentheses.
Directories appear in the order that they were accessed; that is, the most recently accessed directories appear first.

Example

access dir1
access dir2 updatev

output $dirpath()

Prints the string; dir2(U);dir1(R);ZIM(U);_$ZimServices(R);_$session$_(U);

let vDirPath = $dirpath()

let vPos = $position($toalpha(vDirPath, -1), ";Dir1(")

if vPos > 0

output "Directory Dir1 is accessed ";

if $substring(vDirPath,vPos+6,1)="U"

output "update."

else

output "read."

endif

else

output "Directory Dir1 is NOT accessed."

endif

Uses $position to test if a particular directory is accessed.

See Also

ACCESS

RELEASE

ENCRYPT

Encrypts the data in an EntitySet or relationship with fields.

Syntax

ENCRYPT object

Parameters

objectThe name of an EntitySet or a relationship with fields. Can be a role name.

Comments

The ENCRYPT command makes stored data meaningless to anyone scanning a raw database file on disk, thereby protecting the data from unauthorized access. The encryption key is established when the New Database utility is executed.
If the data in the specified object has already been encrypted, reissuing the command raises an error.
The ENCRYPT and DECRYPT commands prevent users outside of an application session from reading sensitive data contained in disk files. All encryption and decryption in a particular database is based on a key established when you initiate a new database .
Encrypted EntitySets and relationships are accessed in exactly the same way as un-encrypted EntitySets or relationships. Internally, the software automatically decrypts data from an encrypted file as you work with that file. A slight performance penalty is paid for working with encrypted data.
An encrypted object can be returned to normal with a DECRYPT command.

See Also

DECRYPT

Securing Data Inside an Application

SET CONNECTOR DOCUMENT

Changes the runtime file name of a connector document

Syntax

SET CONNECTOR DOCUMENT connector document TO filename

Parameters

connector document

The name of the connector document.

filename

The file name to which the connector document will be referencing.

Comments

The SET CONNECTOR DOCUMENT changes the run-time value for the filename field on a connector document.  The new filename is used for all subsequent opens on the document. The filename of a connector document describes the type of the connection and the host and port where the connector resides. There are two connection types ™S™ which is used for connectors that are used for simple command-response operations or are shared single-threaded processes and F™ for connectors that provide a data feed and are either multi-threaded or used exclusively by a single ZIM instance.

A ™S™ type connection is automatically closed after the command completes and the connector issues a PROMPT. The ™F™ type connection never closes.

Example

To set the filename for the connector document SMS_SEND to be a command-response connection where the connector is running on the host ™zimdatabases.com™ at TCP port 9000:

set connector document SMS_SEND to !zimdatabases.com!9000

To set the filename on the connector SMS_RECEIVE to be a data feed where the connector is running on the host ™zimdatabases.com™ at TCP port 9001:

set connector document SMS_RECEIVE to ™F!zimdatabases.com!9001™

SET QUOTING

Specifies if quotation marks are required for character strings.

Syntax

SET QUOTING ON|OFF

Comments

The QUOTING option is set OFF by default.

Setting QUOTING ON causes the software to issue a warning message each time it encounters a non-numeric character string not enclosed in quotation marks (i.e., unquoted character strings that are valid numbers do not elicit warnings).

The SET QUOTING ON command can be used to reinforce the distinction between character strings and object names (reserved words and the names of objects in your application). While you are reminded to enclose character strings in quotation marks, you are not forced to comply. The software continues to accept unquoted character strings, because the messages being issued are warnings, not errors. Warning messages can be turned off with SET WARNINGS OFF or a SET MESSAGES OFF command.

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

Example

set quoting on
let Name = Smith

When the LET command is encountered, a warning message is issued because Smith is not enclosed in quotation marks.

set quoting on
find employees
let Name = “Smith”
let Name = FirstName
let Salary = 20000

No warnings are issued: Smith is enclosed in quotation marks; FirstName is a field name; and 20000 is a valid number.

See Also

COMPILE

PAUSE

Quotation Marks

SET FLOW

Controls the call tracing of procedures.

Syntax

SET [LOCAL] FLOW ON|OFF

Parameters

LOCALThe command is to take effect only within the current procedure.

Comments

Call tracing messages show shifts in execution control from one procedure to another. The SET FLOW command controls call tracing.

FLOW is OFF by default.

When FLOW is ON, the call tracing feature issues messages when the software enters or exits a procedure.

When entering procedurename, the message takes the form:

[nn ]–> procedurename

When exiting procedurename, the message takes the form:

[nn ]<– procedurename

where nn indicates the level of nesting represented by procedurename.

When procedurename is entered from a compiled procedure, the message is modified to read:

[nn ]–> procedurename

SET FLOW is not affected by the SET RESET and SET RESTORE commands.

Example

procedure DoCusts
set local flow on

The preceding command traces procedure calls only when those calls are made from procedure DoCusts.

set flow on

The preceding command causes the software to trace all procedure calls until otherwise notified.

See Also

RETURN

SET TRACEOUTPUT

$addminutes

Calculates a time value by adding minutes to (or subtracting minutes from) a specified time value.

Syntax

$addminutes(time,number)

where

timean 8-digit number or an expression that evaluates to an 8-digit number, that expresses a valid time value in the format HHMMSSTT
numbera number or an expression that evaluates to a number

Return Value

Number, representing a time value.

Comments

Use $addminutes to perform arithmetic with time values. The $addminutes function calculates a time value by adding a number representing minutes to a time value. If number is negative, the effect is to subtract the minutes from the time.

Example

If $Time has the value 22503075, then

$addminutes($time,5)

Evaluates to 22553075.

$addminutes($time,10)

Evaluates to 23003075.

$addminutes($time,-5)

Evaluates to 22453075.

$addminutes($time,65)

Evaluates to 23553075.

ZIM Comment Block << >>

(Program template delimiters)

<< your code >>

Quickly marks a large block of code that you want to prevent from running or that you want to be generated by the GENERATE command by putting the delimiters at the start and end of an output section in a template program.

Syntax

Place a two less than characters before the start of the code.

<< 
code / statements

>>

Place a two greater than characters at the end of your code.

Parameters

code \ statements

 

one or more command statements, typically using macros, to send to the current output destination when the program containing them is processed with a GENERATE command

 

Comments

The program template delimiters, << and >>, must appear alone on a physical line in the application document. When the program is executed, parsed, or compiled, the statements between the delimiters are ignored.

When the program is run under the GENERATE command, the statements are sent as output, after macro substitution, to the current output device.

Example

… commands1 …
<<
… commands2 …
>>
… commands3 …

Under normal execution, commands1 and commands3 execute normally; commands2 are ignored.

When the program is parsed or compiled, commands1 and commands3 are parsed or complied in the usual manner; commands2 are ignored.

When the GENERATE command is used, commands1 and commands3 execute normally; commands2 are sent as output, after macro substitution, to the current output device.

$DeadlockReason

Indicates the reason that a deadlock condition occurred.

Syntax

$deadlockreason

Return Value

A character string. Cannot be reset by an application program.

Description

$DeadlockReason contains one of the following reason codes for the current deadlock condition:

CodeReason
0transaction completed normally
1transaction terminated due to time out
2transaction terminated due to transaction recovery
3not in use
4attempt to do an update in a read transaction
5transaction terminated as a result of deadlock
6lock request outside a transaction (warning only)
7problem converting operating system lock (transaction terminated)
8no free file table entry (transaction terminated)

See Also

SET DOCUMENT FORMAT

System Variables

en_CAEnglish