TRGUNLD and TRGLOAD Utilities

#### Search Results

Search

# TRGUNLD and TRGLOAD Utilities

The unload and load utilities for the Adabas triggers and stored procedures facility are part of the online Trigger Maintenance facility and are run in a Natural environment:

Utility | ... is used to
--- | ---
TRGUNLD | unload trigger definitions from the Adabas trigger file and related file-field table entries and write them to a work file.
TRGLOAD | load trigger definitions and related file-field tables from the TRGUNLD work file into the trigger file.

The work file for TRGUNLD is a Natural work file (work file 1) that is defined either

- in the batch job; or

- to the Natural environment where the unload utility is running.

The TRGUNLD work file is used as input to the TRGLOAD utility.

A report is prepared at the end of the unload or load summarizing the triggers processed.

This document covers the following topics:

- Starting a Utility

- Utility Parameters

- End of Processing Reports

- Utility Response Codes

## Starting a Utility

To invoke a utility:

- Issue the name of the utility (TRGUNLD or TRGLOAD) as a command, optionally followed by a parameter list.

  Parameters are used to limit the triggers to be processed.

  Individual parameter values must be separated by the input delimiter (ID): the default is a comma ",". The input-mode parameter IM should be set to delimiter mode IM=D.

  When executing a utility as a batch job, the batch job must log on to the SYSTRG library before executing the selected utility and its parameter list.

### TRGUNLD

If the TRGULND utility is invoked from the command line in the online system without a parameter list, the following window is presented:

    17:51:42          ***** A D A B A S TRIGGER MAINTENANCE *****       YYYY-MM-DD
    User
         |--------------------------------------------------------------------|
         | 17:51:46  **** A D A B A S TRIGGER MAINTENANCE ****   YYYY-MM-DD   |
         | -----------------  Trigger  Unload  Utility  -------------------   |
         |                                                                    |
         |       Specify the following information to identify                |
         |       the Triggers to be unloaded to Work File 1:                  |
         |                                                                    |
         |        File Name ..... ________________________________            |
         |        Field ......... ________________________________            |
         |        Pre-triggers .. ____                                        |
         |        Command Type .. __                                          |
         |        Active State .. _                                           |
         |        Trigger Type .. _                                           |
         |                                                                    |
         |       Use 'PF3' to cancel or hit  Enter' when ready                |
         |--------------------------------------------------------------------|

    Command ==> trgunld
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help        Exit  Field Trigr Admin Procs             FTRG  FDIC  Canc

Enter values for the parameters as needed to limit the trigger definitions being unloaded. Any parameters left blank assume the default values.

If no parameters are specified for TRGUNLD, all triggers on the trigger file are unloaded and the related file-field table entries as well.

### TRGLOAD

If the TRGLOAD utility is invoked from the command line in the online system without a parameter list, the following window is presented:

    18:13:43          ***** A D A B A S TRIGGER MAINTENANCE *****       YYYY-MM-DD
    User DBAU |---------------------------------------------------------|nr 105
              |                                                         |
              |  ---------------  Trigger  Load  Utility  ------------- |
              |                                                         |
              |     Specify the following information to identify       |
              |     the Triggers to be loaded from Work File 1:         |
              |                                                         |
              |        File ...... ________________________________     |
              |        Field ..... ________________________________     |
              |        Replace ... ___                                  |
              |        With FFT .. ___                                  |
              |                                                         |
              |     Use 'PF3' to cancel or hit  Enter' when ready       |
              |                                                         |
              |---------------------------------------------------------|

    Command ==> trgload
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help        Exit  Field Trigr Admin Procs             FTRG  FDIC  Canc

If no parameters are specified for TRGLOAD, all triggers and file-field table entries found on the TRGUNLD work file are loaded into the trigger file.

## Utility Parameters

### Wildcard Notation

The following "wildcard" or special character notation can be used in values specified for FILE and FIELD parameters discussed in the following sections for each utility:

Character | Example | Load triggers with file or field names...
--- | --- | ---
* | PERS* | that start with "PERS"
> | PERS> | that have a value greater than "PERS"
< | PERS< | that have a value less than "PERS"

### TRGUNLD Parameters

The following parameters are available to limit the triggers unloaded from the trigger file into the work file during TRGUNLD processing (the default value for each parameter is "*" to include all possibilities):

