My program reads a file and reformats the data.
The reformated data is then processed to build datbase records.
The records are then sorted.
After the sort the records are compiled by a control field and formatted
This is where I run into the problem.
my basic code for the section gererating the error is as follows:
Code: Select all
OPEN INFILE.DAT FOR RANDOM AS #1
OPEN OUTFILE.TXT FOR OUTPUT AS #2
RECNO = 0
DO WHILE NOT EOF(1)
RECNO = RECNO + 1
GET #1, RECNO, MYREC
IF RECNO = 1 THEN
CONTROL = MYREC.FIELD
. PERFORM THIS SERIES OF COMMANDS
. TO SETUP FIRST COMPILED RECORD
ELSEIF CONTROL = MYREC.FIELD
. PERFORM CALCULATIONS ON RECORD FIELDS
. PERFORM FINAL CALCULATIONS
. ON THE DATA AND STORE THE RECORD.
. THIS IS WHERE THE PROBLEM IS
PRINT #2, Q$ SORTCH$ C$ CALFIG$ C$;
. SEVERAL MORE STATEMENTS
PRINT "PROCESSING FILE RECORD: "; RECNO
While I am not showing all my code the problem occurs when the print #2 is encountered in the ELSE of the IF - ENDIF loop. Is it due to the termination of the Print line with the semicolon? I need to terminate the PRINT # statement with the semicolon so I can add the rest of the formatted output. There are a 14 PRINT # statements to format the output of the record as I need it.
I think I may be able to place the PRINT commands into a GOSUB and get it to work but can not figure out why the PRINT # will not work inside of the IF - END IF statement.