Converting multicoded data to single-coded data
Quick reference
To write a multicoded column out as a single-coded field, type:
call explode(mc_start_col, num_cols, 'codes', sc_start_col)
When Quantum converts multicoded data into single-coded data, it takes the codes in the multicode and transfers each one to a separate column in the data, thus creating a single-coded field of columns in addition to the original multicode. You can choose which codes should be exploded in this manner, and also the start column of the single coded field.
This conversion is done by the explode subroutine.
Syntax
call explode(mc_start_col,num_cols,'codes',sc_start_col)
mc_start_col
The first multicoded column to be converted.
num_cols
The number of sequential columns to be converted.
codes
The codes to be written out as single codes.
sc_start_col
The first column in the single-coded field.
More information
Codes are exploded in the order 1234567890–&. If the first code specified in codes is present in the multicode, that code will be copied into the first column of the single-coded field. If the code is not present, the column is blank. For example, if the data is:
----+----5
1
/
4
and you write:
call explode (c144,1,'1/4',c151)
the result is:
----+----5----+
1 1234
/
4
If you write:
call explode (c132,2,'1/5',c140)
then:
----+----4
14
25
46
7
becomes
----+----4----+----5
14 12 4 45
25
46
7
The explode statement says ‘explode codes 1 to 5 in the two columns starting at column 132 into a field starting at column 140’. Quantum copies a ‘1’ into c140 because there is a ‘1’ in c132, and a ‘2’ into c141 because there is also a ‘2’ in c132. Column 142 is blank because there is not a ‘3’ in c132, and so on. Notice that the ‘7’ in c132 and the ‘6’ in c133 have been ignored because they are not part of the code specification with explode.
If explode is called for any record in the data file, Quantum prints a map in the out2 print file listing the contents of the multicoded columns and the columns into which the codes were transferred. If explode is not called for any record, no map is produced.
See also