identifier

NAME
SYNTAX
DESCRIPTION
PREDEFINED VARIABLES
NOTES
COPYRIGHT
SEE ALSO

NAME

identifier, variable − rwl program syntax for identifiers and variables

SYNTAX

identifier ::=
  ( a | b ... z | A | B ... Z { a | b ... z | A | B ... Z | _ | 0 | 1 ... 9 )
| ( $ | 0 | 1 ... 9 { 0 | 1 ... 9 } )
| $#

DESCRIPTION

The RWP*Load Simulator uses identifiers to name variables, procedures, etc. Ordinary identifiers are sequences of upper and lower case letters followed by upper or low case letters, underscore or digits. In addition to these, $# and a $ followed by digits are identifiers.

There is one single name-scope for all identifiers and you can e.g. not have a sql statement and an integer with the same name.

PREDEFINED VARIABLES

The following lists predefined variables that all are read only.

threadnumber

An integer variable that is assigned a unique number in each worker thread; numbering starts at 1. It can be used for e.g. debugging, printing, etc.

processnumber

An integer variable that by default gets it value from the operating system process id as returned by getpid(), but can be overwritten using the -p option.

runnumber

An integer variable that uniquely identifies each run, it is maintained as a database sequence in the results database, it is valid in the main thread and in worker threads if a results database is provided.

loopnumber

An integer variable that is used internally in control loops. It is initialized to 1 when a control loop starts and is incremented by 1 for every execute in the block; it can e.g. be used for debug printing as needed.

everyuntil

A double variable that is used in control loop. For every loop, it is calculated as the expected time-stamp to start the next loop.

usrseconds

A double variable that contains the user time in seconds from the last call to the getrusage statement.

sysseconds

A double variable that contains the system time in seconds from the last call to the getrusage statement.

oraerror

An integer variable that contains the Oracle error number of the most recently executed SQL statement. As an example, if executing a single row query that returns no rows, its contents will be 1403.

oraerrortext

A string variable that contains the Oracle error text of the most recently executed SQL statement

stderr

A file variable that can be used in write/writeline statements to write output to stderr.

stdout

A file variable that refers to stdout. Mostly useful with fflush when using the output from rwloadsim in a pipeline.

stdin

A file variable that refers to stdin; it can be used in read loops to make rwloadsim part of a pipeline.

hostname

A string variable that gets its value from gethostname and which is inserted into the repository table, rwlrun. The value is otherwise not used by rwloadsim. If you are using multi process execution, the value of the variable is the name of the host where the multi process preparation takes place even if you via ssh arrange for a multi process execution to take place on some other system.

$1, $2, etc

String variables that are made available as positional arguments when e.g. the -A option is used. The shift statement shifts these once to the left without modifying the right most of them.

$#

Integer variable containing the number of positional arguments. Reduced by 1 for every call to shift.

NOTES

You can write runseconds and epochseconds as if these two were variables containing the same values as the functions of the same name; this is deprecated and will be desupported in some future release. Since they really are functions, they cannot be used to do SQL bind.

COPYRIGHT

Copyright © 2023 Oracle Corporation
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

SEE ALSO

simpledeclaration(1rwl), statement(1rwl), declaration(1rwl) expression(1rwl)