Segment Edit/Compression exit routine
The Segment Edit/Compression exit routine allows you to encode, edit, or compress the data portion of a segment.
You can use this facility on segment data in full function databases and Fast Path DEDBs. You write the routine (your edit routine) that actually manipulates the data in the segment. The IMS code gives your edit routine information about the segment's location and assists in moving the segment back and forth between the buffer pool and the application program's I/O area.
The following database types support the Segment Edit/Compression exit routine:
- HISAM
- HDAM
- PHDAM
- HIDAM
- PHIDAM
- DEDB
Detailed information on how the Segment Edit/Compression exit routine works and how you use it is in IMS Version 15.4 Exit Routines.
The Segment Edit/Compression exit routine lets you:
- Encode data for security purposes. Encoding
data consists of
scrambling
segment data when it is on the device so only programs with access to the edit routine can see it in decoded form. - Edit data. Editing data allows application programs to receive data in a format other than the one in which it is stored. For example, an application program might receive segment fields in an order other than the one in which they are stored; an application program might require all blank space be removed from descriptive data.
- Compress data. This allows better use of DASD storage because segments can be compressed when written to the device and then expanded when passed back to the application program. Segment data might be compressed, for example, by removing all blanks and zeros.
- Expand Data. The DEDB Sequential Dependent Scan utility
invokes the Segment Edit/Compression exit routine (DFSCMPX0) to expand
compressed SDEP segments when you specify both SDEP segment compression
in the DBD and the DEDB Scan utility keyword, EXPANDSEG.
Related Reading: EXPANDSEG and the DEDB Scan utility are described in IMS Version 15.4 Database Utilities. The segment compression exit is described in IMS Version 15.4 Exit Routines.
Two types of segment manipulation are possible using the Segment Edit/Compression exit routine:
- Data compression— movement or compression of data within a segment in a manner that does not alter the content or position of the key field. Typically, this involves compression of data from the end of the key field to the end of the segment. When a fixed-length segment is compressed, a 2-byte field must be added to the beginning of the data portion of the segment by the user data compression routine. This field is used by IMS to determine secondary storage requirements and is the only time that the location of the key field can be altered. The segment size field of a variable-length segment cannot be compressed but must be updated to reflect the length of the compressed segment.
- Key compression— movement or compression of any data within a segment in a manner that can change the relative position, value, or length of the key field and any other fields except the size field. The segment size field of a variable-length segment must be updated by the compression routine to reflect the length of the compressed segment.
You specify the use of the Segment Edit/Compression exit routine when you define a segment type. Any segment type can be edited or compressed (using either data or key compression) as long as the segment is:
- Not a logical child
- Not in an HSAM, SHISAM, or index database
The use of the segment edit/compression exit routine is defined in physical database DBDs. This exit routine's use cannot be defined in a logical database DBD.
Data compression is allowed but key compression is not allowed when the segment is:
- A root segment in a HISAM database
- A segment in a DEDB database