HTBasic Help
×
Menu
Index

Formatted I/O

 
OUTPUT, ENTER, PRINT, DISP, and LABEL allow you to control the format of both output and input data. The format is specified as an IMAGE. The IMAGE string can immediately follow the USING keyword as a string (literal or variable) or a line number or label can follow the USING keyword to reference an IMAGE statement that contains the format data. For example:
 
OUTPUT CRT USING "ZZZ.DDD";1.2
IMAGE ZZZ.DDD
OUTPUT CRT USING 20;1.2
 
An IMAGE string consists of a list of one or more image items. The items specified in the image list are acted upon as they are encountered. Each image list item should have a matching output (or enter) item. Processing of the image list stops when no matching output item is found. However, when the last item in the image list is used, the image list is reused starting at the beginning to provide matches for all remaining output items. FORMAT ON is used in connection with USING, even if FORMAT OFF has been specified.
 
If more decimal places to the left of the decimal point are required to output a numeric item than are specified in the image specifier, an error is generated. If M or S is not specified, then a minus sign will take up one digit place. If the number contains more decimal places to the right of the decimal point than are specified in the image field, the output is rounded to fit.
 
If the number of characters specified in an image specifier for a string is less than the number of characters in a string, then the remaining characters are ignored. If the number of characters specified is greater than the number of characters in a string then trailing blanks are used to fill out the image field.