× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Mike Schlemme wrote:

>I am trying to find a API to give me the same information as doing the
>following:
>
>1.  WRKLNK
>2.  Option 8 (Display Attributes) on any item in the list
>
>I'm mainly interested in object owner and object size.

I'm not familiar with Bruce's suggestion of Get Attributes (Qp0lGetAttr).  I
use the C function stat().  Compile with BNDDIR(QC2LE).  The RPG IV redbook
probably has a better example...

 * File stats                                        
 *   #include <sys/stat.h>                           
 *                                                   
 *   int stat(const char *path, struct stat *buf);   
 *                                                   
Dstat             pr            10i 0 extproc('stat')
D                                 *   value          
D                                 *   value          

 * Returned file status structure                                      
 *  struct stat {                                                      
 *    unsigned int   st_mode;       /* File mode                       
 *    unsigned int   st_ino;        /* File serial number              
 *    unsigned short st_nlink;      /* Number of links                 
 *    unsigned int   st_uid;        /* User ID of the owner of file    
 *    unsigned int   st_gid;        /* Group ID of the group of file   
 *    int            st_size;       /* For regular files, the file     
 *                                     size in bytes                   
 *    long int       st_atime;      /* Time of last access             
 *    long int       st_mtime;      /* Time of last data modification  
 *    long int       st_ctime;      /* Time of last file status change 
 *    unsigned int   st_dev;        /* ID of device containing file    
 *    unsigned int   st_blksize;    /* Size of a block of the file     
 *    unsigned long  st_allocsize;  /* Allocation size of the file     
 *    char[11]       st_objtype;    /* AS/400 object type              
 *    unsigned short st_codepage;   /* Object data codepage            
 *    char           st_reserved1[62]; /* Reserved                     
 *    unsigned int   st_ino_gen_id; /* File serial number generation id
 *  };                                                                 
 *                                                                     
                                                           
 * The OVERLAY is needed to align for the halfword st_nlink
Dinfo             DS                  inz                  
D st_mode                       10U 0                      
D st_ino                        10U 0                      
D st_nlink                       5U 0                      
D st_res                         5U 0                      
D st_uid                        10U 0                      
D st_gid                        10U 0                      
D st_size                       10U 0                      
D st_atime                      10U 0                      
D st_mtime                      10U 0                      
D st_ctime                      10U 0                      
D st_dev                        10U 0                      
D st_blksize                    10U 0                      
D st_alloc                      10U 0                      
D st_objtype                    10A                        
D st_cp                          5U 0                      
D st_res1                       61A                        
D st_ino_gi                     10U 0                      

Drc               s             10I 0 inz 
DNULL             s              1    inz(x'00') 
Ddir_full         s             64    inz
                                                                   
C* Build a full path/file name (with null termination) 
C                   eval      dir_full=%trim(dirnameSV) +          
C                                      '/' + %trim(filename) + NULL
                                                                   
C* See if it's really a file or not                                
C                   eval      rc=stat(full_fn:%addr(info))         
C                   If        rc<>0                                

Buck Calabro
Aptis; Albany, NY
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.