I wonder if this is a viable approach for you to use FDM for this problem:
1. In your input file, globally substitute ',' for '^~^' as the column delimiter and add a header record - e.g. 'RECTYPE,FLD1,FLD2,FLD3,FLD4,FLD5,FLD6'. Then label the input file as CSV, and use the column labels in the where clause and in masking.
2. In the Options settings in FDM, change option 'WHEREASSUBSET' to 'N', which changes the behaviour of the 'Where' clause. According to the option description: "Y (default), flat files are scrambled AND subsetted according to where clause, N use WHERE as criteria for masking and output all records" - so, instead of the 'where' clause causing only records that match the 'where' to be output, FDM will apply the mask to the selected records but output all records, matched and unmatched.
3. If you need to apply different masking to different record types, you can create a different mask for each record type with a 'where' clause based on 'RECTYPE', and apply the masks sequentially, each mask taking as input the file output by the previous mask.
4. Finally, delete the header record from the output file and globally replace ',' with '^~^', to reproduce the original input format.
Hope that helps!
Regards,
James