× 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.




Are there any good examples of using api's accessing the IFS?  IBM's
or 
any body elses.

Want to "open", "read", and I guess "close" file, that a software
package 
to do Credit Card processing has decided to put some of there reports
(XML 
format) in the IFS.

Jim, if you would like to send an e-mail to me at alan0307d@xxxxxxxxxxx,
I will send you a zip with a service program XVIFSX that encapsulates
the IFS functions. 

I will, also, include some sample programs showing how they are used.

I am personally strongly opposed to the idea of putting the same code in
program after program. Why do we need to redevelop the API's on every
call when we have ILE? Isn't that why they gave it to us?

Sorry for the rant. The boss wife has been sending me e-mails all day
telling me how stupid my programming is and I am more than a little
upset. 

This is the prototype so you can see you get open, readtextline,
readtext, close, delete, write, get file size, get CCSID and get
Codepage. All the logic to do IFS in a service program. 

      * Object.....: XVIFSX_PR
      * Description: Prototypes-Integrated File System Functions.
      * By.........: Alan G. Campin
      * Date.......: 06/16/2006
      * Purpose....: Prototypes for IFS Functions.
 
*-----------------------------------------------------------------------
----------------------
      * Program Modification Section:
      *------------------------------
      * By.........:
      * Date.......:
      * Description:
      *
 
*=======================================================================
===
      * IFSX_OpenText
      *   Open Integrated File System File for text read and write.
      *      In Parms - File Path (ex: /home/campin/file)
      *                 Open Flag - How to open file (accumulation of
open
      *                             file values - see prototypes for
actual
      *                               values).
      *                 Mode      - user authorities for opening file
      *                             (accumulation of values - see proto-
      *                              types for actual values).
      *                 OutputCCSID - CCSID of output file.
      *                 InputCCSID  - CCSID of Input.
      *  In/Out Parms - None.
      *  Out    Parms - None.
      *  Return       - File Handle.
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_OpenText...
     d                 pr                  Like(StdInt)
     d                                     ExtProc('IFSX_OpenText')
     d   PR_InFilePath...
     d                              512    Varying
     d                                     Value
     d   PR_InOpenFlag...
     d                                     Like(StdInt)
     d                                     Value
     d   PR_InOpenMode...
     d                                     Like(StdIntUns)
     d                                     Options(*NoPass)
     d                                     Value
     d   PR_InOutputCCSID...
     d                                     Like(StdIntUns)
     d                                     Options(*NoPass)
     d                                     Value
     d   PR_InInputCCSID...
     d                                     Like(StdIntUns)
     d                                     Options(*NoPass)
     d                                     Value
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
      * IFSX_CloseFile
      *   Close Integrated File System File.
      *  In Parms     - File Handle
      *  In/Out Parms - None
      *  Out Parms    - None
      *  Return       - None
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_CloseFile...
     d                 pr
     d                                     ExtProc('IFSX_CloseFile')
     d   PR_InFileHandle...
     d                                     Like(StdInt)
     d                                     Value
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
      * IFSX_DeleteFile
      *   Delete Integrated File System File. Use Unix Unlink API to
delete
      *     a file. If the path is a symbolic link, it will just delete
      *     the link but leave the file. If there are no other links,
the
      *     file is deleted.
      *  In Parms     - File Path.
      *  In/Out Parms - None.
      *  Out Parms    - None.
      *  Return       - None.
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_DeleteFile...
     d                 pr
     d                                     ExtProc('IFSX_DeleteFile')
     d   PR_InFilePath...
     d                              512    Varying
     d                                     Value
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
      * IFSX_ReadLineText
      * Read Integrated File System File in text mode. Records are
      *   debuffered into line with CR/LF. If does not have a CR/LF
      *   read until EOF or Record Buffer is full.
      *  In Parms     - File Handle.
      *                 Record Length.
      *  In/Out Parms - None
      *  Out Parms    - End Of File True/False.
      *                 Output Record.
      *  Return       - Characters in Record.
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_ReadLineText...
     d                 pr                  Like(StdInt)
     d                                     ExtProc('IFSX_ReadLineText')
     d   PR_InFileHandle...
     d                                     Like(StdInt)
     d                                     Value
     d   PR_InRecordLength...
     d                                     Like(StdInt)
     d                                     Value
     d   PR_OutEOF...
     d                                     Like(StdLgl)
     d   PR_OutRecord...
     d                            32767    Options(*VarSize)
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
      * IFSX_ReadText
      *   Read Integrated File System File in text mode. Buffer is
