Preparing the Database

GT.M databases consist of one or more UNIX files. Most database files have a UNIX file structure externally and a GT.M Database Structure (GDS) internally. Management of the GDS files by the GT.M run-time system assures high performance and integrity. GT.M database files are coordinated by a Global Directory. The Global Directory identifies which global names belong in which files, and specifies the creation characteristics for each file. To specify access to a database, each M process must define the gtmgbldir environment variable to point to the associated Global Directory.

To define and maintain a Global Directory, use the Global Directory Editor (GDE) utility. The GDE utility automatically upgrades existing global directories to the current format. The MUPIP command CREATE uses the characteristics as defined in the Global Directory to create the associated database. In a production environment, the system manager typically maintains Global Directories.

For more information on GDE and MUPIP refer to the "Global Directory Editor" and "MUPIP" chapters in the GT.M Administration and Operations Guide.

Example:

This example is a sequence of events that illustrate steps you might typically perform in creating a new global directory, in our example PAYROLL.GLD. To assist you in following the sequence, each actual step appears in typewriter font, as you might see on your terminal screen, followed by an explanation in normal text font.

$ ls payroll.gld
payroll.gld not found

The ls command verifies that there are no existing files with the name payroll.gld.

$ gtmgbldir=payroll.gld 
$ export gtmgbldir

This establishes the current value of the environment variable gtmgbldir as payroll.gld. GT.M uses gtmgbldir to identify the current Global Directory. When defined at the shell prompt, gtmgbldir maintains the defined value only for the current login session. The next time you log into UNIX, you must again define the value of gtmgbldir as payroll.gld to use it as the current Global Directory.

This example defines gtmgbldir without a full pathname. The environment variable points to the payroll.gld file in the current working directory. Therefore if the default directory changes, GT.M attempts to locate the Global Directory in the new default directory and cannot use the original file. If you intend for the Global Directory to consistently point to this file, even if the default directory changes, use a full file-specification for gtmgbldir.

$ /usr/lib/fis-gtm/V6.0-0001_x86/gtm
GTM>do ^GDE
%GDE-I-LOADGD, Loading Global Directory file 
        /home/jdoe/.fis-gtm/V6.0-001_x86/g/payroll.gld
%GDE-I-VERIFY, Verification OK
GDE>

This invokes the Global Directory Editor by entering GDE from the GT.M prompt and produces an informational message.

GDE> show -all
                               *** TEMPLATES ***
                                             Def   Rec   Key Null       Standard
 Region                                     Coll  Size  Size Subs       NullColl  Journaling
 --------------------------------------------------------------------------------------------
 <default>                                     0  4080   255 NEVER      Y         Y
                  Jnl File (def ext: .mjl)  Before  Buff      Alloc Exten
 ------------------------------------------------------------------------------
 <default>        <based on DB file-spec>   Y        128       2048  2048
 Segment          Active              Acc Typ Block      Alloc Exten Options
 ------------------------------------------------------------------------------
 <default>          *                 BG  DYN  4096       5000 10000 GLOB =1000
                                                                     LOCK = 40
                                                                     RES  =   0
                                                                     ENCR = OFF
 <default>                            MM  DYN  4096       5000 10000 DEFER
                                                                     LOCK = 40
         *** NAMES ***
 Global                             Region
 ------------------------------------------------------------------------------
 *                                  DEFAULT
                                *** REGIONS ***
                                 Dynamic                          Def    Rec   Key Null       Standard
 Region                          Segment                         Coll   Size  Size Subs       NullColl  Journaling
 ------------------------------------------------------------------------------------------------------------------
 DEFAULT                         DEFAULT                            0   4080   255 NEVER      Y         Y
                          *** JOURNALING INFORMATION ***
 Region                          Jnl File (def ext: .mjl)  Before Buff      Alloc Exten
 ---------------------------------------------------------------------------------------
 DEFAULT                         $gtmdir/$gtmver/g/payroll.mjl
                                                           Y       128       2048  2048
                                *** SEGMENTS ***
 Segment                         File (def ext: .dat)Acc Typ Block      Alloc Exten Options
 -------------------------------------------------------------------------------------------
 DEFAULT                         $gtmdir/$gtmver/g/dayroll.dat
                                                     BG  DYN  4096       5000 10000 GLOB=1000
                                                                                    LOCK=  40
                                                                                    RES =   0
                                                                                    ENCR=OFF
                                  *** MAP ***
   -  -  -  -  -  -  -  -  -  - Names -  -  - -  -  -  -  -  -  -
 From                            Up to                            Region / Segment / File(def ext: .dat)
 -----------------------------------------------------------------------------------------------------------------------------------
 %                               ...                              REG = DEFAULT
                                                                  SEG = DEFAULT
                                                                  FILE = $gtmdir/$gtmver/g/payroll.dat
 LOCAL LOCKS                                                      REG = DEFAULT
                                                                  SEG = DEFAULT
                                                                  FILE = $gtmdir/$gtmver/g/payroll.dat

The GDE SHOW command displays the default Global Directory.

GDE> change -segment default -allocation=1000 file=payroll.dat

The GDE CHANGE command sets the database file name to payroll.dat, and specifies a file size of 1000 blocks (of 1024 bytes).

GDE>exit
%GDE-I-VERIFY, Verification OK
%GDE-I-GDCREATE, Creating Global Directory file /usr/lib/fis-gtm/V6.0-001_x86/payroll.gld
%GDE-I-GDEIS, Global Directory

The GDE EXIT command terminates GDE. The Global Directory Editor creates a default Global Directory and displays a confirmation message.

$ ls payroll.gld
payroll.gld

This ls command shows the new Global Directory has been created.

In the simplest case, running the Global Directory Editor and immediately EXITing creates a Global Directory with a default single file database.

To create the database file payroll.dat, use the GT.M MUPIP CREATE utility.

Example:

$ mupip create
Created file payroll.dat

The MUPIP CREATE command generates the database file. Notice that the MUPIP CREATE syntax does not include the file name. MUPIP uses the environment variable gtmgbldir to find the Global Directory payroll.dat and obtains the file name from that Global Directory. MUPIP then checks to make sure that payroll.dat does not already exist and creates payroll.dat with the characteristics described in payroll.dat.

Example:

$ mupip load payroll.gld
GT.M MUPIP EXTRACT
02-MAY-2013  22:21:37 ZWR
Beginning LOAD at record number: 3
LOAD TOTAL                Key Cnt: 279  Max Subsc Len: 28  Max Data Len: 222
Last LOAD record number: 281

This uses the MUPIP LOAD command to load a sequential file into the database.

Because MUPIP uses the environment variable gtmgbldir to locate a Global Directory, which identifies the database file(s), the LOAD command does not require any information about the target database. With few exceptions, the GT.M utilities work in the same way.