PUT statement
Sends the value of one or more expressions to an output destination other than the terminal.
Syntax
STREAMname
Specifies the name of a stream. If you do not name a stream, the AVM uses the unnamed stream. See the DEFINE STREAM statement reference entry and chapter on alternate I/O sources in OpenEdge Development: Programming Interfaces for more information on streams.STREAM-HANDLEhandle
Specifies the handle to a stream. Ifhandle
it is not a valid handle to a stream, the AVM generates a run-time error. Note that stream handles are not valid for the unnamed streams. See the chapter on alternate I/O sources in OpenEdge Development: Programming Interfaces for more information on streams and stream handles.UNFORMATTEDexpression
FORMATstring
The format in which you want to display theexpression
. If you do not use the FORMAT option, the AVM uses the defaults shown in Table 56.
Table 57 shows the default formats for other expressions.
Table 57: Default data type display formats Data type Default display format CHARACTER x(8) CLASS3 >>>>>>9 DATE 99/99/99 DATETIME 99/99/9999 HH:MM:SS.SSS DATETIME-TZ 99/99/9999 HH:MM:SS.SSS+HH:MM DECIMAL ->>,>>9.99 HANDLE2 >>>>>>9 INT64 ->,>>>,>>9 INTEGER ->,>>>,>>9 LOGICAL yes/no MEMPTR1 See the note at the end of the table. RAW1 See the note at the end of the table. RECID >>>>>>9 ROWID1 See the note at the end of the table.
- You cannot display a MEMPTR, RAW, or ROWID value directly. However, you can convert it to a character string representation using the STRING function and display the result. A ROWID value converts to a hexadecimal string, “0x
hexdigits
,” wherehexdigits
is any number of characters “0" through “9" and “A” through “F”. A MEMPTR or RAW value converts to decimal integer string.- To display a HANDLE, you must first convert it using either the INT64 or INTEGER function and display the result.
- To display a CLASS, you must first convert it using the INT64, INTEGER, or STRING function and display the result.
ATexpression
TOexpression
SKIP [ (expression
) ]
Specifies the number of new lines you want to output. If you do not use the SKIP option, PUT will not start a new line to the output stream. If you use the SKIP parameter, but do not specifyexpression
(or ifexpression
is 0), the AVM starts a new line only if output is not already positioned at the beginning of a new line.SPACE [ (expression
) ]CONTROLexpression
The expression specifies a control sequence that you want to send without affecting the current line, page counters, and positions maintained within ABL. Following CONTROL,expression
can be a character-string expression or a RAW variable. It can include null character constants of the form NULL or NULL(expression
), whereexpression
specifies the number of NULLs to send. See the Notes section in this reference entry for details.ExampleThis procedure creates a text file that contains the names of each customer. The names are separated from each other by a slash (/). The entire file consists of one long line.
Notes
- In the AT, TO, SKIP, and SPACE options, if
expression
is less than or equal to 0, the AVM disregards the option.- The PUT statement never automatically starts a new line. You must use SKIP to explicitly start a new line.
- The PUT statement uses the default display format for the data type of the field or variable you name in the PUT statement. The PUT statement does not overwrite an area that is already used by a previous format when it displays data. For example:
Use the UNFORMATTED option with the PUT statement to override the format-sensitive display.- You can use the NULL keyword to output null characters (\0) in a control sequence. For example, the following statements write the control sequence ESC A \0 and 20 NULLs to output stream A:
- You can use the PUT statement with an object reference for a class instance. The PUT statement implicitly calls the ToString( ) method of the class to convert the specified object reference to a character value before it sends the value to the output destination.
See alsoDEFINE STREAM statement, DISPLAY statement, EXPORT statement, OUTPUT TO statement, PAGE statement, PUT SCREEN statement, Stream object handle
OpenEdge Release 10.2B
|