Quotation Marks

Quotation marks are used to delimit character strings.

Normally, the quotation marks are optional; however, quotation marks are required when

  • the string contains characters other than digits (0 to 9), letters (a to z and A to Z), the dollar sign ($), and the underscore (_)

  • the string is identical to the name of an object or command keyword

Either single or double quotation marks can be used, but the string must end with the same type of quotation mark that was used at the start, as shown in the following example:

‘This is a character string.’

“This is a character string.”

To use the same type of quotation mark as a literal character inside the string, a backslash ( – Escape) must precede it as shown in the following example:

‘This is a quotation mark (‘) inside a string.’

To reinforce the explicit use of quotation marks around character strings, you can switch the SET QUOTING command on. Then, when the software encounters an unquoted, non-numeric character string, a warning message is generated, as shown below:

Note: Character strings that are valid numbers do not elicit warnings.

Examples

If FirstName and LastName are both fields in the EntitySet Employees, and you use the command:

find Employees where LastName = Firstname

then employees with names such as John John or Leslie Leslie are sought, i.e., the employee’s last name is identical to the first name. The software makes no distinction between uppercase and lowercase letters in the names of objects.

On the other hand, if you use

find Employees where LastName = ‘Firstname’

then employees with the string Firstname in the LastName field are sought, i.e., John Firstname, Leslie Firstname, and so on.

You cannot enter the following command

find Departments where DeptName = where

because WHERE is a command keyword. The command parser sees the second instance of WHERE as being out of context and raises an error. To find a DeptName whose value is where, you must enter

find Departments where DeptName = ‘where’

Continuation Lines

By default, a physical line end (carriage return at the command prompt or in an application program) terminates the statement on that line. Upon encountering the line end, the software processes the current statement. However, statements that are too long to fit on one physical line can be continued onto any number of physical lines.

The backslash ( – Escape) is used to signal the software that the current statement is incomplete and continues on the next physical line. In this circumstance, the backslash is called the continuation character.

The software handles the backslash as a continuation character depending on whether it appears outside or inside a quoted string.

Outside Quotation Marks

When the software encounters a backslash outside a quoted character string, it ignores any remaining characters on the current line and looks to the next physical line for the remainder of the statement. Processing does not begin until the software reaches the next physical line end (unless another unquoted backslash is encountered, as shown in the following example:

list all Employees where LastName = ‘Smith’
                   sorted by FirstName

Inside Quotation Marks

A backslash within a quoted string usually signals special treatment for the subsequent character(s). However, when the software encounters a quoted backslash as the last character before a physical line end, it assumes that the statement continues on the next physical line as shown in the following example:

list all Customers where City = ‘Los
Angeles’

The SET ESCAPECHAR Command

The SET ESCAPECHAR command is available to control how the backslash ( – Escape) is handled within quoted strings. Normally, the backslash is treated as an escape or continuation character when found inside quoted strings. By issuing a SET ESCAPECHAR OFF command, you cause the software to treat the backslash as text when it appears in quoted strings.

Comments

Comments are descriptive words or sentences, typically used as internal documentation in application programs. Comments are an essential part of application system documentation.

In Zim, the percent sign (%) is used to signal the start of a comment. When the software encounters the comment indicator, it ignores all subsequent characters on the current physical line as shown in the following example:

%————————————
% An example showing the use of comments.
%————————————
form set (not scroll) fPlayers % turn off scrolling
case
   when Event.EventName = ‘F3’ % Process Exit action
      return                   % Terminate the main procedure
   when Event.EventName = ‘F4’ % Process Update action
        UpdatePlayers()
   when Event.EventName = ‘F5’ % Process Add action
        AddPlayers ( PlayersAdded)
   when Event.EventName = ‘F6’ % Process Delete action
        DeletePlayers ( PlayersDeleted)
   when Event.EventName = ‘F7’ % Process Report action
        ReportPlayers()
endcase

To use a percent sign as a literal character rather than as a comment indicator, enclose the percent sign in quotation marks.

en_CAEnglish