HPlogo Message Catalogs:Programmer's Guide: HP 3000 MPE/iX Computer Systems > Chapter 4 Modifying the Application Message Catalog

Modifying a Source File

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

There are two ways to modify a source catalog:

  • Edit the source file

  • Merge the source file with a maintenance file

Editing the Source File

The simplest way to modify the catalog is to text the file into EDIT/V and make changes directly. Although this is simple, it has many drawbacks:

  • You have no record of the changes you've made; therefore, if the file doesn't work, you don't know what has been changed.

  • Because there is no record of the changes, you have no rollback capability; you can't go back to the old version of the source.

  • Most message files are quite large, so it is slow and inefficient to edit them.

For these reasons, editing the source file directly is not recommended for most catalogs and will not be discussed further.

Merging Source and Maintenance Files

You use GENCAT to merge source and maintenance files. You can use either of two different merging methods:

  • Merging by Line Number

  • Merging by Set and Message Numbers

Each method requires a different type of maintenance file. Creating each type of maintenance file is described below, and examples are given.

For examples of merging files, the example source catalog created earlier in this manual is used. The example catalog is listed below. The numbers at the left are the line numbers in the source file; to merge by line number, the source and maintenance files must be numbered. When you merge by set and message number, the files may be numbered or unnumbered.

     1    $SET 1 Prompts 

     2    1 ENTER FIRST NAME 

     3    2 ENTER LAST NAME 

     4    $ 

     5    $ 

     6    $set 2 Error Messages 

     7    1 NAME NOT ON DATA BASE 

     8    2 ILLEGAL INPUT 

     9    3 ERROR OCCURRED DURING THE LOADING % 

    10    OF THE DATA BASE. 

    11    98 THE NUMBER OF FILES & 

    12    DOES NOT MATCH THE & 

    13    SYSTEM'S CALCULATIONS. 

    14    $ 

    15    $set 13 Run-Time Messages 

    16    400 INPUT FROM ! ON TERMINAL NUMBER ! 

    17    401 INPUT FROM TERMINAL NUMBER !2 BY !1 

Merging by Line Numbers

Merging a maintenance file against a source catalog file by line numbers allows adding, replacing, or deleting records. These records may be $SET, message, or comment records. This method is recommended if your changes are in blocks, you don't have a lot of modifications, or you want to add, delete, or modify comment lines; otherwise, you should use the merge by set and message number method described in the next section.

To merge files by line numbers, both source and maintenance file must be numbered. If either of them are unnumbered, GENCAT will fail.

CAUTION: Merging by line numbers allows you to delete a set directive without deleting the messages within it or to add messages and set numbers in non-ascending order. These are errors that GENCAT will not allow. Be aware that you are adding and deleting information by record number.

Modifying a Record

If the maintenance file's line number is common to the source file's, the source's record is overwritten by the maintenance record.

Adding a Record

If the line number in the maintenance file does not exist in the source, the record represented by that line number from the maintenance file is added to the source at that line number. Make sure you don't have any blank lines in your maintenance file; GENCAT will merge them into your source file and when you try to format it, GENCAT will abort.

Deleting a Record

The directives $EDIT and $EDIT VOID=XXXXXXXX are used to delete records from the source file. $EDIT deletes the line in the source file that the $EDIT directive is on in the maintenance file. If $EDIT VOID is used, the records beginning with and including the record number of the $EDIT VOID record to record XXXXXXXX are deleted. The line number XXXXXXXX represents the line number XXXXX.XXX of the source file.

Example

Below is an example of merging by line numbers. The maintenance file that follows, is merged with the example source catalog created in Chapter 2 and repeated at the beginning of this chapter. The numbers on the left are the line numbers in the file.

      2    1 PLEASE ENTER YOUR FIRST NAME 

      3    $EDIT 

      5    $This is where $Set 2 used to be 

      6    $EDIT VOID=13000 

     14.1  $SET 3 Misc Messages 

     14.2  4 Welcome to the System 

     14.3  6 Please wait ... 

     14.4  $ 

The new source file created by merging by line number is listed below:

    1    $SET 1 Prompts 

    2    1 PLEASE ENTER YOUR FIRST NAME 

    4    $ 

    5    $This is where $Set 2 used to be 

   14    $ 

   14.1  $SET 3 Misc Messages 

   14.2  4 Welcome to the System 

   14.3  6 Please wait ... 

   14.4  $ 

   15    $set 13 Run-Time Messages 

   16    400 INPUT FROM ! ON TERMINAL NUMBER ! 

   17    401 INPUT FROM TERMINAL NUMBER !2 BY !1 

Merging by Set and Message Number

This method is usually the easiest method of modifying your source. When the source is merged with a maintenance file by set and message numbers, you have rollback capability and an easy way to build a maintenance file.

When GENCAT reads a $SET record from the maintenance file, all records following the $SET record are considered to be message records or comment records within that set until GENCAT reads another $SET record or exhausts the maintenance file. Set numbers must be in ascending order, and all message numbers must be in ascending order within each set. GENCAT ensures that the new source file is created with the correct structure of set and message numbers.

The first record GENCAT expects to read from the maintenance file is a $SET, $DELSET, or a comment record. GENCAT will continue to read and evaluate the maintenance file records until there is an error or the maintenance file is exhausted. After GENCAT reads a maintenance file record, it is evaluated according to a set of rules, and a copy of the source is modified as necessary; a new source is then created. The following rules for evaluation apply to set numbers and message numbers.

Adding a Set

Any new set numbers are added to the source catalog file. All message numbers and messages following this set record are assumed to be new, and will be added to the source file.

Deleting a Set

To delete a set and the messages it contains, use the directive $DELSET setnum. The $DELSET directive is allowed only in a maintenance file. It instructs GENCAT to delete the entire set of messages denoted by setnum. A comment may follow setnum, providing it is preceded by at least one blank. The $DELSET directive is not written to the new file.

The directive may be either in upper case or lower case ($DELSET or $delset). Mixed cases are not allowed (for example, $DELSet or $deLseT).

Modifying a Set or Message

Set or message numbers, if already present, signify changes to the sets and messages currently in the source catalog.

Adding a Message

New message numbers within a set are added to the new source. When any new message numbers are added, you must specify the set to which they belong.

All message numbers are evaluated according to the rules for message numbers (ascending order, 1 through 32,766).

Deleting a Message

Message numbers that are already present are deleted if no text follows the message number. The line of text is replaced by a comment line.

Comment Records

Comment records cannot be added, deleted, or modified when you merge by set and message number. You must merge by line number to perform operations on comment records. All comment lines included in a maintenance file for message and set number merging are ignored by GENCAT.

Example

Below is an example of merging by set and message numbers. The maintenance file that follows, is merged with the example source catalog created in Chapter 2 and repeated at the beginning of this chapter. No line numbers are shown because these files can be numbered or unnumbered.

     $set 1 

     1 PLEASE ENTER YOUR FIRST NAME 

     2 

     $DELSET 2 

     $SET 3 Misc Messages 

     4 Welcome to the System 

     6 Please wait ... 

The new source file created by merging by line number is listed below:

     $set 1 

     1 PLEASE ENTER YOUR FIRST NAME 

     $ 

     $ 

     $ 

     $SET 3 Misc Messages 

     4 Welcome to the System 

     6 Please wait ... 

     $set 13 

     400 INPUT FROM ! ON TERMINAL NUMBER ! 

     401 INPUT FROM TERMINAL NUMBER !2 BY !1 
Feedback to webmaster