I have the following RPG copybook that prototypes C library functions:

/**

 * RPG Procedures definitions for accessing IFS files via C functions.

 * Based on article on iSeriesNetwork.com by Jef Sutherland

 * If you create an IFS file, specify 'w codepage=1252' on the open,
then       
 * close it and reopen with 'a codepage=37'.  This will cause the
fputs()       
 * function to translate the data from EBCDIC to ASCII and back for
fgets().    
 * Open Modes and their meanings:

 * 'r'  Open existing file for reading - Fails if not found

 * 'w'  Creates empty file for writting - Clears existing file

 * 'a'  Open existing file for appending - Creates file if not found

 * 'r+' Open existing file for reading/writing - Fails if not found

 * 'w+' Creates empty file for reading/writting - Clears existing file

 * 'a+' Open existing file for reading/appending - Creates file if not
found    
* @version V0R0M0

 * @see
http://www.iseriesnetwork.com/artarchiveImages/2004/jan/17693-fig1.html 
 * @see
http://www.iseriesnetwork.com/artarchiveImages/2004/jan/17693-Fig2.html 
 */

D/IF              NOT DEFINED(UTL_IFS)

D/DEFINE          UTL_IFS

 

DifsOpn           PR              *   EXTPROC( '_C_IFS_fopen' )
Open IFS file    
D                                 *   VALUE OPTIONS( *String )
<full filename   
D                                 *   VALUE OPTIONS( *String )
<options         
 

DifsClo           PR            10I 0 EXTPROC( '_C_IFS_fclose' )
Close IFS file   
D                                 *   VALUE
<file pointer    
 

DifsDlt           PR            10I 0 EXTPROC( '_C_IFS_remove' )
Delete IFS file  
D                                 *   VALUE OPTIONS( *String )
<full filename   
 

DifsRd            PR              *   EXTPROC( '_C_IFS_fgets' )
Read IFS file    
D                                 *   VALUE
<record pointer  
D                               10I 0 VALUE
<size to read    
D                                 *   VALUE
<file pointer    
 

DifsWrt           PR            10I 0 EXTPROC( '_C_IFS_fputs' )
Write IFS file   
D                                 *   VALUE OPTIONS( *String )
<data to write   
D                                 *   VALUE
<file pointer      >
 

DifsFileErr       PR            10I 0 EXTPROC( 'ferror')
Chk File Errors     
D                                 *   VALUE
<file pointer      >
 

DifsSts           PR            10I 0 EXTPROC( 'lstat' )
Get File Status     
D                                 *   VALUE  OPTIONS( *String )
<STS struc pointer >
D                                 *   VALUE
<file pointer      >
 

DifsEOF           PR            10I 0 EXTPROC( '_C_IFS_feof' )
End of File Test    
D                                 *   VALUE
<file pointer      >
 

D p_ifsSts        S               *   Inz( %Addr( ifsSts_t ))

D ifsSts_t        DS                  Align
IFS Status Structure
D  st_mode                      10U 0

D  st_ino                       10U 0

D  st_nlink                      5U 0

D                                2A

D  st_uid                       10U 0

D  st_gid                       10U 0

D  st_size                      10I 0 
D  st_atime                     10I 0 
D  st_mtime                     10I 0 
D  st_ctime                     10I 0 
D  st_dev                       10U 0 
D  st_blksize                   10U 0 
D  st_allocsize                 10U 0 
D  st_objtype                   11A   
D                                1A   
D  st_codepage                   5U 0 
D  st_reserv1                   62A   
D  st_ino_gen_id                10U 0 
D/ENDIF                               


All was well until V5R3 (V4R5 to V5R2), now we get this during the call
to ferror() after doing an fgets():

>From program . . . . . . . . . :   QC2IFS     
  From library . . . . . . . . :     QSYS     
  From module  . . . . . . . . :     QC2IP124 
  From procedure . . . . . . . :     fp124    
  From statement . . . . . . . :     38       
                                              
To program . . . . . . . . . . :   QC2IFS     
  To library . . . . . . . . . :     QSYS     
  To module  . . . . . . . . . :     QC2IP124 
  To procedure . . . . . . . . :     fp124    
  To statement . . . . . . . . :     38       

    Pointer not set for location referenced.

    Function check. MCH3601 unmonitored by QC2IFS at statement
0000000038,
      instruction X'0000'.

    Application error.  *N unmonitored by *N at statement *N,
instruction 
      X'4000'.

    Function check. CEE9901 unmonitored by QUIMNDRV at statement *N,

      instruction X'0CDE'.

    Exception handler not available because of reason code 5.

    Function check. CPF2524 unmonitored by QUIMNDRV at statement *N,

      instruction X'0CDE'.


Any ideas?  Are these functions no longer supported?  I called IBM
support and he could not find ANY references to these functions at all.
Is there a better way to access the IFS from RPG?  

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].