Area: Quik_Bas Msg: #305 Date: 02-06-93 13:06 (Public) From: Coridon Henshaw To: All Subject: Raw ECHOLIST data files -
Hello All! Here's a little project that I've been working on for some time: ===Chop=== 'NAME: ELD2ISAM.BAS 'DESC: Converts ELIST raw datafiles to ISAM format. 'CMNT: Sorry, no comments this time ;) 'REQU: BASIC PDS with ISAM support loaded. 'FROM: Coridon Henshaw @ 1:250/820 DECLARE FUNCTION Exist% (File$) DECLARE FUNCTION BreakString% (OutArray() AS STRING, InString$) DEFINT A-Z TYPE ModeratorType FirstName AS STRING * 15 Lastname AS STRING * 15 Zone AS INTEGER Net AS INTEGER Node AS INTEGER Point AS INTEGER END TYPE TYPE ElistDataType EchoTag AS STRING * 20 BriefDesc AS STRING * 60 Moderator AS ModeratorType DescIndex AS LONG RangeIndex AS LONG GateIndex AS LONG Volume AS STRING * 10 LastUpdate AS STRING * 10 SysopOnly AS STRING * 1 Member AS STRING * 1 END TYPE COLOR 14, 1 CLS PRINT "Elist raw data files to ISAM database converter V1.5" PRINT PRINT "Freeware by Sirrus Software" PRINT "Code is Copyright (C) 1993 Coridon Henshaw" PRINT "Noncomerical use _ONLY_" DIM ElistData AS ElistDataType DIM Fields(1 TO 21) AS STRING DIM Temp AS STRING * 4000 IF Exist("ELDESC.ITX") THEN KILL "ELDESC.ITX" IF Exist("ELRANGE.ITX") THEN KILL "ELRANGE.ITX" IF Exist("ELGATE.ITX") THEN KILL "ELGATE.ITX" IF Exist("ELDATA.IDX") THEN KILL "ELDATA.IDX" OPEN "ELAREA.CSV" FOR INPUT AS #1 OPEN "ELDESC.ITX" FOR BINARY AS #2 OPEN "ELRANGE.ITX" FOR BINARY AS #3 OPEN "ELGATE.ITX" FOR BINARY AS #4 OPEN "ELDATA.IDX" FOR ISAM ElistDataType "NULL" AS #6 BEGINTRANS DO ERASE Fields LINE INPUT #1, Temp IF BreakString(Fields(), Temp) = 1 THEN ElistData.EchoTag = Fields(1) ElistData.BriefDesc = Fields(2) ElistData.Moderator.FirstName = Fields(3) ElistData.Moderator.Lastname = Fields(4) ElistData.Moderator.Zone = VAL(Fields(5)) ElistData.Moderator.Net = VAL(Fields(6)) ElistData.Moderator.Node = VAL(Fields(7)) ElistData.Moderator.Point = VAL(Fields(8)) ElistData.DescIndex = LOC(2) Length = LEN(Fields(9)) PUT #2, , Length PUT #2, , Fields(9) ElistData.RangeIndex = LOC(3) Length = LEN(Fields(10)) PUT #3, , Length PUT #3, , Fields(10) ElistData.GateIndex = LOC(4) Length = LEN(Fields(11)) PUT #4, , Length PUT #4, , Fields(11) ' 'Total nodes field - Not implemented. ' ElistData.Volume = Fields(13) ElistData.LastUpdate = Fields(14) ' 'Unknown field ' ' 'Perminent moderator? (Unknown) ' ElistData.SysopOnly = Fields(17) ElistData.Member = Fields(18) ' 'Rulefile - not implemented ' LOCATE 7, 1 PRINT "Echo: "; ElistData.EchoTag; INSERT #6, ElistData ELSE PRINT PRINT "Echo "; Fields(1); " is not standard format; rejected" END IF LOOP UNTIL EOF(1) OR INKEY$ <> "" CREATEINDEX #6, "echotag", 1, "EchoTag" CREATEINDEX #6, "volume", 0, "Volume" CREATEINDEX #6, "lastupd", 0, "LastUpdate" CREATEINDEX #6, "restrict", 0, "SysopOnly", "Member" COMMITTRANS PRINT PRINT "Done conversion" FUNCTION BreakString% (OutArray() AS STRING, PassedString AS STRING) ON LOCAL ERROR GOTO HandleError DIM InString AS STRING DIM Char AS STRING * 1 InString = RTRIM$(PassedString) OutArrayPointer = 1 InStrLength = LEN(InString) FOR Count& = 1 TO InStrLength Char = MID$(InString, Count&, 1) SELECT CASE Char CASE CHR$(34) IF MID$(InString, Count& + 1, 1) <> CHR$(34) THEN IF QuotedLevel = 1 THEN QuotedLevel = 0 ELSE QuotedLevel = 1 END IF END IF CASE "," IF QuotedLevel = 0 THEN IF OutArrayPointer < 21 THEN OutArrayPointer =_ OutArrayPointer + 1 ELSE ERROR 9 END IF END IF CASE ELSE OutArray(OutArrayPointer) = OutArray(OutArrayPointer)_ + Char END SELECT NEXT BreakString = 1 EXIT FUNCTION HandleError: BreakString = 0 RESUME ExitFunction ExitFunction: END FUNCTION FUNCTION Exist (File$) IF DIR$(File$) = UCASE$(File$) THEN Exist = 1 END FUNCTION ===Chop=== END ELD2ISAM.BAS And some sample code to use the ISAM database: ===Chop=== 'NAME: ECHOINFO.BAS 'CMNT: Code is in the public domain 'FROM: Coridon Henshaw (1:250/820@Fidonet.org) DECLARE FUNCTION LoadLTHString$ (Filenumber%, Offset&) DEFINT A-Z TYPE ModeratorType FirstName AS STRING * 15 Lastname AS STRING * 15 Zone AS INTEGER Net AS INTEGER Node AS INTEGER Point AS INTEGER END TYPE TYPE ElistDataType EchoTag AS STRING * 20 BriefDesc AS STRING * 60 Moderator AS ModeratorType DescIndex AS LONG RangeIndex AS LONG GateIndex AS LONG Volume AS STRING * 10 -end-
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET