So, how exactly does a decompiler work?
AS/400 compilers produce not only executable code, but also a number of structures and tables which contain information associating the source member to the executable program object. An ODT (object definition table) is constructed containing information (length, type, decimal positions) about variables and constants. A BOM (break offset mapping) table is constructed associating a source statement with an MI instruction number. At that MI instruction number, a string of MI instructions are performed corresponding to the original RPG source instruction. A symbol table is constructed, containing the names of source fields, tables and arrays. Altogether, the program template contains almost all of the information from the original source member. The decompiler, then, has the capacity to generate a new source member identical to the original, except for internal comments, for any program object which has not had observability removed.