Parameter | Description
--- | ---
FILE |
Name of a file found in the trigger definition. Valid values are
a file name ("wildcard" notation allowed)
* | all files (the default)
FIELD |
Name of a field found in the trigger definition. Valid values are
a field name ("wildcard" notation allowed)
* | all fields (the default)
PRE |
Specifies pre-trigger or post-trigger. Valid values are
Y | pre-trigger
N | post-trigger
* | both
CMD |
Command type that causes trigger to fire. Valid values are
R | read
F | find
I | insert
U | update
D | delete
* | all command types (the default)
ACT |
State of the trigger to be processed. Valid values are
A | active
D | not active (deactivated)
* | both
TYPE |
Type of participation of trigger in user's ET logic. Valid values are
A | asynchronous
N | non-participating
P | participating
* | all participation types

### TRGUNLD Parameter Examples

    TRGUNLD FILE=EMPLOYEES

Specifying the FILE parameter limits the triggers unloaded to those defined for the specified file, in this case the EMPLOYEES file.

    TRGUNLD FILE=VEHICLES,PRE=Y,ACT=A,TYPE=N

Combining parameters further limits the triggers unloaded. In this case, only active, non-participating pre-triggers defined for the VEHICLES file are unloaded. Note that the parameters must be separated by the input delimiter as specified in the ID parameter in the Natural environment.

### TRGLOAD Parameters

The following parameters are available to limit the triggers loaded from the TRGUNLD work file to the trigger file during TRGLOAD processing:

Parameter | Description
--- | ---
FILE |
Name of a file found in the trigger definition. Valid values are
a file name ("wildcard" notation allowed)
* | all files (the default)
FIELD |
Name of a field found in the trigger definition. Valid values are
a field name ("wildcard" notation allowed)
* | all fields (the default)
FFT |
Request that the file-field table entry found on the TRGUNLD input data set be loaded with the trigger. Valid values are
Y | yes (the default)
N | no
REPLACE |
Request that a trigger definition being loaded that already exists on the database replace the old one. Valid values are
Y | yes: replace the existing definition with the new one
N | no (the default): do not replace the existing definition and return an error message

### TRGLOAD Parameter Examples

    TRGLOAD FILE=EMP*

Load into the trigger file all file-field table entries and triggers found on the TRGUNLD input work file for files starting with "EMP".

    TRGLOAD FFT=N,REPLACE=Y

Ignore any file-field table entries read from the work file. If any trigger definition read from the work file has the same specifications as an existing trigger definition, replace the existing definition with the definition from the work file.

## End of Processing Reports

### Unload Report (TRGUNLD)

A report is written out at the end of the unload process stating the number of trigger definitions and the number of file-field table entries unloaded.

#### Example

The first page of the report indicates the source file and database for unloading the triggers and summarizes the selection criteria. Following this is a list of each record being unloaded into the work file:

    18:12:00            *****  TRIGGERS UNLOAD UTILITY *****            YYYY-MM-DD
    DBAUSER
    Unloading from Trigger File     12 on Database    105
    Rec  File  Details
    ---  ----- -----------------------------------------------------------
    Unloading Pre and Post Triggers for file(s) *
    and field name(s) * for all command types

    FFT     45 ZB-FIELD (ZB,2,A)
    FFT     45 ZF-FIELD (ZF,2,A)
    FFT     45 ZZ-FIELD (ZZ,4,P)
    TRG     45 CMD=R FLD=ZB PRTY=01 PGM=RBEGIMU PRE=S TYP=P PRM=C RB=U
    GRP      4 Group Record
    FFT      4 ADDRESS-LINE (AI,20,A)
    FFT      4 AREA-CODE (AN,6,A)
    FFT      4 BIRTH (AH,6,U)
    .
    .
    .

The end of the report lists a summary count of records written to the work file. The physical work file written includes these records plus two additional records used for internal purposes.

    18:13:04            *****  TRIGGERS UNLOAD UTILITY *****            YYYY-MM-DD
     DBAUSER
     Unloading from Trigger File     12 on Database    105
     Rec  File  Details
     ---  ----- -----------------------------------------------------------
     FFT      7 NA-FIELD (NA,40,A)
     FFT      7 NT-SUPER (NT,110,A)
     FFT      7 TI-FIELD (TI,70,A)
     FFT      7 TY-FIELD (TY,10,A)
     TRG      7 CMD=R FLD=** PRTY=90 PGM=NACNN200 PRE=S TYP=A PRM=C RB=N

     Total records written to Work File 1

     File-Field Table Entries: ...    141
     Group Control Records: ......      2
     Trigger Definitions: ........     13

     Total Records: ..............    156

     ***  TRGUNLD completed successfully.  ***