filled
      *   until either buffer is full or EOF.
      *  In Parms     - File Handle.
      *                 Record Length.
      *  In/Out Parms - None
      *  Out Parms    - End Of File True/False.
      *                 Output Record.
      *  Return       - Characters in Record.
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_ReadText...
     d                 pr                    ExtProc('IFSX_ReadText')
     d                                       Like(StdInt)
     d  PR_InFileHandle...
     d                                     Like(StdInt)
     d                                     Value
     d  PR_InRecordLength...
     d                                     Like(StdInt)
     d                                     Value
     d  PR_OutEOF...
     d                                     Like(StdLgl)
     d  PR_OutRecord...
     d                            32767    Options(*VarSize)
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
      * IFSX_WriteText
      *   Write Text To Integrated File System.
      *  In Parms     - File Handle.
      *               - Add EOL to data stream. True or False.
      *               - Text to Write.
      *  In/Out Parms - None.
      *  Out Parms    - None.
      *  Return       - Bytes Written.
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_WriteText...
     d                 pr                  Like(StdInt)
     d                                     ExtProc('IFSX_WriteText')
     d   PR_InFileHandle...
     d                                     Like(StdInt)
     d                                     Value
     d   PR_InAddEndOfLine...
     d                                     Like(StdLgl)
     d                                     Value
     d   PR_InText...
     d                            32767    Varying
     d                                     Const
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
      * IFSX_GetSize...
      *   Function get size of given file in bytes.
      *  In Parms     - File Path.
      *  In/Out Parms - None.
      *  Out Parms    - None.
      *  Return       - File Size in Bytes.
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_GetSize...
     d                 pr                  Like(StdInt)
     d                                     ExtProc('IFSX_GetSize')
     d   PR_InFilePath...
     d                              512    Varying
     d                                     Value
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
      * IFSX_GetCodePage...
      *   Function gets codepage of a given file.
      *  In Parms     - File Path.
      *  In/Out Parms - None.
      *  Out Parms    - None.
      *  Return       - Code Page.
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_GetCodePage...
     d                 pr                  Like(StdIntSmlUns)
     d                                     ExtProc('IFSX_GetCodePage')
     d   PR_InFilePath...
     d                              512    Varying
     d                                     Value
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
      * IFSX_GetCCSID...
      *   Function gets CCSID of a given IFS file.
      *  In Parms     - File Path.
      *  In/Out Parms - None.
      *  Out Parms    - None.
      *  Return       - CCSID.
      *= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =
     d IFSX_GetCCSID...
     d                 pr                  Like(StdIntSmlUns)
     d                                     ExtProc('IFSX_GetCCSID')
     d   PR_InFilePath...
     d                              512    Varying
     d                                     Value
      * Define file information structure.
     d TD_FileStats...
     d                 ds                  Qualified
     d                                     Based(StdNulPtr)
     d    FileMode...
     d                                     Like(StdIntUns)
     d    FileSeriealNumber...
     d                                     Like(StdIntUns)
     d    NumberOfLinks...
     d                                     Like(StdIntSmlUns)
     d    Reserved1...
     d                                     Like(StdIntSmlUns)
     d    UserId...
     d                                     Like(StdIntUns)
     d    GroupId...
     d                                     Like(StdIntUns)
     d    FileSizeInBytes...
     d                                     Like(StdInt)
     d    LastAccessTime...
     d                                     Like(StdInt)
     d    LastModificationTime...
     d                                     Like(StdInt)
     d    LastFileStatusChange...
     d                                     Like(StdInt)
     d    IdOfDeviceHoldingFile...
     d                                     Like(StdIntUns)
     d    FileBlockSize...
     d                                     Like(StdIntUns)
     d    AllocationSizeOfFile...
     d                                     Like(StdIntUns)
     d    AS400ObjectType...
     d                               11a
     d    Reserved2...
     d                                     Like(StdChr)
     d    CodePage...
     d                                     Like(StdIntSmlUns)
     d    CCSID...
     d                                     Like(StdIntSmlUns)
     d    DeviceIdIfSpecial...
     d                                     Like(StdIntUns)
     d    NumberOfLinks32Bit...
     d                                     Like(StdIntUns)
     d    DeviceId64Bit...
     d                               20u 0
     d    IdOfDeviceHoldingFile64Bit...
     d                               20u 0
     d    Reserved3...
     d                               36a
     d    FileSerialGenId...
     d                                     Like(StdIntUns)
 
