Creating an Export File

The ENCODE command stores the code for the tab character in the $sep variable. The code <009> is enclosed within angle brackets to indicate that it is a character that the system does not display. SQR treats it as a character code and sets the variable accordingly. ENCODE is a useful way to place non-alphabetical and nonnumeric characters into variables.

The LET command creates variables for the text strings that are used as column headings in the export file. The STRING command combines these variables in the $col_hds variable, with each heading separated by a tab.

The select paragraph uses the STRING command again, this time to combine the records (named as column variables) in the $db_cols variable, with each record separated by a tab.

The NEW-PAGE command is used in this example in an unusual way. It causes a new line and carriage return at the end of each record, resetting the line number to 1. The page is not ejected because of the FORMFEED=NO argument in the DECLARE-LAYOUT command. Remember that this report is for exporting, not printing.

You can now load the output file (ex11a.lis) into a spreadsheet or other application.