Why use a template and views?
Typically, databases containing application data have a well-defined structure, where each segment in the database consists of several fields. Each field contains a discrete item of data, such as a customer's name, a product code, or any value that can be stored in a database. This data can be of various types: some fields contain character data, others contain numeric data encoded in binary format or packed decimal format.
To work efficiently with these databases, you need tools that recognize segment layouts, allowing you to selectively process individual fields.
For example, if you use the IMS test program DFSDDLT0 to print an application database, then each segment appears as a string of characters, with no indication that the segments consist of individual fields. Fields containing numeric data encoded in binary or packed decimal format are represented by double line hexadecimal values.
Even if you know the column boundaries of each field, maintaining application data by using a DFSDDLT0 can be difficult and tedious:
- If you want to find and replace data in a specific field, then you have to be careful not to change the field length; otherwise, you could move the boundaries of subsequent fields, and corrupt the segment structure.
- If you want to find and replace data in numeric fields where the data has been encoded in binary or packed decimal format, then you have to specify the find and replace values in that format (typically, as hexadecimal values), rather than as numeric values.
- If the database you are editing contains several segment types (each with one or several layouts), and you only want to find and replace data in one segment/layout type, then you have to exclude other segment/layout types from editing.
In this segment, the last two bytes (X'8622') are stored in a binary numeric field. The decimal equivalent of this value is 34338. If you wanted to change this value to 12151, you need to:
- Display the hexadecimal values of the segment data.
- Determine the column positions occupied by the field.
- Convert the numeric value 12151 into its hexadecimal equivalent (X'2F77').
- Overtype the old hexadecimal value of the numeric field (X'8622') with the new value, or use a CHANGE command with the old and new hexadecimal values.
Here is the same segment displayed in SNGL format.
In FM/IMS, to change the numeric value of the SHIRE-GOLF binary numeric field from 12608 to 12151, you can overtype the numeric value, or enter the command:
CHANGE 12608 12151 #11