The IFDS gives a great deal of info on the file but on an error you can get some info from the program data structure (PSDS).
This structure is defined with an S in position 23
D PSDS SDS.
40 42 Character 3
Exception type (CPF for a OS/400 system exception or MCH for a machine exception).
43 46 Character 4
Exception number. For a CPF exception, this field contains a CPF message number. For a machine exception, it contains a machine exception number.
175 184 Character 10
Name of file on which the last file operation occurred (updated only when an error occurs). This information always contains the full file name.
209 243 Character 35
Status information on the last file used. This information includes the status code, the RPG IV opcode, the RPG IV routine name, the source listing line number or statement number, and record name. It is updated only when an error occurs.
The opcode name is in the same form as *OPCODE in the INFDS
The source listing line number is replaced by the source listing statement number if OPTION(*SRCSTMT) is specified instead of OPTION(*NOSRCSTMT). The full statement number is included when it applies to the root source member. If the statement number is greater than 6 digits (that is, it includes a source ID other than zero), the first 2 positions of the 8-byte feedback area will have a “+ ” indicating that the rest of statement number is stored in positions 356-357.