Retrieve IFS attributes

Here is a program to retrieve IFS file attributes. It uses the stat() unix-type API to get the information. The command rtvifsatr can be used in CL program that need to get information about IFS files (or directories, etc.).


cmd prompt('Retrieve IFS file attributes')
parm kwd(ifsfile) type(*char) len(100) case(*mixed) min(1) +
    prompt('IFS file (case sensitive)')
parm kwd(mode) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: file mode (10 0)')
parm kwd(inode) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: file inode (10 0)')
parm kwd(nlinks) type(*dec) len(5 0) rtnval(*yes) +
    prompt('CL var: number of links (5 0)')
parm kwd(userid) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: owner user id (10 0)')
parm kwd(groupid) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: owner group id (10 0)')
parm kwd(size) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: file size (10 0)')
parm kwd(adate) type(*char) len(7) rtnval(*yes) +
    prompt('CL var: access date (7)')
parm kwd(atime) type(*char) len(6) rtnval(*yes) +
    prompt('CL var: access time (6)')
parm kwd(mdate) type(*char) len(7) rtnval(*yes) +
    prompt('CL var: modified date (7)')
parm kwd(mtime) type(*char) len(6) rtnval(*yes) +
    prompt('CL var: modified time (6)')
parm kwd(cdate) type(*char) len(7) rtnval(*yes) +
    prompt('CL var: changed date (7)')
parm kwd(ctime) type(*char) len(6) rtnval(*yes) +
    prompt('CL var: changed time (6)')
parm kwd(device) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: file device (10 0)')
parm kwd(bsize) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: file block size (10 0)')
parm kwd(asize) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: file alloc size (10 0)')
parm kwd(objtype) type(*char) len(12) rtnval(*yes) +
    prompt('CL var: AS400 object type (12)')
parm kwd(codepage) type(*dec) len(10 0) rtnval(*yes) +
    prompt('CL var: data code page (10 0)')


CRTCMD CMD(TOOLS/RTVIFSATR)
       PGM(*LIBL/RTVIFSATRC)
       SRCFILE(TOOLSSRC/RTVIFSATR)
       SRCMBR(RTVIFSATR)
       ALLOW(*BPGM *IPGM)
       ALWLMTUSR(*NO)


pgm parm(&ifsfile &mode &inode &nlinks &userid &groupid &size +
    &adate &atime &mdate &mtime &cdate &ctime &device &bsize +
    &asize &objtype &codepage)

/* Parameters */
dcl var(&ifsfile) type(*char) len(100)
dcl var(&mode) type(*dec) len(10 0)
dcl var(&inode) type(*dec) len(10 0)
dcl var(&nlinks) type(*dec) len(5 0)
dcl var(&userid) type(*dec) len(10 0)
dcl var(&groupid) type(*dec) len(10 0)
dcl var(&size) type(*dec) len(10 0)
dcl var(&adate) type(*char) len(7)
dcl var(&atime) type(*char) len(6)
dcl var(&mdate) type(*char) len(7)
dcl var(&mtime) type(*char) len(6)
dcl var(&cdate) type(*char) len(7)
dcl var(&ctime) type(*char) len(6)
dcl var(&device) type(*dec) len(10 0)
dcl var(&bsize) type(*dec) len(10 0)
dcl var(&asize) type(*dec) len(10 0)
dcl var(&objtype) type(*char) len(12)
dcl var(&codepage) type(*dec) len(10 0)

/* +
    Not all of these are required. If we try to use them, message +
    MCH3601 is issued for variables not passed (no pointers). +
    We will set up work variables that indicate whether they can +
    be used or not. The default here is 1 (can be used), because +
    the monitor message works for failure, not success. +
*/

