When a subfile supports multiple pages (SFLSIZ greater than SFLPAG), you may lose your place if you roll to a page somewhere in the middle of the subfile and press Enter-it's not uncommon for the program to take you back to the first page of the subfile. This behavior can become irritating if you had to roll many times to reach the record you were after.
You can use a combination of SFLRCDNBR (in the DDS of the display file) and the INFDS (in your RPG program) to overcome this problem. In the display file, code the SFLRCDNBR keyword in a hidden field that has four digits and no decimal places. In the RPG program, use the INFDS positions 378-379 (which contain a binary number). Then Z-ADD this value into the SFLRCDNBR hidden field every time you press Enter, and you'll be all set. Your subfiles will stay put, as they should.
Editor's Note: You can code the display file DDS with SFLRCDNBR(CURSOR) if you want the subfile to place the cursor at the subfile record where it was when you pressed Enter; otherwise, it will be placed into the first input-capable field by default.
LATEST COMMENTS
MC Press Online