Extract data layout

The data extracted from IMS is written to a flat file, with the following layout characteristics:

Header record
The header stores information required by FM/IMS when reloading the data. It comes in two formats: a Dynamic PSB header record; and a Static PSB header record:
Dynamic PSB header record
This record is the first line in the extract file, and has the following format:
Table 1. Dynamic PSB header record structure
Columns Field Description
1-8 Sort field All columns set to low values (x'00'), so that when the file is sorted, the header record remains the first record
9-15 Product code Set to "FM/IMS"
16-25 Version number Set to current FM/IMS version
26 Reserved
27-28 Extract record prefix length This is calculated in the extract record format as
x=33+max_ckeylen-1
29-30 Maximum concatenated key length
31-46 Date/time Date and time that the extract file was created
47 EOR End of record - reserved
Static PSB header record(s)
When using a Static PSB in the extract process, the header records created may span several lines. They are distinguished from the segment records by having 0 in the logical order number field (column 1-2). The first header record has the format:
Table 2. Static PSB first header record structure
Columns Field Description
1-9 Sort field All columns set to low values (x'00'), so that when the file is sorted, the header record remains the first record (this is one byte longer than the sort field in the Dynamic header record)
10-16 Product code Set to "FM/IMS"
17-26 Version number Set to current FM/IMS version
27 Reserved
28-29 Extract record prefix length This is calculated in the extract record format as
x=34+max_ckeylen-1
30-31 Maximum concatenated key length
32-47 Date/time Date and time that the extract file was created
48-59 PSB Type Set to "STATIC PSB"
60-73 Index If the PSB did not use a secondary index, this field is blank. Otherwise, it is the word "INDEX", followed by the DBD name of the index.
74 EOR End of record - reserved

After the first header record, a Static PSB extract has additional header records to store information about the PSB used during the extract. Each record includes the list of SENSEGs for each of the databases included in the extract. These records have the format:

Table 3. Static PSB subsequent header record structure
Columns Field Description
1-2 Sort field All columns set to low values (x'00'), so that when the file is sorted, the header record remains the first record
3-4 Header sequence number To order the additional header records during sort
5-8 Reserved Set to low values (x'00')
9-16 Header DBD name DBD of one of the databases involved in the extract
17-?? SENSEG list Variable length; 8 bytes per senseg
IMS segment record
The IMS segment records have the following format:
Table 4. IMS segment record structure
Columns Field Description
1-2 Logical number order Used to sort the file, so logical children are inserted after logical parents. This is "01" for normal segments, "02" for logical children and either dependent segments.
3-4 Database number The PCB number used to extract the data, for logical relationships the primary database specified on the Extract panel has a value of 1. Logically related databases have a value of 2, 3, and so on.
5-8 Extract order Order in which the IMS segments were extracted by FM/IMS
9-16 DBD name DBD of one of the databases involved in the extract
17-18 Segment code
19-26 Segment name
27-28 Reserved Set to low values (x'00')
29-32 Concatenated key length Actual concatenated key length for this segment
33-?? Concatenated key
??-?? IMS segment data This starts at 33+Max concatenated key length