dcl var(&zmode) type(*lgl) value('1')
dcl var(&zinode) type(*lgl) value('1')
dcl var(&znlinks) type(*lgl) value('1')
dcl var(&zuserid) type(*lgl) value('1')
dcl var(&zgroupid) type(*lgl) value('1')
dcl var(&zsize) type(*lgl) value('1')
dcl var(&zadate) type(*lgl) value('1')
dcl var(&zatime) type(*lgl) value('1')
dcl var(&zmdate) type(*lgl) value('1')
dcl var(&zmtime) type(*lgl) value('1')
dcl var(&zcdate) type(*lgl) value('1')
dcl var(&zctime) type(*lgl) value('1')
dcl var(&zdevice) type(*lgl) value('1')
dcl var(&zbsize) type(*lgl) value('1')
dcl var(&zasize) type(*lgl) value('1')
dcl var(&zobjtype) type(*lgl) value('1')
dcl var(&zcodepage) type(*lgl) value('1')

/* +
    Work variables for all returning values. This is passed to +
    the RPG program. +
*/

dcl var(&wmode) type(*dec) len(10 0)
dcl var(&winode) type(*dec) len(10 0)
dcl var(&wnlinks) type(*dec) len(5 0)
dcl var(&wuserid) type(*dec) len(10 0)
dcl var(&wgroupid) type(*dec) len(10 0)
dcl var(&wsize) type(*dec) len(10 0)
dcl var(&wadate) type(*char) len(7)
dcl var(&watime) type(*char) len(6)
dcl var(&wmdate) type(*char) len(7)
dcl var(&wmtime) type(*char) len(6)
dcl var(&wcdate) type(*char) len(7)
dcl var(&wctime) type(*char) len(6)
dcl var(&wdevice) type(*dec) len(10 0)
dcl var(&wbsize) type(*dec) len(10 0)
dcl var(&wasize) type(*dec) len(10 0)
dcl var(&wobjtype) type(*char) len(12)
dcl var(&wcodepage) type(*dec) len(10 0)

/* +
    Other variables +
*/

dcl var(&error) type(*lgl) len(1) value('0') /* 0=no error, 1=error */

/* +
    Try to use all the incoming variables. If you can't use it, +
    set its flag to 0. +
*/

chgvar var(&mode) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zmode) value('0'))

chgvar var(&inode) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zinode) value('0'))

chgvar var(&nlinks) value(0)
monmsg msgid(mch3601) exec(chgvar var(&znlinks) value('0'))

chgvar var(&userid) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zuserid) value('0'))

chgvar var(&groupid) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zgroupid) value('0'))

chgvar var(&size) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zsize) value('0'))

chgvar var(&adate) value(' ')
monmsg msgid(mch3601) exec(chgvar var(&zadate) value('0'))

chgvar var(&atime) value(' ')
monmsg msgid(mch3601) exec(chgvar var(&zatime) value('0'))

chgvar var(&mdate) value(' ')
monmsg msgid(mch3601) exec(chgvar var(&zmdate) value('0'))

chgvar var(&mtime) value(' ')
monmsg msgid(mch3601) exec(chgvar var(&zmtime) value('0'))

chgvar var(&cdate) value(' ')
monmsg msgid(mch3601) exec(chgvar var(&zcdate) value('0'))

chgvar var(&ctime) value(' ')
monmsg msgid(mch3601) exec(chgvar var(&zctime) value('0'))

chgvar var(&device) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zdevice) value('0'))

chgvar var(&bsize) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zbsize) value('0'))

chgvar var(&asize) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zasize) value('0'))

chgvar var(&objtype) value(' ')
monmsg msgid(mch3601) exec(chgvar var(&zobjtype) value('0'))

chgvar var(&codepage) value(0)
monmsg msgid(mch3601) exec(chgvar var(&zcodepage) value('0'))

/* +
    Call the RPG program to do the stat() call, using work variables. +
*/

call pgm(rtvifsatre) parm(&ifsfile &wmode &winode &wnlinks &wuserid +
    &wgroupid &wsize &wadate &watime &wmdate &wmtime &wcdate &wctime +
    &wdevice &wbsize &wasize &wobjtype &wcodepage &error)

