Authors
Publication
Pub Details
Date
Pages
BASIC Terms
Often we get stymied by having a character array file having a wrong dimension for the job we want to do. This tool was made to convert TWO DIMENSION CHARACTER ARRAY FILES to THREE DIM FILES. With minor adjustments the program can be used to convert other dimensions to other dimensions.
The program was crafted in response to question from a User of the Dbx.B6 program (One of the programs in the Hybiscus Software). His problem was that he had many valuable record files that were in Character arrays dimensioned (500,32). He wanted to be able to LOAD the files to the Dbx.B6 program and then EDIT the files to be printed and managed by the Dbx.B6 program. The Dbx.B6 program creates and manages 3 dim files such as “O$(x,x,x)”.
The transposition of character array files from one dimension to another requires one of two methods.
- LOAD the file to memory, and then create another character array file. Then COUNT the first file to the new file. Then SAVE the new file. This process uses DOUBLE the memory required to store the first file. OR
- Dimension the new file in memory. Then READ a sequential file into the new file via a counter. Since the question from the reader involved Character array files (not Seq files), the program was developed for that purpose.
The program limit then is the FREE memory (AFTER the File is LOADED). Then if the file to be converted is smaller than the remaining FREE, the new file can be extended to have more records. For example, the user’s need was to convert character array files having the dimension (500,32). The program capacity, after loading one file, is a new file dimensioned (612,1,32). In other words, the program allows such a (500,32) two dim file to be transposed to a 3 dim file (612,1,32). Then there will be 112 new (blank) records that can be filled.
Line 9060 calculates the maximum number of records for the new file and reserves 2000 bytes of FREE for after editing. One can fudge and input a slightly larger new file than the program suggests, keeping in mind that too large an input will bring an OUT of MEMORY report. The program will work with any DOS or Cassette by modifying the LOAD and SAVE syntax. Donated to Public Domain by Bill Jones.
BASIC Listing
9000 REM ** Character String Conversion. 2 Dim to 3 Dim Donated to Public Domain By Bill Jones
9010 CLEAR
9020 INPUT "Enter File name + Ext"'m$: LOAD m$ DATA f$()
9030 CLS : PRINT #NOT PI;"Loading, Finding Dim . ."
9040 FOR n=1 TO VAL "999": ON ERR GO TO VAL "9050": LET x=LEN f$(n): NEXT n: STOP
9050 ON ERR RESET : LET a=n-SGN PI
9060 PRINT AT VAL "10",NOT PI;"There are "; FLASH SGN PI;a; FLASH NOT PI;" records in the"'m$;" File."''"You may expand this file to"'INT (( FREE -VAL "2000")/x);" Records"
9070 INPUT "Enter # of Records for New File ";c: DIM o$(c,SGN PI,x)
9080 PRINT #NOT PI;"Converting to new file . ."
9090 FOR n=SGN PI TO a: LET o$(n,SGN PI)=f$(n): NEXT n
9100 INPUT "Enter File # only for SAVE of new file ";g: BEEP VAL ".3",VAL "20": DIM f$(SGN PI): LET w$="m"+STR$ g+".A$": SAVE w$ DATA o$()
9110 CLS : PRINT AT VAL "9",NOT PI;m$;" File has been Converted"'"to dimension (";c;",1,";x;") And the"'"new file SAVED."'
9120 CLEAR : CLS : INPUT "Do another File Conversion? <1> Yes <2> No";i: CLS : IF i=SGN PI THEN GO TO VAL "9010"
Products
Media
Image Gallery
Source Code
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.