This is unfortunately one of the limitations of RPG/400. In ILE/RPG the limitation has been removed.
To get around this in RPG/400 you’ll need to use OVRDBF. For example, your file is called FILENAME10, then you could do the following :-
OVRDBF FILE(FILENM10) TOFILE(FILENAME10)
Then in your RPG you would use FILENM10 for your file name instead of FILENAME10 :-
FFILENM10 UF , etc….
You will need to have the OVRDBF in effect at compile time and run time. Normally this will mean running the OVRDBF interactively and compiling interactively to compile your program. Then you would use a small CL program to run the OVRDBF before calling your RPG program.
You can use DLTOVR to remove your OVRDBF.
So, just to summarize :-
Compile RPG program.
Call RPG program
Another thing to bear in mind is the maximum of 8 characters for record format name, but then you can use RENAME in your RPG.
Hope this helps.