if cond(&error *eq '1') then(do)
    sndpgmmsg msgid(cpf9898) msgtype(*escape) msgf(qcpfmsg) +
         msgdta('RTVIFSATR had a problem.')
    goto cmdlbl(endpgm)
enddo

/* +
    Put the work variables into return variables if we're allowed +
    to do so. +
*/

if cond(&zmode *eq '1') then(chgvar var(&mode) value(&wmode))
if cond(&zinode *eq '1') then(chgvar var(&inode) value(&winode))
if cond(&znlinks *eq '1') then(chgvar var(&nlinks) value(&wnlinks))
if cond(&zuserid *eq '1') then(chgvar var(&userid) value(&wuserid))
if cond(&zgroupid *eq '1') then(chgvar var(&groupid) value(&wgroupid))
if cond(&zsize *eq '1') then(chgvar var(&size) value(&wsize))
if cond(&zadate *eq '1') then(chgvar var(&adate) value(&wadate))
if cond(&zatime *eq '1') then(chgvar var(&atime) value(&watime))
if cond(&zmdate *eq '1') then(chgvar var(&mdate) value(&wmdate))
if cond(&zmtime *eq '1') then(chgvar var(&mtime) value(&wmtime))
if cond(&zcdate *eq '1') then(chgvar var(&cdate) value(&wcdate))
if cond(&zctime *eq '1') then(chgvar var(&ctime) value(&wctime))
if cond(&zdevice *eq '1') then(chgvar var(&device) value(&wdevice))
if cond(&zbsize *eq '1') then(chgvar var(&bsize) value(&wbsize))
if cond(&zasize *eq '1') then(chgvar var(&asize) value(&wasize))
if cond(&zobjtype *eq '1') then(chgvar var(&objtype) value(&wobjtype))
if cond(&zcodepage *eq '1') then(chgvar var(&codepage) value(&wcodepage))

