|Developing IMS Applications
|Defining Segment Layouts for IMS Databases
This chapter describes the IMS Database Editor that Mainframe Express provides for browsing, editing and maintaining Information Management System (IMS) databases through a graphical interface. The editor is useful in a test environment for editing records in a test database.
You can use the IMS Database Editor with
For detailed instructions on using the IMS Database Editor, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click IMS Option, Working with IMS databases.)
The IMS Database Editor provides a graphical interface for viewing and manipulating data in an IMS database. You can:
When you have finished editing a local database, your edits are saved automatically when you close the database.
Note: To view and edit formatted data, you must first of all define segment layouts for the segment types in the database. For this purpose, Mainframe Express provides a Segment Layout Editor. To find out more about the Segment Layout Editor, see the chapter Defining Segment Layouts for IMS Databases.
The rest of this chapter assumes that you have segment layouts loaded to format your data.
You open the IMS Database Editor from the IMS View of your project. For a description of the IMS View, see the section IMS View in the chapter The IMS Option Interface.
You can open the IMS Database Editor by selecting either a physical database or a logical database for editing:
|Type of Database
|Select a DBD Gen to edit.
|Select a PSB. Then, select a PCB to edit.
When you open the IMS Database Editor, the IMS Database Editor Window opens.
Note: To prevent segments being locked unnecessarily, a segment occurrence is not loaded automatically for editing when you open the IMS Database Editor. Therefore, you should make one or more DL/I calls to establish your position.
The IMS Database Editor has one main window:
Figure 36-1: The IMS Database Editor Window
This window is divided into a left-hand pane and a right-hand pane. At the bottom of the window, there is a status bar. Above the window is the IMS Database Editor toolbar.
The areas on the left-hand pane of the IMS Database Editor window are described below, from the top down:
The Current Segment Arrow marks the current position in the hierarchical path.
To expand a segment type, click . To compress a segment type, click .
While you are browsing, a Browse window overlays the Database Tree.
The SSA List displays a list of segment types from the current segment type up to the root. Each row shows the:
While you are browsing, a Browse window overlays the SSA List.
The Segment Data area displays character and hexadecimal representations of binary data for the current segment occurrence. When a segment layout is loaded, the key area is highlighted in red.
Note: If you click in the Database Tree on a segment type that is not marked by the Current Segment Arrow , the Segment Data area displays EBCDIC padding bytes.
The right-hand pane of the IMS Database Editor window is empty unless there is a segment layout associated with the current segment. For more information about segment layouts, see the chapter Defining Segment Layouts for IMS Databases.
The areas on the right-hand pane are described below, from the top down:
Layout Status Bar
The Layout Status Bar displays information about the current segment layout and divides into three parts:
|Field Layout View
The Field Layout View uses a COBOL segment layout to display the field name, picture and value for each field in a segment occurrence. Key fields are displayed in red.
You can resize the columns by dragging the column dividers on the column headings row.
If the data displayed is for the segment occurrence at your current position in the database, you can edit the data in a field by clicking inside the Value column of the field.
You can click a field in the Field Layout View to display unformatted data for that field in the Field Data area.
The Field Data area displays character and hexadecimal representations of binary data for the field or group item that is currently highlighted in the Field Layout View.
To display data for a particular field, click on the field in the Field Layout View.
Note: If you click in the Database Tree and highlight a segment type that is not marked by the Current Segment Arrow , the right-hand pane does not continue to display data for the current segment occurrence. Instead, the data fills with EBCDIC padding bytes and a layout is chosen according to this data and the segment type. (The IMS Database Editor always works in EBCDIC and therefore ignores the Data Tools option for changing the ANSI/EBCDIC character setting.)
The IMS Database Editor status bar is located at the bottom of the IMS Database Editor window.
Figure 36-8: The The IMS Database Editor Status Bar
This status bar displays the:
Length of the segment, plus:
|PROCessing OPTionS: The access control that the application has for the current segment.
|Name of the current segment type.
|Level within the hierarchy of the current segment type.
Status code for the last DL/I call. To indicate success, the IMS Database Editor displays the word BLANKS.
You can configure the IMS Database Editor by:
To change these configurations, click Data Tools on the Options menu and then click the IMS tab on the Data Tools dialog box.
Before using the IMS Database Editor, you might like to consider whether you want to be prompted every time you attempt to edit or delete a segment occurrence. For both operations, by default, the IMS Database Editor displays a prompt asking you if you want to continue.
By deselecting Update Warning and Delete Warning in the Data Tools dialog box, you specify that the IMS Database Editor does not display these prompts. Any changes that you make to these settings take effect when you next open a database. If you do switch either of the prompts on or off, make sure that you inform anyone else who uses the IMS Database Editor on your PC.
By default, the Browse window displays a predefined number of segment occurrences per page. You can change this default by entering a new value in the Number of segments per browser page field in the Data Tools dialog box.
You might find that you want to reduce the number of segment occurrences per page. For example, if you are accessing a remote database or using a slower machine, the Browse window may be taking too long to update when you ask to view the next page of occurrences. To obtain a quicker response, you can reduce the number of segment occurrences per page.
For more information on browsing, see the section Browsing Through Segment Occurrences.
There are several ways to navigate the database inside the IMS Database Editor. You can use:
In addition, you can move your position to another segment occurrence while you are browsing. For more information on browsing, see the section Browsing Through Segment Occurrences.
To retrieve segment occurrences, you can make the following DL/I calls:
When you use a DL/I call to change your position within a database, the Current Segment Arrow in the Database Tree moves to the new segment type, if this has changed. The Field Layout View and the Segment Data and Field Data areas display data for the segment occurrence that is now current.
When you reach the end of the database, the IMS Database Editor prompts you to reset your position to the start of the database.
Tip: To find out whether a DL/I call is successful, look at the status code on the The IMS Database Editor Status Bar. The status code should be set to BLANKS. If there is an error, the IMS Database Editor displays a message containing the status code and a full description.
The SSA List shows all the segment types on the path, together with any SSAs already set up for those segment types. You can define an unqualified or qualified SSA for a segment type by double-clicking on the segment type in the SSA List:
To identify the next segment type that you want to access, you can use an unqualified SSA with one of the following SSA command codes:
You cannot choose the command codes *F or *L for a segment type that has unique keys defined.
You can use qualified SSAs to narrow your search down further to individual segment occurrences. For example, an insurance company might want to search for all policies taken out after a certain date.
You can define an SSA for each segment type up the path back to the root segment, as long as each of those segment types has a key. For each segment type, you can define:
These are the same command codes that you can set up for an unqualified SSA.
Figure 36-9: The Definition of an SSA Qualification Statement
Each SSA qualification statement is made up of a:
You can combine unqualified and qualified SSAs on a single call. The IMS Database Editor remembers the SSAs that you create for up to 10 databases.
To help you search the database for a string, the IMS Database Editor provides an IMS Database Find floating bar:
Figure 36-10: The IMS Database Find Floating Bar
The search begins from your current position in the database. You can search the rest of the database or you can restrict the search to:
This option is not relevant for the root segment.
You can choose whether or not to make the search case-sensitive.
Figure 36-11: A Rolled Up IMS Database Find Floating Bar
With the floating bar rolled up, use as the Find button. Click to roll down the IMS Database Find floating bar.
You can navigate your way forwards but not backwards through the database. To aid navigation, the IMS Database Editor provides a bookmarking utility. You can bookmark the current segment occurrence. Then, later on in the session or in a later editing session, you can return to the bookmarked segment occurrence.
Bookmarking offers options to:
When you add a bookmark, the IMS Database Editor makes a note of the segment type. You can also provide a more meaningful description for the segment occurrence you are bookmarking. The editor records the segment name and your description in a bookmark list.
Between editing sessions, the IMS Database Editor stores your bookmark list automatically in a bookmark file in the DATA folder of the project folder. The bookmark file has a .bmf extension.
The filename of the bookmark file depends upon the type of database you are editing:
|Type of Database
|Bookmark List Filename
|The name of the DBD
|The name of the PSB immediately followed by n, where n is the PCB number
The bookmark list displays your saved bookmarks in the order in which you created them. When you select a bookmark from the list, the IMS Database Editor changes your current position to the bookmarked segment occurrence.
You can delete a bookmark that you no longer wish to keep in a bookmark list.
You can elect to save your bookmark list in a bookmark file on a different drive, changing the directory and filename if you want.
You can retrieve a bookmark list from a bookmark file that is not the default bookmark file.
You can browse forwards through the segment occurrences in a database, starting at your current position. The Start of browse position marks your current position.
The Browse window overlays the Database Tree and SSA List. The window lists segment occurrences one page at a time:
Figure 36-12: The Browse Window
While you are browsing, you can:
Tip: You can customise the number of segment occurrences displayed per page. For more information, see the section Configuring the IMS Database Editor.
There are three areas in which you can edit data:
Displays the contents of the segment buffer. The segment buffer contains character and hexadecimal representations of binary segment data for the current segment occurrence. You can edit the data in the segment buffer by clicking inside this area.
|Field Layout View (Value column)
You can edit a field by clicking inside the Value column of the field. When you have finished editing a field, you can save your edits in the segment buffer by pressing Enter. This updates the Segment Data area in the left-hand pane. You can undo the edits you have made to a field by pressing Escape instead of Enter.
You can click inside this area to edit character and hexadecimal representations of binary data for the field that is highlighted in the Field Layout View. To do so, you must have defined a segment layout for the segment occurrence.
When you have finished editing a field, you can save your edits in the segment buffer by clicking inside another part of the IMS Database Editor window.
To undo your edits, press Escape before clicking inside another part of the window.
Whilst editing, you can:
When you have finished editing fields for the segment occurrence, you can issue an ISRT or REPL call. You can undo segment buffer edits up until the point when you issue the ISRT or REPL call.
You can make the following DL/I calls to add, modify and delete segment occurrences:
|Add a new segment occurrence. See the section Adding a New Segment Occurrence
|Modify an out-of-date segment occurrence
|Remove a redundant segment occurrence
If a segment is of variable length, you can also change the segment length.
Before issuing ISRT and REPL calls, you need to edit data. For more information on editing, see the section Editing Data.
Full instructions on how to add, modify and remove segment occurrences are given in the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click IMS Option, Working with IMS databases, Changing Segment Occurrences.)
Note: You cannot make changes to segment occurrences while the Browse window is open.
The method used to add a first child differs from the method used subsequently to add twins to the first child. For detailed instructions, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click IMS Option, Working with IMS databases, Changing Segment Occurrences.)
Once you have added the first child, you can add a twin very quickly. While the data for the previous twin is still in the segment buffer, you can edit the key field and any other fields that are different and click .
Before clicking , you must edit any key fields to make them unique.
The IMS Database Editor provides two options for initializing segment occurrences:
|Initialize the data in the segment buffer. As you enter new data, the IMS Database Editor loads the appropriate layout automatically.
|Select Layout and Initialize
|Specify the layout you want to use for the new segment occurrence and initialize the data in the segment buffer.
By default, the editor applies a default segment layout when you initialize. Although the Initialize option is quicker because you do not specify additional options, you may prefer to use the Select Layout and Initialize option to select a different layout.
If you have a segment layout loaded for the current segment occurrence, you can edit the length field of a variable length segment occurrence.
If you do not have a segment layout loaded, you cannot edit the length field since there is no formatted data to edit. Instead, you can use a utility that the IMS Database Editor provides for changing the segment length.
This section lists a few questions that you or other users may ask.
A. The IMS Database Editor could not find a segment layout to match this particular segment occurrence. For more information, look in the Layout Status Bar at the top of the right-hand pane.
To find out about creating segment layouts, see the chapter Defining Segment Layouts for IMS Databases.
If you have created segment layouts already for the segment type, they may all be conditional. Make sure that you create a default layout for each segment type. Then, if none of the conditional segment layouts applies to a segment occurrence, that segment occurrence can adopt the default layout.
A. This indicates that you do not currently have your position in the database established.
When you open the IMS Database Editor, you are not positioned in the database until you make a DL/I call. Another reason for losing is that you have made a failed ISRT call.
To display in the Database Tree, you should make a DL/I call to position yourself in the database.
A. This occurs when you are editing a field in the Segment Data area that is already full. If the IMS Database Editor did allow you to insert text, data would be lost off the end of the field. This also occurs when you are are editing an alphanumeric field.
You should switch back to Overtype mode by pressing Insert.
|Developing IMS Applications
|Defining Segment Layouts for IMS Databases