KEEP
Keeps (retains) some components in a result set while discarding others.
Syntax
KEEP «component»
Parameters
| component | The name of a component found among the objects declared in a set specification. Any number of components can be specified, provided they appear among the declared objects. |
Comments
In certain instances, you want to select records from several objects based on their relationships, but to keep data from only some of those objects. The KEEP subcommand enables you to specify the components whose data is to be kept in the result set.
The specified components of the set specification are kept. Components not kept are discarded, and duplicate records are removed from the set being specified.
Example
find all Employees WorkIn Department
where LastName = “Jones” keep Departments
The department information is kept; all other components are discarded. If the KEEP subcommand were omitted, department information would be repeated for any department where more than one employee named Jones works.
See Also
ADD
CHANGE
COMPUTE
DELETE
FIND
INSERT
LIST
REPORT FROM
SELECT
UPDATE
Calculates a time value by adding ticks to (or subtracting ticks from) a specified time value.
Syntax
$addticks(time,number)
Parameters
| time | an 8-digit number, or an expression that evaluates to an 8-digit number, that expresses a valid time value in the format HHMMSSTT |
| number | a number, or an expression that evaluates to a number |
Return Value
Number, representing a time value.
Comments
Use $addticks to perform arithmetic with time values. The $addticks function calculates a time value by adding a number representing ticks to a time value. If number is negative, the effect is to subtract the ticks from the time.
Example
If $Time has the value 22503075, then
$addticks($time,5)
evaluates to 22503080.
$addticks($time,25)
evaluates to 22503100.
$addticks($time,-5)
evaluates to 22503070.
$addticks($time,200)
evaluates to 22503275.
See Also
$addhours
$addminutes
$addseconds
$ticks
Specifies the vertical footing for each page in a column-oriented report.
Syntax
PAGE RIGHT reportitem [:format:]
Parameters
| reportitem | Any 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. |
| format | A 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 RIGHT “footing” is placed along the right-hand edge of each page in a column-oriented report. The column of text generated by this command ends in the right-most column of the page. 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 (using aggregate functions) can be displayed in the footing.
See Also
How to Use The Report Generator
Output Masks
Report Item Format Options
Deletes data from EntitySets or relationships with fields.
Syntax
DELETE [num] [setspec] [EVALUATE clause] [-> clause]
Parameters
| num | Can 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. |
| setspec | The 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
Deletes records from EntitySets or relationships with fields.
Syntax
DELETE [ALL] FROM SQLsetspec [EVALUATE clause] [-> clause]
Parameters
| ALL | Optional. Whether or not you include the ALL argument, all records in SQLsetspec are deleted. |
| SQLsetspec | An 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
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."
endifUses $position to test if a particular directory is accessed.
See Also
ACCESS
RELEASE
Encrypts the data in an EntitySet or relationship with fields.
Syntax
ENCRYPT object
Parameters
| object | The 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
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™
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
Controls the call tracing of procedures.
Syntax
SET [LOCAL] FLOW ON|OFF
Parameters
| LOCAL | The 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