Causes DEC DATATRIEVE to format and write one or more values of specified or implied DEC DATATRIEVE value expressions to your terminal or workstation, to a file, or to a unit record device. Format For retrieving from selected records and target record streams formed by FOR loops: [ {file-spec } ] PRINT print-list [ ON {*.prompt } ] [ { } ] For retrieving from the current collection: [ {file-spec } ] PRINT ALL [print-list] [ ON {*.prompt } ] [ { } ] For retrieving from record streams formed by the PRINT statement using one RSE: [ {file-spec } ] PRINT [print-list OF] rse [ ON {*.prompt } ] [ { } ] For retrieving from record streams formed by the PRINT statement using two RSEs (the inner print list follows another print list): PRINT print-list, ALL print-list OF rse-1 [,print-list] OF rse-2 [ {file-spec } ] [ ON {*.prompt } ] [ { } ] For retrieving from record streams formed by the PRINT statement using two RSEs (the inner print list precedes any other print list): PRINT ALL ALL print-list OF rse-1 [,print-list] OF rse-2 [ {file-spec } ] [ ON {*.prompt } ] [ { } ]
1 – Arguments
print-list Is a list of value expressions and formatting specifications. ALL When used alone following PRINT, ALL causes the records in the current collection to be displayed or written to the specified file or device. When used with a print list, ALL causes the print list to be evaluated for each record in the current collection. When the print list begins with an inner print list, ALL is required to establish the proper context in which to resolve references to the items in the hierarchical list. rse Is a record selection expression that creates the record stream DEC DATATRIEVE uses to evaluate the elements of the print list. file-spec Is the file specification of the file to which you want to write the output of the statement. A complete file specification has the following format: node-spec::device:[directory]file-name.type;version *.prompt-name Is a prompting value expression that prompts you for a file specification to which you want to write the output of the statement.
2 – Examples
The following example retrieves data from selected records and prints the data: DTR> FIND FIRST 2 YACHTS DTR> SELECT; PRINT TYPE, LOA, PRICE LENGTH OVER MANUFACTURER MODEL ALL PRICE ALBERG 37 MK II 37 $36,951 The following example shows how to retrieve data from target streams formed by FOR loops: DTR> FOR FIRST 2 YACHTS CON> PRINT TYPE, LOA, PRICE LENGTH OVER MANUFACTURER MODEL ALL PRICE ALBERG 37 MK II 37 $36,951 ALBIN 79 26 $17,900 DTR> The following example shows how to retrieve data from hierarchical records using nested FOR loops: DTR> FOR FIRST 2 FAMILIES CON> FOR KIDS CON> PRINT MOTHER, FATHER, KID_NAME KID MOTHER FATHER NAME ANN JIM URSULA ANN JIM RALPH LOUISE JIM ANNE LOUISE JIM JIM LOUISE JIM ELLEN LOUISE JIM DAVID LOUISE JIM ROBERT DTR>