Using the query provided in the SORTDBIN data set, MFX will access the DB2 database specified in the DB2 EXEC PARM and will process as fixed-length records the rows returned from the query. The records will be processed as if read from a SORTIN or retrieved from an E15 exit. All MFX features available after E15 processing in the flow of control can be used with a SORT or COPY application.
The record used within MFX is constructed from the fields in the query as follows:
-
The order of the fields in the record is the same as the order specified by the SELECT statement.
-
The data format of the fields within the record is the same format returned by DB2.
-
A fixed-length field is the same length as returned by DB2.
-
Variable-length character data is stored in a fixed-length field. The field length is equal to the maximum length of the field plus two bytes for a leading field length descriptor variable. The field length descriptor contains a binary value describing the number of bytes of data provided for this field. If an instance of the field is shorter than the maximum, the remaining bytes will be set to binary zeros.
-
Any fields defined to allow nulls will cause the creation of two fields within the record constructed by MFX. The first will be the data field and the second will be a one byte indicator field. If the value of the field is null, by default the field will be filled with binary zeros (X'00') and the indicator field will contain a '?' to signify the field is null. If the value of the field is not null, the indicator will be set to binary zeros. If binary zeros would not be an appropriate fill value for a null field, use of SQL functions such as VALUE or COALESCE on the SELECT statement should be considered. For instance, if the field to be retrieved is packed decimal, it is usually best to create a null value of the proper PD format. This ensures that if the field is used later as a sort key or in other data conversion features, it would contain appropriate high or low values such as PD zeros or nines as specified in the VALUE or COALESCE function.