Category : Modula II Source Code
Archive   : JPIBTRV.ZIP
Filename : TEST2.MOD

 
Output of file : TEST2.MOD contained in archive : JPIBTRV.ZIP
MODULE Test2;
FROM IO IMPORT WrCard, WrLn, WrInt, WrStr;
FROM Mod2BTRV IMPORT BTRV;

TYPE
TestRecDef = RECORD
KeyVal : CARDINAL;
Name : ARRAY[0..9] OF CHAR;
END;

KeySpec = RECORD
KeyPos : CARDINAL;
KeyLen : CARDINAL;
KeyFlg : CARDINAL;
NOTUSED : ARRAY [1..4] OF BYTE;
KeyRsv : ARRAY [1..6] OF BYTE;
END;

FileSpec = RECORD
RecLen : CARDINAL;
PageSiz : CARDINAL;
NdxCnt : CARDINAL;
NOTUSED : ARRAY [1..4] OF BYTE;
Variable : CARDINAL;
Reserved : ARRAY[1..2] OF BYTE;
PreAlloc : CARDINAL;
KeyBuf : KeySpec;
END;

VAR
RecDef : FileSpec;
x : CARDINAL;
Status : INTEGER;
TestRec : TestRecDef;
TestRecLen : INTEGER;
FileName : ARRAY[1..20] OF CHAR;
PosBlock : ARRAY[1..128] OF CHAR;

BEGIN
FileName := 'TEST.DBF';
WITH RecDef DO
RecLen := 12;
PageSiz := 512;
NdxCnt := 1;
PreAlloc := 0;
Variable := 0;
KeyBuf.KeyPos := 1;
KeyBuf.KeyFlg := 0100H;
KeyBuf.KeyRsv[1] := 14;
KeyBuf.KeyLen := 2;
END;
TestRecLen := SIZE(RecDef);
Status := BTRV(14, PosBlock, RecDef, TestRecLen, FileName, 0);
IF Status <> 0 THEN
WrStr('Error Creating File ');
WrStr(' Status - ');
WrInt(Status,0);
HALT;
END;

FileName := 'TEST.DBF';
TestRecLen := SIZE(TestRec);
Status := BTRV(0, PosBlock, TestRec, TestRecLen, FileName, -1);
IF Status <> 0 THEN
WrStr('Error Opening File Status - ');
WrInt(Status,0);
HALT;
END;
FOR x := 1 TO 10 DO
TestRec.KeyVal := x * 10;
TestRec.Name := 'Test';
Status := BTRV(2, PosBlock, TestRec, TestRecLen, FileName, 0);
IF Status <> 0 THEN
WrStr('Error Adding Record ');
WrCard(x,0);
WrStr(' Status - ');
WrInt(Status,0);
HALT;
END;
END;
Status := BTRV(12, PosBlock, TestRec, TestRecLen, FileName, 0);
WHILE Status = 0 DO
WrCard(TestRec.KeyVal,0);
WrStr(TestRec.Name);
WrLn;
Status := BTRV(6, PosBlock, TestRec, TestRecLen, FileName, 0);
END;
Status := BTRV(1, PosBlock, TestRec, TestRecLen, FileName, 0);
END Test2.

  3 Responses to “Category : Modula II Source Code
Archive   : JPIBTRV.ZIP
Filename : TEST2.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/