Please give some description of your “flat file”. Many of us think of them as “program-described” physical files with a single field. But some others would mean streamfiles in an IFS directory. What file do you have? Can you show examples of a couple rows?
Flat is file with single field
A R RFMT
ok then you’re on Charlie Browns solution
Describe a physical file with fields for the stuff in your flat file .. but all text since your flat file is all text. This file’s record should be at least the length of the flat file record and breaks out the fields you want to key on, key on those fields.
Compile the physical file
Then copy the flat file (CPFY) to the new file using the fmtopt *NOCHK.
Then you can use the new keyed file.
It only needs to use ‘text’ fields if the field positions contain text bytes. If positions contain packed values, then those positions need to be described as packed. If positions contain binary values, then the description should be binary.
The DDS for the new physical file needs to list definitions of the subfields of FLD1 according to how those positions actually exist. When the image-copy is done (i.e., *NOCHK) there won’t be any conversion. The new file should already have the appropriate definitions for whatever the data is.
Of course, that will most likely be text…