Search code examples
ibm-midrangerpgle

Is it possible to get the position of the pointer reading through a Physical File in RPGILE?


Is it possible to get the position of the pointer reading through a Physical File in RPGLE?

That way I can store that position and get back to it later?


Solution

  • You're looking for the relative record number (RRN?)

    Position 397 of the File Information Data Structure (INFDS).

    Example from the manual

    DCL-F MYFILE DISK(*EXT) INFDS(DBFBK);
    
    DCL-DS DBFBK;
      FDBK_SIZE INT(10) POS(367); // Current line num
      JOIN_BITS INT(10) POS(371); // JFILE bits
      LOCK_RCDS INT(5) POS(377); // Nbr locked rcds
      POS_BITS CHAR(1) POS(385); // File pos bits
      DLT_BITS CHAR(1) POS(384); // Rcd deleted bits
      NUM_KEYS INT(5) POS(387); // Num keys (bin)
      KEY_LEN INT(5) POS(393); // Key length
      MBR_NUM INT(5) POS(395); // Member number
      DB_RRN INT(10) POS(397); // Relative-rcd-num
      KEY CHAR(2000) POS(401); // Key value (max size 2000)
    END-DS;