**********************************************************************
      * Flags for use in open()
      *
      * More than one can be used -- add them together.
     d O_RDONLY        C                   1
     d O_WRONLY        C                   2
     d O_RDWR          C                   4
     d O_CREAT         C                   8
     d O_EXCL          C                   16
     d O_CCSID         C                   32
     d O_TRUNC         C                   64
     d O_APPEND        C                   256
     d O_SYNC          C                   1024
     d O_DSYNC         C                   2048
     d O_RSYNC         C                   4096
     d O_NOCTTY        C                   32768
     d O_SHARE_RDONLY  C                   65536
     d O_SHARE_WRONLY  C                   131072
     d O_SHARE_RDWR    C                   262144
     d O_SHARE_NONE    C                   524288
     d O_CODEPAGE      C                   8388608
     d O_TEXTDATA      C                   16777216
      /if defined(*V5R2M0)
      * Note: O_TEXT_CREAT requires all of the following flags to work:
      *           O_CREAT+O_TEXTDATA+(O_CODEPAGE or O_CCSID)
     d O_TEXT_CREAT    C                   33554432
      /endif
     d O_INHERITMODE   C                   134217728
      *  00100000000000000000000000000000          Large file access
      *                                            (for >2GB files)
     d O_LARGEFILE     C                   536870912

 
**********************************************************************
      * Access mode flags for access() and accessx()
      *
      *   F_OK = File Exists
      *   R_OK = Read Access
      *   W_OK = Write Access
      *   X_OK = Execute or Search
 
**********************************************************************
     d F_OK            C                   0
     d R_OK            C                   4
     d W_OK            C                   2
     d X_OK            C                   1

 
**********************************************************************
      * class of users flags for accessx()
      *
      *   ACC_SELF = Check access based on effective uid/gid
      *   ACC_INVOKER = Check access based on real uid/gid
      *                 ( this is equvalent to calling access() )
      *   ACC_OTHERS = Check access of someone not the owner
      *   ACC_ALL = Check access of all users
 
**********************************************************************
     d ACC_SELF        C                   0
     d ACC_INVOKER     C                   1
     d ACC_OTHERS      C                   8
     d ACC_ALL         C                   32

 
**********************************************************************
      *      Mode Flags.
      *         basically, the mode parm of open(), creat(), chmod(),etc
      *         uses 9 least significant bits to determine the
      *         file's mode. (peoples access rights to the file)
      *
      *           user:       owner    group    other
      *           access:     R W X    R W X    R W X
      *           bit:        8 7 6    5 4 3    2 1 0
      *
      * (This is accomplished by adding the flags below to get the mode)
 
**********************************************************************
      *                                         owner authority
     d S_IRUSR         C                   256
     d S_IWUSR         C                   128
     d S_IXUSR         C                   64
     d S_IRWXU         C                   448
      *                                         group authority
     d S_IRGRP         C                   32
     d S_IWGRP         C                   16
     d S_IXGRP         C                   8
     d S_IRWXG         C                   56
      *                                         other people
     d S_IROTH         C                   4
     d S_IWOTH         C                   2
     d S_IXOTH         C                   1
     d S_IRWXO         C                   7
      *                                         special modes:
      *                                         Set effective GID
     d S_ISGID         C                   1024
      *                                         Set effective UID
     d S_ISUID         C                   2048

 
**********************************************************************
      * My own special MODE shortcuts for open() (instead of those
above)
 
**********************************************************************
     d M_RDONLY        C                   const(292)
     d M_RDWR          C                   const(438)
     d M_RWX           C                   const(511)

 
**********************************************************************
      * "whence" constants for use with seek(), lseek() and others
 
**********************************************************************
     d SEEK_SET        C                   CONST(0)
     d SEEK_CUR        C                   CONST(1)
     d SEEK_END        C                   CONST(2)


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.