Intermec 6100 Reference Guide

Page of 328
SECTION 6
Conversions and Interfaces
6-6    PEN*KEY
R
 6100 Computer Programmer’s Reference Guide
Files
Since each PEN*KEY 6000 Series Computer has a reset button, there is a possiĆ
bility that the user could press it at any time.  To maintain data integrity the apĆ
plication must make sure that all file writes are committed to disk.  This should
be done at the completion of every transaction, e.g. a sales invoice.  Applications
should 
fflush()
 all open streams.  Also, because of DOS disk buffers and the
fact that DOS does not update the directory entry for a file with each write, apĆ
plications must do one of the following:
"
Close and reopen all files.
"
Call DOS function 68h for each open file.  All data still in DOS disk buffers
is written to disk immediately, and the file's directory entry is updated.  ExĆ
ample code for Borland C++:
asm mov ah,0x68
asm mov bx,filehandle
asm int 0x21
"
Use DOS function 5D01h, which flushes DOS buffers and updates the diĆ
rectory entries for all open files.  Example code for Borland C++:
int FileCommit(void)
{
REGS  regs;
SREGS sregs;
// Parameter table used by function 5d01h.  Only process_id and
// computer_id are used.
struct {
unsigned int ax;
unsigned int bx;
unsigned int cx;
unsigned int dx;
unsigned int si;
unsigned int di;
unsigned int ds;
unsigned int es;
unsigned int RESERVED;
unsigned int computer_id;
unsigned int process_id;
} dos_parm;
dos_parm.computer_id = 0;
//set current computer
dos_parm.process_id = getpsp();//set current process
sregs.ds = FP_SEG(&dos_parm);
//set up address of parameter table
regs.x.dx = FP_OFF(&dos_parm);
regs.x.ax = 0x5d01;
//commit all files to disk
intdosx(&regs,&regs,&sregs);
if (regs.x.cflag)
return regs.x.ax;
// if error return code
return 0;
// completed ok
}
Even if files are committed to disk, a reset can still occur at such a time as to
leave a partial record in a file.  Files such as the transaction stream should be
verified at program start, and any invalid records should be truncated or marked
as void.
Remove any code used for formatting memory cards for the 4000 Series.  PC
memory cards can be formatted on the PEN*KEY 6000 Series Computer by loadĆ
ing the CardSoft software and executing FORMAT.COM.
Drives
The RAM drive is now drive C:, not drive B:.
If CardSoft software is used, use only the CardSoft drives (E: and F:) to access
the PC memory cards.  Using drive A: or B: can corrupt the cards.
6. Conversions and
Interfaces