Sometimes it is advantageous to translate from a LIF ASCII file type to a regular file so that other programs can make use of the data.
The following program is an example showing the general principles of converting from one data type to another. It works for LIF ASCII to ordinary ASCII conversions, but may need to be modified to work in other situations.
10 REM ASCIIDOS.BAS
20 DIM Fi$[30],Fo$[30],L$[256]
30 INPUT "Input file?",Fi$
40 INPUT "Output file?",Fo$
50 ASSIGN @I TO Fi$;FORMAT ON
60 CREATE Fo$,1
70 ASSIGN @O TO Fo$;FORMAT ON
80 ON END @I GOTO Done
90 LOOP
100 ENTER @I;L$
110 OUTPUT @O;L$
120 END LOOP
130 Done: END
Knowing several general principles will help you write conversion programs to work in whatever situation you require. Line 50: Open the input file using FORMAT ON, OFF, MSB FIRST, or whatever is appropriate. Line 60: Create an output file of the type you wish to create. Line 70: Open the output file using FORMAT ON, OFF, MSB FIRST, or whatever is appropriate. Line 100: Enter the data with a statement compatible with how the data was written. For example, if integers were written in binary, then enter into integers with the file opened for binary access. Line 110: Output the data in the format you wish it to be in. For example, if you wish three integers separated by commas, make sure you know how to use the OUTPUT statement to do so. Finally, use loop constructs (FOR, LOOP, REPEAT, or WHILE) to handle groups of data that are formatted the same.
ASCII Files
ASCII files are LIF ASCII files and are not compatible with DOS ASCII or UNIX ASCII files. See "regular files" below to learn how to create a DOS ASCII or UNIX ASCII file. A LIF ASCII file is compatible with HP BASIC ASCII files and is most useful when exchanging data using LIF floppies. In a CAT listing, a LIF ASCII file is listed as file type "ASCII". LIF ASCII files are always written with FORMAT ON and can only be accessed sequentially.
CONFIGURE BDAT
CONFIGURE BDAT {MSB|LSB} FIRST specifies the byte ordering to use with each BDAT file created after this statement is executed. By default, BDAT files are created with the native byte order of the computer. HTBasic uses LSB first. This statement was previously used to create BDAT files that could be copied (using HPCOPY) to an HP BASIC workstation. CONFIGURE CREATE is now the recommended method for creating files for interchange with HP BASIC. CONFIGURE BDAT only affects files created with HTBasic headers; files with HP LIF headers are not affected.