$INCLUDE "TRM_RQOpen.bas"
TYPE dRecord
Record AS STRING * 36
EmIDNum AS STRING * 6
EmName AS STRING * 25
EmDeNum AS STRING * 5
END TYPE
FUNCTION FormatTRMdRecord(Sender AS dRecord) AS STRING
Sender.Record = Sender.EmIDNum & Sender.EmName &Sender.EmDeNum
result = Sender.Record
END FUNCTION
DIM TRMdRecord AS dRecord
DIM Record AS STRING * 36
TRMdRecord.EmIDNum = " 17"
TRMdRecord.EmName = "Duarte Jose A"
TRMdRecord.EmDeNum = " 7"
Record = FormatTRMdRecord(TRMdRecord)
CmdTsu.op = Tsu_Insert
CmdTsu.file = hWnd
CmdTsu.dataptr = VARPTR(Record)
CmdTsu.datalen = LEN(Record)
Result = trm_udt(CmdTsu)
SELECT CASE Result
CASE 0 : SHOWMESSAGE "CODE: "& STR$(Result) &": Trm_Operation trm_Insert was sucessfull"
CASE 2 : SHOWMESSAGE "CODE: "& STR$(Result) &": Trm_Operation trm_Insert encountered I/O errors"
CASE 3 : SHOWMESSAGE "CODE: "& STR$(Result) &": Trm_Operation trm_Insert encountered file not found"
CASE 5 : SHOWMESSAGE "CODE: "& STR$(Result) &": Trm_Operation trm_Insert encountered duplicate key"
CASE 20 : SHOWMESSAGE "CODE: "& STR$(Result) &": Trm_Operation trm_Insert encountered invalid Record length"
CASE 46 : SHOWMESSAGE "CODE: "& STR$(Result) &": Trm_Operation trm_Insert encountered access to file denied"
CASE 99 : SHOWMESSAGE "CODE: "& STR$(Result) &": Trm_Operation trm_Insert encountered time-out"
CASE ELSE : SHOWMESSAGE "CODE: "& STR$(Result) &": Trm_Operation trm_Insert encountered Unknown Error"
END SELECT
|