![]() | ![]() | Programming Guide |
Formats
CATQUERYvalues
DBMS [ WITH CURSORcursor] FORMAT [ [column]format
[, [column]format... ] ]
WITH CURSORcursor- Name of declared
SELECTcursor. If the clause is not used, Prolifics uses the defaultSELECTcursor.column- Name of selected column. The case of column should match the setting of the case flag for the database engine. If columns are not named, the formats are applied by position.
format- Specifies how Prolifics should format the value.
formatis either a Prolifics variable or a quoted precision edit.
Use
DBMS FORMATto formatCATQUERYvalues before writing them to a variable or a text file. The options are explained below.If format is a Prolifics variable, Prolifics formats the column value as if it were writing to the field. In particular, the following characteristics affect the formatting:
- Variable's maximum shifting length
For more information about formatting select results, refer to "Format of Select Results" in Application Development Guide.
format can also be a precision edit. A precision edit is a quoted string beginning with a percent sign. It supplies the length of the value, and optionally, a decimal precision for numeric values.
A precision is given in the form
"%width""%width.precision"To turn off formatting on the default or named cursor, execute DBMS FORMAT with no arguments.
// use column "title_id" and "copy_num" exactly as returned
// format column "due_back" with the LDB variable "today",
// format column "price" to width 5 with 2 decimal places
// format column "rental_comment" to width 25 and truncate.proc tapes_due
DBMS CATQUERY TO FILE rentlist
DBMS FORMAT due_back today, price "%5.2", \
rental_comment "%25"
DBMS SQL SELECT title_id, copy_num, due_back, price, \
rental_comment FROM rentals
return
![]()
![]()
![]()
![]()