******************************************************************************** * * Setup this account as a demonstration account * * 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/17/89 5716 GPS Replace /u1/uv/sample by UV.SAMPLE * 10/04/88 5486 fix syntax error * 07/25/88 - - Maintenence log purged at 5.2.1, see release 5.1.10. * ******************************************************************************* $OPTIONS DEFAULT $INCLUDE UNIVERSE.INCLUDE FILENAMES.H ******************************************************************************* * * * To set up an account for demonstration purposes, one must create * the files INVENTORY, CUSTOMERS, and ORDERS. * * This program calls "updaccount" to insure that the user's VOC * contains consistent entries; any extra entries created by the user * are left intact. It then attempts to open and clear the files * if they are files from a previous demo; if they not files from a * previous demo, a warning is printed and the user is asked if he * would like to proceed. If they cannot be opened, it creates them. * It next copies all entries from INIT.INVENTORY, INIT.CUSTOMERS, * INIT.ORDERS, D_INIT.INVENTORY, D_INIT.CUSTOMERS and D_INIT.ORDERS * (which reside in the sample directory) into the local files. * Finally, it attempts to open the ACCOUNTS file; if it can, it prompts * the users to delete the file (since users must create it * as part of the demo). * ************************************************************************ * EQU TRUE TO 1, FALSE TO 0 ERRMSG = " Consult your system administrator." * * * Clear the screen, announce our intentions, and get the * user's go-ahead. * EXECUTE "CLR" PROMPT "?" PRINT @( 0, 4 ):"INITIALIZE.DEMO" PRINT @( 0, 6 ):"This program updates your VOC and restores demo ": PRINT "files to their initial state." PRINT "Continue (Y/N) ": INPUT ANS IF ANS <> "y" AND ANS <> "Y" THEN STOP PRINT; PRINT * * * Update the user's VOC. * EXECUTE "UPDATE.ACCOUNT" * * * Open both portions of the INIT.files. If they won't open, * we have no option but to stop. * Now open and clear both portions of the accounts files. * If they won't open, create them. Then copy in the entries from * the INIT.files. * PRINT PRINT "Initializing INVENTORY file." OPENPATH UV.SAMPLE:"/INIT.INVN" TO FVINIT ELSE STOP "Unable to open 'INIT.INVN'.":ERRMSG END * * * determine what CREATE.FILE syntax to use * OPEN "", "VOC" TO VOC ELSE STOP "Unable to open 'VOC'.":ERRMSG END READV CREATE.SYNTAX FROM VOC, "CREATE.FILE" , 5 ELSE CREATE.SYNTAX = "" * * OPEN "", "INVENTORY" TO FVLOCAL THEN READV TYPE.DESC FROM VOC, "INVENTORY" , 1 ELSE STOP "Unable to open 'VOC'.":ERRMSG END IF TYPE.DESC <> "F Demo File " THEN PRINT "A file with the name INVENTORY exists" PRINT "Continue (Y/N) ": INPUT ANS IF ANS <> "y" AND ANS <> "Y" THEN STOP PRINT END END ELSE IF CREATE.SYNTAX = "PICK" THEN EXECUTE "CREATE.FILE DATA INVENTORY 2,2,2 Demo File" END ELSE EXECUTE "CREATE.FILE DATA INVENTORY 2 2 2 Demo File" END OPEN "", "INVENTORY" TO FVLOCAL ELSE STOP "STOP 1" END EXECUTE "CLEAR.FILE INVENTORY" GOSUB 100; * Copy from the INIT.file to the local file * * OPENPATH UV.SAMPLE:"/D_INIT.INVN" TO FVINIT ELSE STOP "Unable to open 'DICT INIT.INVN'.":ERRMSG END OPEN "DICT", "INVENTORY" TO FVLOCAL ELSE IF CREATE.SYNTAX = "PICK" THEN EXECUTE "CREATE.FILE DICT INVENTORY 1,2,3 Demo File" END ELSE EXECUTE "CREATE.FILE DICT INVENTORY 3 1 2 Demo File" END OPEN "DICT", "INVENTORY" TO FVLOCAL ELSE STOP "STOP 2" END EXECUTE "CLEAR.FILE DICT INVENTORY" GOSUB 100; * Copy from the INIT.file to the local file PRINT PRINT "Compiling dictionary part of INVENTORY." PRINT EXECUTE "CD INVENTORY" * * PRINT PRINT "Initializing CUSTOMERS file." OPENPATH UV.SAMPLE:"/INIT.CUST" TO FVINIT ELSE STOP "Unable to open 'INIT.CUST'.":ERRMSG END * * OPEN "", "CUSTOMERS" TO FVLOCAL THEN READV TYPE.DESC FROM VOC, "CUSTOMERS" , 1 ELSE STOP "Unable to open 'VOC'.":ERRMSG END IF TYPE.DESC <> "F Demo File " THEN PRINT "A file with the name CUSTOMERS exists" PRINT "Continue (Y/N) ": INPUT ANS IF ANS <> "y" AND ANS <> "Y" THEN STOP PRINT END END ELSE IF CREATE.SYNTAX = "PICK" THEN EXECUTE "CREATE.FILE DATA CUSTOMERS 2,2,2 Demo File" END ELSE EXECUTE "CREATE.FILE DATA CUSTOMERS 2 2 2 Demo File" END OPEN "", "CUSTOMERS" TO FVLOCAL ELSE STOP "STOP 3" END EXECUTE "CLEAR.FILE CUSTOMERS" GOSUB 100; * Copy from the INIT.file to the local file * * OPENPATH UV.SAMPLE:"/D_INIT.CUST" TO FVINIT ELSE STOP "Unable to open 'DICT INIT.CUST'.":ERRMSG END OPEN "DICT", "CUSTOMERS" TO FVLOCAL ELSE IF CREATE.SYNTAX = "PICK" THEN EXECUTE "CREATE.FILE DICT CUSTOMERS 1,2,3 Demo File" END ELSE EXECUTE "CREATE.FILE DICT CUSTOMERS 3 1 2 Demo File" END OPEN "DICT", "CUSTOMERS" TO FVLOCAL ELSE STOP "STOP 4" END EXECUTE "CLEAR.FILE DICT CUSTOMERS" GOSUB 100; * Copy from the INIT.file to the local file PRINT PRINT "Compiling dictionary part of CUSTOMERS." PRINT EXECUTE "CD CUSTOMERS" * * PRINT PRINT "Initializing ORDERS file." OPENPATH UV.SAMPLE:"/INIT.ORDR" TO FVINIT ELSE STOP "Unable to open 'INIT.ORDR'.":ERRMSG END * * OPEN "", "ORDERS" TO FVLOCAL THEN READV TYPE.DESC FROM VOC, "ORDERS" , 1 ELSE STOP "Unable to open 'VOC'.":ERRMSG END IF TYPE.DESC <> "F Demo File " THEN PRINT "A file with the name ORDERS exists" PRINT "Continue (Y/N) ": INPUT ANS IF ANS <> "y" AND ANS <> "Y" THEN STOP PRINT END END ELSE IF CREATE.SYNTAX = "PICK" THEN EXECUTE "CREATE.FILE DATA ORDERS 2,2,2 Demo File" END ELSE EXECUTE "CREATE.FILE DATA ORDERS 2 2 2 Demo File" END OPEN "", "ORDERS" TO FVLOCAL ELSE STOP "STOP 5" END EXECUTE "CLEAR.FILE ORDERS" GOSUB 100; * Copy from the INIT.file to the local file * * OPENPATH UV.SAMPLE:"/D_INIT.ORDR" TO FVINIT ELSE STOP "Unable to open 'DICT INIT.ORDR'.":ERRMSG END OPEN "DICT", "ORDERS" TO FVLOCAL ELSE IF CREATE.SYNTAX = "PICK" THEN EXECUTE "CREATE.FILE DICT ORDERS 1,2,3 Demo File" END ELSE EXECUTE "CREATE.FILE DICT ORDERS 3 1 2 Demo File" END OPEN "DICT", "ORDERS" TO FVLOCAL ELSE STOP "STOP 6" END EXECUTE "CLEAR.FILE DICT ORDERS" GOSUB 100; * Copy from the INIT.file to the local file PRINT PRINT "Compiling dictionary part of ORDERS" PRINT EXECUTE "CD ORDERS" * * * * Now open the ACCOUNTS file. If it won't open, all is right with the * world. If it does open, delete it. * PRINT PRINT "Deleting demo ACCOUNTS file." OPEN "", "ACCOUNTS" TO FVLOCAL THEN READV TYPE.DESC FROM VOC, "ACCOUNTS" , 1 ELSE STOP "Unable to open 'VOC'.":ERRMSG END IF TYPE.DESC <> "F Demo File " THEN PRINT "A file with the name ACCOUNTS exists" PRINT "Continue (Y/N) ": INPUT ANS IF ANS <> "y" AND ANS <> "Y" THEN STOP PRINT END EXECUTE "DELETE.FILE ACCOUNTS" END * * PRINT PRINT PRINT "Initialization complete." PRINT PRINT STOP * ****************************************************************************** * S U B R O U T I N E S ****************************************************************************** * 100 * << Copy the items from the INIT.file to the local file. >> * SELECT FVINIT EOF = FALSE LOOP READNEXT ID ELSE EOF = TRUE UNTIL EOF DO READ REC FROM FVINIT, ID THEN WRITE REC ON FVLOCAL, ID else NULL REPEAT RETURN * * END