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.
100003599000015970004282
SEGMENT =(BROOME 112300666980800170C0011120C005C62)
DBPCB LEV=01 SEG=SHIRE RET CODE= KFDB LEN=0020 KEY FDB=(BROOME )
........................................................................................
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.
Process Options Help
────────────────────────────────────────────────────────────────────────────────
FM/IMS Browse : IMS Database DJ1E
SHOW SUP ON Scope DB Format SNGL
Segment SHIRE Level: 1
Concatenated key value: DENMARK
Top Line is 1 of 9
Current 01: SHIRE-TOWN
Ref Field Typ Len Data
3 SHIRE-NAME AN 20 K DENMARK
4 SHIRE-TYPE AN 1 1
5 SHIRE-CODE1 ZD 3 305
6 SHIRE-CODE2 ZD 5 244
7 SHIRE-YEAR BI 2 6280
8 SHIRE-BRICK PD 8 606363187610
9 SHIRE-WOODEN PD 8 2034233224332
10 SHIRE-SCHOOL PD 4 3020312
11 SHIRE-GOLF BI 2 12608
*** End of record ***
Command ===> Scroll CSR
F1=Help F2=Format F3=Exit F4=CRetriev F5=RFind F6=RChange
F7=Up F8=Down F9=Swap F10=Previous F11=Next F12=Cancel
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