The final page of the report summarizes the triggers unloaded by categories. This report is useful for cross-checking with the TRGLOAD utility.

    **** Trigger Unload Statistics ****

    Number of Triggers Unloaded by Categories

    Pre or Post :           Pre:      7
                           Post:      6

    Trigger Type:  Asynchronous:      6
                  Participating:      3
              Non-Participating:      4

    Command Type:          READ:      6
                           FIND:      0
                         INSERT:      0
                         DELETE:      2
                         UPDATE:      1
                          *ANY*:      4

    Field Criteria:       *ANY*:      4
                       Specific:      9

### Load Report (TRGLOAD)

A report is written at the end of the unload process, stating the number of trigger definitions and the number of file-field table entries loaded.

#### Example

The first page of the report indicates the target database for loading the triggers, the source database where the work file was created, and a summary of the selection criteria. Following this is a list of each record being loaded into the work file.

    20:05:05            *****  TRIGGERS LOAD UTILITY  *****           YYYY-MM-DD
    DBAUSER
    Rec  File  Details
    ---  ----- -----------------------------------------------------------

    Loading Trigger Definitions into database    106 file     14
    from data set unloaded from database    105 file     12
    created on 1999-07-26 20:04 from version  711

    FFT     50 AA-FIELD (AA,8,A)
    FFT     50 AC-FIELD (AC,20,A)
    FFT     50 AD-FIELD (AD,20,A)
    FFT     50 AE-FIELD (AE,20,A)
    FFT     50 AF-FIELD (AF,1,A)
    FFT     50 AG-FIELD (AG,1,A)
    FFT     50 AH-FIELD (AH,6,U)
    FFT     50 AI-FIELD (AI,20,A)
    FFT     50 AJ-FIELD (AJ,20,A)
    FFT     50 AK-FIELD (AK,10,A)
    .
    .
    .

The end of the report lists a summary count of records read from the work file and how they were loaded into the database.

    20:08:43            *****  TRIGGERS LOAD UTILITY  *****           YYYY-MM-DD
     DBAUSER
     Rec  File  Details
     ---  ----- -----------------------------------------------------------
     TRG      5 CMD=R FLD=AA PGM=CAROL PRE=P TYP=A PRM=C RB=N

     Total records loaded from Work File 1

     File-Field Table Entries: ...    109
     Group Control Records: ......      1
     Trigger Definitions: ........     65

     Total Records Loaded: .......    175
     Records found with errors ...      0
     Total Records Read: .........    178

     ***  TRGLOAD completed successfully.  ***

The final page of the report summarizes the triggers loaded by categories. This report is useful for cross-checking with the TRGUNLD utility.

    ******* Trigger Load Statistics *******

    Number of Triggers Loaded by Categories

    Pre or Post :           Pre:     34
                           Post:     31

    Trigger Type:  Asynchronous:     23
                  Participating:     32
              Non-Participating:     10

    Command Type:          READ:     25
                           FIND:      6
                         INSERT:     14
                         DELETE:      2
                         UPDATE:      3
                          *ANY*:     15

    Field Criteria:       *ANY*:     19
                       Specific:     46

## Utility Response Codes

Code | Meaning
--- | ---
000 | Function completed successfully.
013 | Invalid file-field table entry specified. Triggers requires access to a file-field table that maps long file names to file numbers and field names to Adabas two-character field identifiers. See section File-Field Tables for more information.
016 | No trigger definition found with this criteria.
023 | Field name not found for this file. The field name specified does not exist in the file-field table for this file. See section File-Field Tables for more information.
025 | Invalid command type. See list above for valid values.
027 | No field found for this file and command type.
029 | No trigger found for this file, command, and field criteria.
039 | Natural subprogram name is invalid.
041 | Trigger type may be "A", "N", or "P" only.
042 | CALLNAT type may be "C", "E", or "N" only.
043 | Record buffer usage may be "A", "N", or "U" only.
047 | Trigger already exists with this criteria.
103 | File name must not be blank.
110 | File-field table entry already exists for file.
1xxx | Function resulted in an Adabas response code 22 (ADARSP022) where "xxx" represents the subcode.
3xxx | Nonzero Adabas response code was returned, where "xxx" is the actual Adabas response code.
9999 | Function not successful. Verify parameters and existing trigger definitions. For more information, contact your Software AG technical support representative.

### On this page

- Starting a Utility
- Utility Parameters
- End of Processing Reports
- Utility Response Codes