tldm-universe/Ardent/UV/APP.PROGS/DC.OPENS

189 lines
6.5 KiB
Plaintext
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
subroutine DC.OPENS( do.reconvert, proceed )
*******************************************************************************
*
* Convert dictionary item(s) from Pick to Uni*Verse format:
* open all necessary files
*
* 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/22/98 23801 SAP Change company name to Ardent.
* 10/14/98 23801 SAP Change copyrights.
* 07/25/88 - - Maintenence log purged at 5.2.1, see release 5.1.10.
*
*******************************************************************************
*
* The basis for this Pick-to-Uni*Verse dictionary converter was a
* Microdata-to-Prime converter written by J. Michael Cannady and
* Thomas J. Rauschenbach of Fulcrum Computer Group, Inc. Ardent
* was granted permission to use that code by Infocel, Inc., a successor
* of Fulcrum.
*
*******************************************************************************
*
* Open the files for dictionary conversion.
*
* Arguments:
* do.reconvert - If "false", and both Pick and Uni*Verse
* dictionaries exist, this program alerts
* the user and requests permission to reconvert.
* If "true", the program (re)converts regardless.
*
* proceed - Returned "true" if all files opened, "false"
* otherwise.
*
* The calling program must set the FILE string to the name of the
* dictionary being converted.
*
************************************************************************
*
$options DEFAULT
$include UNIVERSE.INCLUDE DC.COMM.DECL
$include UNIVERSE.INCLUDE FILENAMES.H
*
equ true to 1 ; equ false to 0
*
********************************************************************
*
* Insure that PDICT FILE (P_FILE) holds the Pick dictionary items
* and DICT FILE (D_FILE) is open to hold the converted items.
*
********************************************************************
*
*
maintain.pick.prompt = false
no.ufv = false
no.pfv = false
NO.ERR = false
NO.UCODES = false
*
open "", "&SAVEDLISTS&" to EFV else NO.ERR = true
openpath UV.APP.PROGS to UCODE.FV else NO.UCODES = true
*
open "DICT", FILE to UFV then
u.file.type = status()
u.file.mod = inmat()
end else
no.ufv = true
end
*
open "PDICT", FILE to PFV then
p.file.type = status()
p.file.mod = inmat()
end else
no.pfv = true
end
*
errmsg1 = "Dictionary converter halting."
*
readv create.syntax from VOC, "CREATE.FILE", 5 else create.syntax = ""
*
proceed = true
begin case
case no.ufv and no.pfv
call @DC.MESSAGE( "Neither DICT " : FILE : " nor PDICT ": FILE : " can be opened.", errmsg1 )
proceed = false
return
case no.ufv = false and no.pfv
*
* << The Pick dictionary exists as DICT FILE. We must >>
* << create a PDICT FILE, move the dictionary items to it, >>
* << and clear DICT FILE, before converting the items. >>
*
maintain.pick.prompt = true
if create.syntax = "PICK" then
execute "CREATE.FILE PDICT " : FILE : " " : u.file.mod : ",4," : u.file.type
end else
execute "CREATE.FILE PDICT " : FILE : " " : u.file.type : " " : u.file.mod
end
open "PDICT", FILE to PFV else
call @DC.MESSAGE( "PDICT " : FILE : " cannot be opened.", errmsg1 )
proceed = false
return
end
select UFV to 2
eof = false
loop
readnext ID from 2 else eof = true
until eof do
read ITEM from UFV, ID then
write ITEM on PFV, ID
end else
call @DC.MESSAGE( "Unable to read SELECTed item ": ID : " from DICT " : FILE, "" )
end
repeat
clearfile UFV
*
case no.ufv and no.pfv = false
*
* << The Pick dictionary exists as PDICT FILE. We must >>
* << create an empty DICT FILE prior to converting the >>
* << dictionary items. >>
*
maintain.pick.prompt = true
if create.syntax = "PICK" then
execute "CREATE.FILE DICT " : FILE : " " : p.file.mod : ",4," : p.file.type
end else
execute "CREATE.FILE DICT " : FILE : " " : p.file.type : " " : p.file.mod
end
open "DICT", FILE to UFV else
call @DC.MESSAGE( "Cannot open DICT " : FILE, errmsg1 )
proceed = false
return
end
*
case 1
*
* << Both PDICT FILE and DICT FILE exist. Prompt for the >>
* << user's OK for converting PDICT FILE items. >>
* << Do not clearfile DICT. >>
*
if not( do.reconvert ) then
print "DICT ": FILE : " already exists. Reconvert (Y/N) ":
input ans
if ans[ 1, 1 ] <> "y" and ans[ 1, 1 ] <> "Y" then
proceed = false
end
end
*
end case
gosub 600; * Find out source machine
return
*
*
******************************************************************************
* S U B R O U T I N E S
******************************************************************************
*
**************************************************
600
* Find out what machine the dictionary came from.
**************************************************
*
if SOURCE.MACHINE <> "M" and SOURCE.MACHINE <> "O" then
readv SOURCE.MACHINE from PFV, "&PICK.SOURCE.MACHINE&", 1 else
loop
until SOURCE.MACHINE = "M" or SOURCE.MACHINE = "O" do
print "Is this dictionary in Microdata format or Other ":
print "(M/O) ":
input SOURCE.MACHINE
repeat
end
end
writev SOURCE.MACHINE on PFV, "&PICK.SOURCE.MACHINE&", 1
return
end