Using MAKEACCOUNT_SUB (Functions/Subroutines/Programs)

MAKEACCOUNT_SUB

MAKEACCOUNT_SUB( accountName, location, newAccountList,

options )

Using MAKEACCOUNT_SUB

Creates a new application (account). As part of this process, MAKEACCOUNT_SUB accomplishes these tasks:

Creates a new subdirectory, if necessary.
Creates and populates a new **VOC **and** DICT.VOC **table for the new application.
Creates additional new tables defined in a system control record (//newAccountList//).
Adds a new application entry in the **SYSENV **table.
Adds a new environment entry in the **SYSENV **table for the new application, based on **DEFAULT_ENVIRONMENT**.

You do not need to be on the SYSPROG application to create a new application, but the SYSENV table must be attached.

+ MAKEACCOUNT_SUB does not put a password on the new application. To add a password, use the system subroutine SECUREACCOUNT_SUB or the TCL SETPASSWORD command.

accountName

The name of the new application to create. The name must follow standard Advanced Revelation naming conventions, and cannot be that of an entry in the SYSENV table.

location

The name of the path or volume on which the tables for the new application should be created.

If location is not null, MAKEACCOUNT_SUB initially searches for a volume definition that matches the value in location. (For more information about creating volumes, see Chapter 27, "Managing Volumes", in the Advanced Revelation User's Guide.) If you use a volume definition, it must use Linear Hash (RTP57) as its filing system, and cannot include a volume MFS.

If the value in location is not the name of a volume definition, the subroutine creates a new subdirectory of that name and creates the new tables there. When creating a new subdirectory, MAKEACCOUNT_SUB truncates the location name to the DOS limit of 12 characters (including the extension).

If location is null, MAKEACCOUNT_SUB defaults to using accountName as the name of a new subdirectory.

newAccountList

The name of a row in the SYSENV table containing the list of tables to create in the new application, and optionally, the names of rows to copy into them from existing tables of the same name. If no newAccountList is provided, the default row in SYSENV is NEWAPPLICATIONLIST.

If you want to create your own newAccountList record, follow these rules. List one new table per field. (Dictionaries must be listed separately.) The names of rows to copy from existing tables are listed as values in the same field, starting with value 2. Use the wildcard "*" to copy all the rows from an existing table. If you do not include VOC and DICT.VOC tables in your newAccountList record, the subroutine creates them anyway, and copies all rows from the current versions of these tables. Be sure to list all the tables you require (see NEWAPPLICATIONLIST for listing of the usual tables), because MAKEACCOUNT_SUB will create only the tables you list.

To install an MFS on the new table, add it after the table name, separating it from the table name with a subvalue mark (@SVM). You cannot include SI.MFS (the indexing MFS) when creating a new table.

For example:

MYTABLE2*

copies all rows from the currently attached MYTABLE into the new MYTABLE in the new application.

MYTABLEnMY.MFS

creates MYTABLE in the new application and installs MY.MFS on it.

MYTABLEnMY.MFS2IMPORTANTROW

creates MYTABLE in the new application, installing MY.MFS. Copies only the row IMPORTANTROW from the currently attached MYTABLE to the new table.

options

OptionMeaning
S (Suppress messages) Do not display in the status line the name of the table being created.

Values returned

The return status of MAKEACCOUNT_SUB is indicated by the system variable @file.error. Multiple errors are delimited with record marks (@RM). The error number appears in field 1 of each @file.error "record", and additional information about the error appears in field 2. Possible errors are:

ErrorMeaning Add'l Info.
W526 An application name is required.
401 Table is not available (typically SYSENV). <2> table name
R120 The application already exists. <2> application name
S101 Location must use Linear Hash as its filing system. <2> location
S102 Unable to create the subdirectory for location. <2> location
W544 Unable to find the newAccountList in the SYSENV table. <2,1> newAccountList

<2,2> SYSENV
W500 Problem creating the new volume in location; mismatch between table and volume.<2> MAKETABLE_SUB

Under some circumstances, MAKEACCOUNT_SUB sets these values for status( ):

status( )Meaning
0 Process was successful.
1 An error occurred.

Correct use of MAKEACCOUNT_SUB

equ null$ to ""

application = "CUST_DB"

location = "D:\CUSTDATA"

filelist = "MY_APPTABLES" /* searches for this list in SYSENV */

options = ""

call makeaccount_sub( application, location, filelist, options )

if @file.error ne null$ then

text = "Sorry, the application"

text←1> = "%1%"

text←1> = "could not be created."

(continued)

begin case

case @file.error<1> = "R120"

text←1> = "That application already exists."

case @file.error<1> = "S102"

text←1> = "The %2% location isn't valid."

end case

parms = application : @fm : location

call msg( text, "", "", parms )

end

stop

  • kb/kb_articles/kb0062.txt
  • Last modified: 2024/01/30 13:36
  • by 127.0.0.1