DO

Syntax

DO procedure_name[(arg1[, argi]...)]

Description

Invokes the specified procedure.

When the procedure ends, processing continues with the command following the DO command. You can use arguments to send values to or receive values from a procedure.

Arguments passed by a DO command to a procedure must match in number:

  • Database text columns, string variables, and literals can be passed to procedure string or date arguments.

  • Database numeric columns, numeric variables, and numeric literals can be passed to procedure numeric arguments.

  • Numeric variables (DECIMAL, INTEGER, FLOAT) can be passed to procedure numeric arguments without regard to the argument type of the procedure.

    SQR automatically converts the numeric values upon entering and leaving the procedure as required.

  • Date variables can be passed to procedure date or string arguments.

When a field in a DO command receives a value back from a procedure (a colon indicates that it is a back value, that is, a value that is being returned), it must be a string, numeric, or date variable, depending on the procedure argument; however, a date can be returned to a string variable and vice versa.

When a date is passed to a string, the date is converted to a string according to the following rules:

  • For DATETIME columns and SQR DATE variables, SQR uses the format specified by the SQR_DB_DATE_FORMAT setting.

    If this has not been set, SQR uses the first database-dependent format as listed in the Default Database Formats table.

  • For DATE columns, SQR uses the format specified by the SQR_DB_DATE_ONLY_FORMAT setting.

    If this has not been set, SQR uses the format listed in the DATE Column Formats table.

  • For TIME columns, SQR uses the format specified by the SQR_DB_TIME_ONLY_FORMAT setting.

    If this has not been set, SQR uses the format as listed in the TIME Column Formats table.

Parameters

Parameter Description

procedure_name

Specifies the name of the procedure to be run.

arg1 [, argi ]

Specifies the arguments to be passed to the procedure. Arguments can be any type of variable or constant value.

Example

The following example illustrates the DO command:

do get_names
do add_to_list ($name)
do print_list ('A', #total, &co_name, $name)

See The BEGIN-PROCEDURE command for information about passing arguments

See The PRINT command for information about date and time formats