Category : Modula II Source Code
Archive   : HISTRPT.ZIP
Filename : HISTRPT1.MOD

 
Output of file : HISTRPT1.MOD contained in archive : HISTRPT.ZIP
MODULE HISTRPT1;

FROM NFIO IMPORT File,Read,Write,Open,Seek,Close,Size,Create,AssignBuffer,
Read,Write;
FROM IO IMPORT WrStr,WrLngCard,WrLn,WrLngReal,WrCard,KeyPressed,RdKey;
FROM Str IMPORT FixRealToStr,Compare,Copy;
FROM Window IMPORT Clear,GotoXY,CursorOff,CursorOn;
FROM MCSTOCK IMPORT MakeStkIndex,TSearch,StockType,StockIndex,Str16,
SN,SFILE,SNX,STOCK,Str51,DateTyp1;
FROM MCHIST IMPORT MakeHistIndex,HSearch,HistType,HistIndex,
HN,HFILE,HNX,HIST;
FROM GOODIES IMPORT ExecCmd,IsDigit;

TYPE
TempFileType = RECORD
ITEM : ARRAY[0..15] OF CHAR;
DESC : ARRAY[0..50] OF CHAR;
SALES : LONGREAL;
USAGE : LONGREAL;
STDCOST : LONGREAL;
LASTDATEMOVE : ARRAY[0..7] OF CHAR;
END;
VAR
delrecord : BYTE;
TFILE : File;
TEMP : TempFileType;
i : CARDINAL;
nread : CARDINAL;
temp : ARRAY[0..12] OF CHAR;
ok : BOOLEAN;
j : LONGCARD;
ch : CHAR;
p : LONGCARD;
SAL,
USE : LONGREAL;
COUNTER : CARDINAL;
sbuff : ARRAY[0..20000] OF CHAR;
ibuff : ARRAY[0..20000] OF CHAR;
buffsize,
filesize,
recs,lrec : LONGCARD;
error : CARDINAL;

BEGIN

delrecord := 0FFH;

SFILE := Open('C:\REPORTS\ICSTOCK.00');
SN := Create('C:\REPORTS\ICSTOCK.NDX');
Clear;
MakeStkIndex;
Close(SN);
Clear;

ExecCmd('C:\UTILITY\QSORT.EXE C:\REPORTS\ICSTOCK.NDX C:\REPORTS\ICSTOCK.SRT /F105 /1:16');

SFILE := Open('C:\REPORTS\ICSTOCK.00');
HFILE := Open('C:\REPORTS\ICHIST.00');
SN := Open('C:\REPORTS\ICSTOCK.SRT');
TFILE := Create('C:\REPORTS\TEMPFILE.DAT');
(*
AssignBuffer(TFILE,ibuff);
AssignBuffer(SN,sbuff);

*)
buffsize := SIZE(HIST);
filesize := Size(HFILE);
recs := filesize DIV buffsize;
lrec := recs - 1;
Clear;
WrStr('SIZE OF HIST STRUCTURE');
WrLngCard(filesize,9);
WrLn;
WrStr('RECORDS TO PROCESS ');
WrLngCard(lrec,9);
GotoXY(35,11);
WrStr('PROCESSING RECORD');
COUNTER := 0;
CursorOff;
FOR j := 1 TO lrec DO
Seek(HFILE,j*buffsize);
GotoXY(38,13);
WrLngCard(j,5);

nread := Read(HFILE,HIST,VAL(CARDINAL,buffsize));
IF (HIST.status # delrecord) AND (IsDigit(HIST.item[0])) OR (HIST.item[0] = 'B') THEN
GotoXY(38,14);
WrStr(HIST.item);
WrStr(' ');

p := TSearch(HIST.item);

IF p # MAX(LONGCARD) THEN
Seek(SN,p);
nread := Read(SN,SNX,SIZE(SNX));

Copy(TEMP.ITEM,SNX.item);
Copy(TEMP.DESC,SNX.desc);
TEMP.STDCOST := SNX.stdc;
Copy(TEMP.LASTDATEMOVE,SNX.lud);
SAL := 0.0;
USE := 0.0;
FOR i := 0 TO 11 DO
SAL := SAL + HIST.info[i][0];
USE := USE + HIST.info[i][1];
END; (* FOR i LOOP *)
TEMP.SALES := SAL;
TEMP.USAGE := USE;
error := Write(TFILE,TEMP,SIZE(TEMP));

ELSE
TEMP.STDCOST := 0.0;
TEMP.SALES := 0.0;
TEMP.USAGE := 0.0;
Copy(TEMP.ITEM,HIST.item);
Copy(TEMP.DESC,'Description Unknown');
Copy(TEMP.LASTDATEMOVE,'01/01/80');
error := Write(TFILE,TEMP,SIZE(TEMP));

END; (* IF p *)

END; (* IF COMPARE *)
END; (* FOR j LOOP *)
Close(HFILE);
Close(SFILE);
Close(SN);
Close(TFILE);
CursorOn;

END HISTRPT1.


  3 Responses to “Category : Modula II Source Code
Archive   : HISTRPT.ZIP
Filename : HISTRPT1.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/