90 lines
2.6 KiB
Plaintext
90 lines
2.6 KiB
Plaintext
|
******************************************************************************
|
||
|
*
|
||
|
* UNLOAD.FILE.B - Unloads a hashed file to loadfile format.
|
||
|
*
|
||
|
* Module %M% Version %I% Date %H%
|
||
|
*
|
||
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
||
|
* This is unpublished proprietary source code of Ardent Software Inc.
|
||
|
* The copyright notice above does not evidence any actual or intended
|
||
|
* publication of such source code.
|
||
|
*
|
||
|
*******************************************************************************
|
||
|
*
|
||
|
* Maintenence log - insert most recent change descriptions at top
|
||
|
*
|
||
|
* Date.... GTAR# WHO Description........................................
|
||
|
* 10/14/98 23801 SAP Change copyrights.
|
||
|
* 01/21/92 WLC Initial Release.
|
||
|
*******************************************************************************
|
||
|
* This BASIC program reads a hashed file and creates a .u format file
|
||
|
*
|
||
|
*
|
||
|
*
|
||
|
* get arguments (We are assuming it is invoked like "UNLOAD FOO" or
|
||
|
* "UNLOAD FOO foo.u" or "UNLOAD DICT FOO foo.u" etc.
|
||
|
sent = trim(@sentence)
|
||
|
convert " " to @AM in sent
|
||
|
dict = ""
|
||
|
infile = sent<2>
|
||
|
if infile = "DICT" then
|
||
|
dict = "DICT"
|
||
|
infile = sent<3>
|
||
|
ofile = sent<4>
|
||
|
end else
|
||
|
ofile = sent<3>
|
||
|
end
|
||
|
if ofile = "" then
|
||
|
ofile=infile
|
||
|
ofile = downcase(ofile)
|
||
|
end
|
||
|
if ofile = infile then
|
||
|
abort "Bad output filename"
|
||
|
end
|
||
|
open dict,infile to ifv else
|
||
|
print "Can't open ":dict:" ":infile
|
||
|
stop
|
||
|
end
|
||
|
openseq ofile to ofv then
|
||
|
print ofile:" already exists."
|
||
|
stop
|
||
|
end
|
||
|
sselect ifv
|
||
|
eof=0
|
||
|
loop
|
||
|
readnext key else eof = 1
|
||
|
until eof do
|
||
|
read rec from ifv,key else
|
||
|
abort "Read error, file ":infile:", key ":key
|
||
|
end
|
||
|
item=key:char(9)
|
||
|
loop
|
||
|
remove stuff from rec setting delim
|
||
|
begin case
|
||
|
* end of item
|
||
|
case delim = 0
|
||
|
item := stuff
|
||
|
* field mark
|
||
|
case delim = 2
|
||
|
item := stuff:char(10)
|
||
|
* value mark
|
||
|
case delim = 3
|
||
|
item := stuff:char(10):"/}"
|
||
|
* subvalue mark
|
||
|
case delim = 4
|
||
|
item := stuff:char(10):"/|"
|
||
|
* text mark
|
||
|
case delim = 5
|
||
|
item := stuff:char(10):"/{"
|
||
|
end case
|
||
|
while delim do
|
||
|
item := char(9)
|
||
|
repeat
|
||
|
writeseq item on ofv else
|
||
|
print "WRITESEQ failed"
|
||
|
stop
|
||
|
end
|
||
|
repeat
|
||
|
end
|
||
|
|