You probably defined the externally defined data structure within the procedure, thereby inadvertently creating two sets of fields: the global ones that are automatically created by the RPG compiler and the local ones you defined within your procedure. When you read a record, the global fields are filled with the input data; the local fields stay empty.
- all file data is global
- local fields effectively hide global fields with the same names.
I suggest you define the data structure in both the program AND the subprocedure. Define the structure in the subprocedure as “based” on a pointer and pass the pointer instead of the datastructure into the procedure. When you define the structure in the program, define a separate pointer field and initialize it to the %addr of the data structure. This is the pointer that you would pass.