endpgm:
endpgm


      *-- Parameters
     d inpath          s            100a
     d iomode          s             10  0
     d ioinode         s             10  0
     d ionlinks        s              5  0
     d iouserid        s             10  0
     d iogroupid       s             10  0
     d iosize          s             10  0
     d ioadate         s              7a
     d ioatime         s              6a
     d iomdate         s              7a
     d iomtime         s              6a
     d iocdate         s              7a
     d ioctime         s              6a
     d iodevice        s             10  0
     d iobsize         s             10  0
     d ioasize         s             10  0
     d ioobjtype       s             12a
     d iocodepage      s             10  0
     d ioerror         s              1a

      *-- API return structure

     d statds          ds
     d  st_mode                      10u 0                                      File mode
     d  st_ino                       10u 0                                      File inode
     d  st_nlink                      5u 0                                      # links
     d  st_pad                        2a                                        Padding
     d  st_uid                       10u 0                                      Owner's user id
     d  st_gid                       10u 0                                      Owner's group id
     d  st_size                      10i 0                                      Regular file size
     d  st_atime                     10i 0                                      Access date/time
     d  st_mtime                     10i 0                                      Mod date/time
     d  st_ctime                     10i 0                                      Change date/time
     d  st_dev                       10u 0                                      Device ID
     d  st_blksize                   10u 0                                      Block size
     d  st_alcsize                   10u 0                                      Allocated size
     d  st_objtype                   12a                                        AS/400 object type
     d  st_codepag                    5u 0                                      Data code page
     d  st_reserv1                   67a                                        Reserved

      *-- Constants

     d NULL            c                   x'00'
     d SUCCESS         c                   '0'
     d FAILURE         c                   '1'

      *-- Prototypes

     d stat            pr            10i 0 extproc('stat')
     d  path                           *   value
     d  buf                            *   value

      *-- Variables

     d path            s            640a   inz
     d epoch           s               z   inz(z'1970-01-01-00.00.00.00000')
     d status          s             10i 0 inz
     d workdt          s               z
     d workd           s               d
     d workt           s               t

      *-- Lists

     c     *entry        plist
     c                   parm                    inpath
     c                   parm                    iomode
     c                   parm                    ioinode
     c                   parm                    ionlinks
     c                   parm                    iouserid
     c                   parm                    iogroupid
     c                   parm                    iosize
     c                   parm                    ioadate
     c                   parm                    ioatime
     c                   parm                    iomdate
     c                   parm                    iomtime
     c                   parm                    iocdate
     c                   parm                    ioctime
     c                   parm                    iodevice
     c                   parm                    iobsize
     c                   parm                    ioasize
     c                   parm                    ioobjtype
     c                   parm                    iocodepage
     c                   parm                    ioerror

      *-------------------------------------------------------------------------

     c                   eval      path = %trim(inpath) + NULL

     c                   eval      status = stat(%addr(path) : %addr(statds))

     c                   if        status = 0
     c                   eval      ioerror = SUCCESS
     c                   else
     c                   eval      ioerror = FAILURE
     c                   endif

     c                   if        ioerror = SUCCESS

      *-- st_mode (file mode)

     c                   move      st_mode       iomode

      *-- st_ino (file inode)

     c                   move      st_ino        ioinode

      *-- st_nlink (# of links to file)

     c                   move      st_nlink      ionlinks

      *-- st_uid (owner's user id)

     c                   move      st_uid        iouserid

      *-- st_gid (owner's group id)

     c                   move      st_gid        iogroupid

      *-- st_size (regular file size)

     c                   move      st_size       iosize

      *-- st_atime (access date/time)

     c                   eval      workdt = epoch
     c                   adddur    st_atime:*s   workdt
     c                   move      workdt        workd
     c                   move      workdt        workt
     c     *cymd0        move      workd         ioadate
     c     *hms0         move      workt         ioatime

      *-- st_mtime (modification date/time)

     c                   eval      workdt = epoch
     c                   adddur    st_mtime:*s   workdt
     c                   move      workdt        workd
     c                   move      workdt        workt
     c     *cymd0        move      workd         iomdate
     c     *hms0         move      workt         iomtime

      *-- st_ctime (file status changed date/time)

     c                   eval      workdt = epoch
     c                   adddur    st_ctime:*s   workdt
     c                   move      workdt        workd
     c                   move      workdt        workt
     c     *cymd0        move      workd         iocdate
     c     *hms0         move      workt         ioctime

      *-- st_dev (file device)

     c                   move      st_dev        iodevice

      *-- st_blksize (block size)

     c                   move      st_blksize    iobsize

      *-- st_alcsize (allocated file size)

     c                   move      st_alcsize    ioasize

      *-- st_objtype (AS/400 object type)

     c                   move      st_objtype    ioobjtype

      *-- st_codepag (data code page)

     c                   move      st_codepag    iocodepage

     c                   endif

     c                   eval      *inlr = *on


DspIfsAtr example program

Here is a program using the above RTVIFSATR to show the attributes on the screen. I used this to experiment with using display panel groups (instead of a display file). The DSPIFSATR command is largely superseded by IFS enhancements in recent OS/400 releases.


cmd prompt('Display IFS file attributes')
parm kwd(ifsfile) type(*char) len(100) case(*mixed) min(1) +
    prompt('IFS file (case sensitive)')


CRTCMD CMD(TOOLS/DSPIFSATR)
       PGM(*LIBL/DSPIFSATRC)
       SRCFILE(TOOLSSRC/RTVIFSATR)
       SRCMBR(DSPIFSATR)
       ALLOW(*ALL)
       ALWLMTUSR(*NO)


pgm parm(&ifsfile)

/* Parameters */
dcl var(&ifsfile) type(*char) len(100)

/* Variables */
dcl var(&mode) type(*dec) len(10 0)
dcl var(&inode) type(*dec) len(10 0)
dcl var(&nlinks) type(*dec) len(5 0)
dcl var(&userid) type(*dec) len(10 0)
dcl var(&groupid) type(*dec) len(10 0)
dcl var(&size) type(*dec) len(10 0)
dcl var(&adate) type(*char) len(7)
dcl var(&atime) type(*char) len(6)
dcl var(&mdate) type(*char) len(7)
dcl var(&mtime) type(*char) len(6)
dcl var(&cdate) type(*char) len(7)
dcl var(&ctime) type(*char) len(6)
dcl var(&device) type(*dec) len(10 0)
dcl var(&bsize) type(*dec) len(10 0)
dcl var(&asize) type(*dec) len(10 0)
dcl var(&objtype) type(*char) len(12)
dcl var(&codepage) type(*dec) len(10 0)

             RTVIFSATR  IFSFILE(&IFSFILE) MODE(&MODE) INODE(&INODE) +
                          NLINKS(&NLINKS) USERID(&USERID) +
                          GROUPID(&GROUPID) SIZE(&SIZE) +
                          ADATE(&ADATE) ATIME(&ATIME) MDATE(&MDATE) +
                          MTIME(&MTIME) CDATE(&CDATE) CTIME(&CTIME) +
                          DEVICE(&DEVICE) BSIZE(&BSIZE) +
                          ASIZE(&ASIZE) OBJTYPE(&OBJTYPE) +
                          CODEPAGE(&CODEPAGE)

monmsg msgid(cpf0000) exec(do)
    sndpgmmsg msgid(cpf9897) msgf(qcpfmsg) msgtype(*escape) +
         msgdta('There was a problem getting attributes for IFS +
         file "' *cat &ifsfile *tcat '".')
    goto cmdlbl(endpgm)
enddo

call pgm(dspifsatre) parm(&ifsfile &mode &inode &nlinks &userid +
    &groupid &size &adate &atime &mdate &mtime &cdate &ctime +
    &device &bsize &asize &objtype &codepage)

endpgm:
endpgm

The panel group as provided is called dspifsatrg. If you want to use a different name, update the RPGLE program variable mypanel. The first 10 positiions are the panel group name, and the next 10 positions are its library (default is to search the library list, *LIBL).


      *-- Parameters

     d inpath          s            100a
     d inmode          s             10  0
     d ininode         s             10  0
     d innlinks        s              5  0
     d inuserid        s             10  0
     d ingroupid       s             10  0
     d insize          s             10  0
     d inadate         s              7a
     d inatime         s              6a
     d inmdate         s              7a
     d inmtime         s              6a
     d incdate         s              7a
     d inctime         s              6a
     d indevice        s             10  0
     d inbsize         s             10  0
     d inasize         s             10  0
     d inobjtype       s             12a
     d incodepage      s             10  0

      *-- Data structures

     d outbufh         ds
     d  outhifspath                  60a

     d outbuf          ds
     d  outadate                           like(inadate)
     d  outatime                           like(inatime)
     d  outmdate                           like(inmdate)
     d  outmtime                           like(inmtime)
     d  outobjtype                         like(inobjtype)
     d  outcdate                           like(incdate)
     d  outctime                           like(inctime)
     d  outuserid                     9b 0
     d  outgroupid                    9b 0
     d  outsize                       9b 0
     d  outasize                      9b 0
     d  outbsize                      9b 0
     d  outcodepage                   9b 0
     d  outmode                       9b 0
     d  outinode                      9b 0
     d  outnlinks                     9b 0
     d  outdevice                     9b 0

      *-- Variables

     d mybuflen        s              9b 0 inz(%size(outbuf))
     d mybuflenh       s              9b 0 inz(%size(outbufh))
     d myclsopt        s              1a   inz('M')
     d myerror         s              9b 0 inz
     d myexit          s              9b 0 inz(0)
     d myfunct         s              9b 0 inz
     d myhandle        s              8a   inz
     d myhelp          s              1a   inz('N')
     d mypanel         s             20a   inz('DSPIFSATRG*LIBL     ')
     d mypaneln        s             10a   inz('IFSATR    ')
     d myrecord        s             10a   inz('IFSADET   ')
     d myrecordh       s             10a   inz('IFSAHDR   ')
     d myredisp        s              1a   inz('N')
     d myscope         s              9b 0 inz(-1)

      *-- Lists

     c     *entry        plist
     c                   parm                    inpath
     c                   parm                    inmode
     c                   parm                    ininode
     c                   parm                    innlinks
     c                   parm                    inuserid
     c                   parm                    ingroupid
     c                   parm                    insize
     c                   parm                    inadate
     c                   parm                    inatime
     c                   parm                    inmdate
     c                   parm                    inmtime
     c                   parm                    incdate
     c                   parm                    inctime
     c                   parm                    indevice
     c                   parm                    inbsize
     c                   parm                    inasize
     c                   parm                    inobjtype
     c                   parm                    incodepage

     c     plopen        plist
     c                   parm                    myhandle
     c                   parm                    mypanel
     c                   parm                    myscope
     c                   parm                    myexit
     c                   parm                    myhelp
     c                   parm                    myerror

     c     plputvarh     plist
     c                   parm                    myhandle
     c                   parm                    outbufh
     c                   parm                    mybuflenh
     c                   parm                    myrecordh
     c                   parm                    myerror

     c     plputvar      plist
     c                   parm                    myhandle
     c                   parm                    outbuf
     c                   parm                    mybuflen
     c                   parm                    myrecord
     c                   parm                    myerror

     c     pldisplay     plist
     c                   parm                    myhandle
     c                   parm                    myfunct
     c                   parm                    mypaneln
     c                   parm                    myredisp
     c                   parm                    myerror

     c     plclose       plist
     c                   parm                    myhandle
     c                   parm                    myclsopt
     c                   parm                    myerror

      *-------------------------------------------------------------------------

      *-- Populate dialog variables - header
     c                   eval      outhifspath = inpath

      *-- Populate dialog variables - detail
     c                   eval      outobjtype = inobjtype
     c                   eval      outadate = inadate
     c                   eval      outatime = inatime
     c                   eval      outmdate = inmdate
     c                   eval      outmtime = inmtime
     c                   eval      outcdate = incdate
     c                   eval      outctime = inctime
     c                   eval      outuserid = inuserid
     c                   eval      outgroupid = ingroupid
     c                   eval      outsize = insize
     c                   eval      outasize = inasize
     c                   eval      outbsize = inbsize
     c                   eval      outcodepage = incodepage
     c                   eval      outmode = inmode
     c                   eval      outinode = ininode
     c                   eval      outdevice = indevice
     c                   eval      outnlinks = innlinks

      *-- Open panel for use
     c                   call      'QUIOPNDA'    plopen

      *-- Populate dialog variables
     c                   call      'QUIPUTV'     plputvarh
     c                   call      'QUIPUTV'     plputvar

      *-- Display the screen
     c                   call      'QUIDSPP'     pldisplay

      *-- Done
     c                   call      'QUICLOA'     plclose

     c                   eval      *inlr = *on

Use PDM option 14 (compile) to create the panel group. No special parameters are needed. This panel group is a display panel group including context-sensitive help.

:pnlgrp.

.*-------------------------------------------------------------------
.* Variable classes

:class   name=objtcl         basetype='char 12'.
:eclass.

:class   name=ifscl          basetype='char 60'.
:eclass.

:class   name=datecl         basetype='date'.
:tl.
:ti      value='"       "'.
:ti      value='"0000000"'.
:etl.
:eclass.

:class   name=timecl         basetype='time'.
:tl.
:ti      value='"000000"'.
:ti      value='"      "'.
:etl.
:eclass.

:class   name=bin31          basetype='bin 31'.
:eclass.

.*-------------------------------------------------------------------
.* Variables

.* Object type
:var     name=objtype        class=objtcl.

.* IFS object
:var     name=ifspath        class=ifscl.

.* Access date
:var     name=adate          class=datecl.

.* Access time
:var     name=atime          class=timecl.

.* Modified date
:var     name=mdate          class=datecl.

.* Modified time
:var     name=mtime          class=timecl.

.* Changed date
:var     name=cdate          class=datecl.

.* Changed time
:var     name=ctime          class=timecl.

.* User ID of owner
:var     name=userid         class=bin31.

.* Group ID of owner
:var     name=groupid        class=bin31.

.* Regular file size
:var     name=size           class=bin31.

.* Allocated size
:var     name=asize          class=bin31.

.* Block size
:var     name=bsize          class=bin31.

.* Code page
:var     name=codepage       class=bin31.

.* File mode
:var     name=mode           class=bin31.

.* Inode
:var     name=inode          class=bin31.

.* Number of links
:var     name=nlinks         class=bin31.

.* Device ID
:var     name=device         class=bin31.

.* Variable record for header
:varrcd  name=ifsahdr        vars='ifspath'.

.* Variable record for detail
:varrcd  name=ifsadet        vars='adate atime mdate mtime objtype'
         vars='cdate ctime userid groupid size asize bsize codepage'
         vars='mode inode nlinks device'.

.*-------------------------------------------------------------------
.* Define keys used

:keyl name=keys help=nohelp.
:keyi key=f1 help=nohelp action=help.
:keyi key=f3 help=nohelp action='exit set' varupd=no.F3=Exit
:keyi key=f12 help=nohelp action='cancel set' varupd=no.F12=Cancel
:keyi key=enter help=nohelp action=enter.
:keyi key=print help=nohelp action=print.
:keyi key=pageup help=nohelp action=pageup.
:keyi key=pagedown help=nohelp action=pagedown.
:ekeyl.

.*-------------------------------------------------------------------
.* Define panel

:panel name=ifsatr help=ifshelp keyl=keys enter='return 500' topsep=space.
Display IFS object attributes

.*-------------------------------------------------------------------
.* Define 1st presentation area (header)

:data depth=3 scroll=no layout=1 botsep=space compact.
:datacol width=12.
:datacol width='*'.

:datai var=ifspath help=nohelp usage=out.IFS object

:edata.

.*-------------------------------------------------------------------
.* Define 2nd presentation area (detail)

:data depth='*' scroll=yes layout=1 botsep=space.

.* 2 columns: 1st area for labels w/dot leaders.
.*            2nd area for values.
:datacol width=40.
:datacol width='*'.

:datagrp grpsep=none compact.
:datai var=userid help='ifshelp/hlpuid' usage=out.Owner's user ID
:datai var=groupid help='ifshelp/hlpgid' usage=out.Owner's group ID
:edatagrp.

:datagrp grpsep=none compact.
:datai var=size help='ifshelp/hlpsize' usage=out.IFS object size
:datai var=asize help='ifshelp/hlpasize' usage=out.Allocated IFS object size
:datai var=bsize help='ifshelp/hlpbsize' usage=out.Block size
:edatagrp.

:datagrp grpsep=none compact.
:datai var=adate help='ifshelp/hlpatime' usage=out.Accessed date and time
:dataix var=atime usage=out.
:datai var=mdate help='ifshelp/hlpmtime' usage=out.Data modified date and time
:dataix var=mtime usage=out.
:datai var=cdate help='ifshelp/hlpctime' usage=out.Object status change date and time
:dataix var=ctime usage=out.
:edatagrp.

:datagrp grpsep=none compact.
:datai var=objtype help='ifshelp/hlpobjtype' usage=out.AS/400 object type
:datai var=codepage help='ifshelp/hlpcodepage' usage=out.Object data code page
:edatagrp.

:datagrp grpsep=none compact.
:datai var=mode help='ifshelp/hlpmode' usage=out.Mode
:datai var=inode help='ifshelp/hlpinode' usage=out.Inode
:datai var=nlinks help='ifshelp/hlpnlinks' usage=out.Number of links
:datai var=device help='ifshelp/hlpdevice' usage=out.Device ID
:edatagrp.

:edata.
:epanel.

:help name=nohelp.
:ehelp.

:help name=ifshelp.Display IFS Attributes
:p.
The Display IFS attributes display shows the attributes of an
IFS object.
:ehelp.

:help name='ifshelp/hlpmode'.Mode
:xh3.Mode
:p.
The mode is a bit string indicating the permissions and
privileges of the IFS object.
:ehelp.

:help name='ifshelp/hlpinode'.Inode
:xh3.Inode
:p.
The inode is the file ID for the object. This number uniquely
identifies the object within the file system. When the inode and
device ID are used together, they uniquely identify the object on
the AS/400 system.
:ehelp.

:help name='ifshelp/hlpnlinks'.Number of links
:xh3.Number of links
:p.
This is the number of links to the object. This number is
always one or greater, as long as the object exists on the
system. If no symlinks or hard links are made to the file, the
number of links is 1.
:ehelp.

:help name='ifshelp/hlpuid'.User ID
:xh3.User ID
:p.
This is the numeric user ID (uid) of the owner of the object. This
number corresponds to the AS/400 user profile's User ID number
parameter.
:ehelp.

:help name='ifshelp/hlpgid'.Group ID
:xh3.Group ID
:p.
This is the numeric group ID (gid) of the owner of the object. This
number corresponds to the AS/400 user profile's Group ID number
parameter. If this number is 0, then the Group ID number is *NONE.
:ehelp.

:help name='ifshelp/hlpsize'.Size
:xh3.Size
:p.
This is the working size of the IFS object. The size is dependent
on the object type:
:parml.
:pt.Regular file
:pd.The number of data bytes in the file.
:pt.Directory
:pd.The number of bytes allocated to the directory.
:pt.Symbolic link
:pd.The number of bytes in the path name stored in the symbolic link.
:pt.Local socket
:pd.Always zero.
:pt.AS/400 native object
:pd.Dependent on the AS/400 object type.
:eparml.
:ehelp.

:help name='ifshelp/hlpatime'.Accessed date and time
:xh3.Accessed date and time
:p.
This is the most recent time the object was accessed.
:ehelp.

:help name='ifshelp/hlpmtime'.Data modified date and time
:xh3.Data modified date and time
:p.
This is the most recent time the contents of the object was changed.
:ehelp.

:help name='ifshelp/hlpctime'.Object status change date and time
:xh3.Object status change date and time
:p.
This is the most recent time the status of the object was changed.
:ehelp.

:help name='ifshelp/hlpdevice'.Device
:xh3.Device
:p.
The device ID is the file system ID to which the object belongs. This number uniquely
identifies the file system to which the object belongs. When the inode and
device ID are used together, they uniquely identify the object on
the AS/400 system.
:ehelp.

:help name='ifshelp/hlpbsize'.Block size
:xh3.Block size
:p.
This is the block size of the IFS object in bytes.
:ehelp.

:help name='ifshelp/hlpasize'.Allocated size
:xh3.Allocated size
:p.
This is number of bytes allocated to the object. This number
represents the number of bytes used by the file system to store
the object, and is usually an increment of the block size value,
rounded to the next highest increment.
:ehelp.

:help name='ifshelp/hlpobjtype'.Object type
:xh3.Object type
:p.
This is the AS/400 object type; for example, *STMF or *DIR.
:ehelp.

:help name='ifshelp/hlpcodepage'.Code page
:xh3.Code page
:p.
This is the code pages used for the data in the file or the
extended attributes of the directory.
:ehelp.

:epnlgrp.