Progress
Language Reference


PUT Statement

Interfaces
OS
SpeedScript
All
All
Yes

Sends the value of one or more expressions to an output destination other than the terminal.

SYNTAX

PUT
  [ STREAM stream ]
  [ UNFORMATTED ]
  [     { expression
            [ FORMAT string ]
            [ { AT | TO } expression ]
        }
     |  SKIP [ ( expression ) ]  
     |  SPACE [ ( expression ) ] 
  ] ... 

PUT [ STREAM stream ] CONTROL expression ... 

STREAM name

Specifies the name of a stream. If you do not name a stream, Progress uses the unnamed stream. See the DEFINE STREAM Statement reference entry in this book and chapter on alternate I/O sources in the Progress Programming Handbook for more information on streams.

UNFORMATTED

Tells Progress to display each expression in the same format produced by the EXPORT statement, but without quotes.

expression

Specifies a constant, field name, variable name, or expression.

FORMAT string

The format in which you want to display the expression. If you do not use the FORMAT option, Progress uses the defaults shown in Table 36.

Table 36: Default Display Formats 
Type of Expression
Default Format
Field
Format from Dictionary
Variable
Format from variable definition
Constant character
Length of character string
Other
Default format for the data type of the expression

Table 37 shows the default formats for other expressions.

Table 37: Default Data Type Display Formats
Data Type
Default Display Format
CHARACTER
x(8)
DATE
99/99/99
DECIMAL
->>,>>9.99
HANDLE
>>>>>>9
INTEGER
->,>>>,>>9
LOGICAL
yes/no
MEMPTR1
See the note at the bottom of the table.
RAW1
See the note at the bottom of the table.
RECID
>>>>>>9
ROWID1
See the note at the bottom of the table.
WIDGET-HANDLE
>>>>>>9
  1. 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, “0xhexdigits,” where hexdigits is any number of characters “0" through “9" and “A” through “F”. A MEMPTR or RAW value converts to decimal integer string.

AT expression

Specifies the column position where you want to place the output value. If that position has already been used on the current line, PUT skips to the next line and puts the expression in the specified column.

TO expression

Specifies the column position where you want to end the output value being output. If that position has already been used on the current line, PUT skips to the next line and puts the expression in the specified column.

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 specify expression (or if expression is 0), Progress starts a new line only if output is not already positioned at the beginning of a new line.

SPACE [ ( expression ) ]

Specifies the number of spaces you want to output. Spaces are not placed between items being PUT unless you use the SPACE option.

CONTROL expression

The expression specifies a control sequence that you want to send without affecting the current line, page counters, and positions maintained within Progress. 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 ), where expression specifies the number of NULLs to send. See the “NOTES” section for details.

EXAMPLE

This 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.

r-put.p
DEFINE STREAM s1.

OUTPUT STREAM s1 TO cus.dat.

FOR EACH customer:
  PUT STREAM s1 name "/".
END.

OUTPUT STREAM s1 CLOSE. 

NOTES

SEE ALSO

DEFINE STREAM Statement, DISPLAY Statement, EXPORT Statement, OUTPUT TO Statement, PAGE Statement, PUT SCREEN Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095