Sign in

docs RPG Reference

INFDS Input/Output Feedback Example

section, you can make the following entries:

  • Specify the INFDS keyword on the file description specification with the name of the file information data structure

  • Specify the file information data structure and the subfields you wish to use on a definition specification.

  • Use information in the IBM i documentation to determine which fields you wish to include in the INFDS. To calculate the starting position and length of the use the Offset, Data Type, and Length given in the IBM i documentation and do the following calculations:

    Start = 241 + Offset
       Character_Length = Length (in bytes)

    For example, for device class of a file, the IBM i documentation gives:

    Offset = 30
       Data Type is character
       Length = 2

    Therefore,

    Start = 241 + 30 = 271

    See subfield DEV_CLASS in the example below

Figure 1. Example of Coding

   DCL-F MYFILE WORKSTN INFDS(MYIOFBK);

   DCL-DS MYIOFBK;
                                           // 241-242 not used
     WRITE_CNT     UNS(10)    POS(243);    // Write count
     READ_CNT      UNS(10)    POS(247);    // Read count
     WRTRD_CNT     UNS(10)    POS(251);    // Write/read count
     OTHER_CNT     INT(10)    POS(255);    // Other I/O count
     OPERATION     CHAR(1)    POS(260);    // Current operation
     IO_RCD_FMT    CHAR(10)   POS(261);    // Rcd format name
     DEV_CLASS     CHAR(2)    POS(271);    // Device class
     IO_PGM_DEV    CHAR(10)   POS(273);    // Pgm device name
     IO_RCD_LEN    INT(10)    POS(283);    // Rcd len of I/O
   END-DS;