• Subject: RE: ILE C Program Write Access
  • From: "Bob Crothers" <bob@xxxxxxxxxxxxxx>
  • Date: Wed, 11 Apr 2001 12:58:13 -0500
  • Importance: Normal

Joseph,

Now days I rarely do DB IO from C.  Instead, I use RPG to handle that
and do the fun stuff in C.

Opening with fopen("file", "r+") is a text mode open for both reading
and writing.  You probably want to use "r+b" for binary mode reading
and writing.

Also, you might want to signup for the C400 mailing list at
http://www.midrange.com/c400-l.shtml

Bob

-----Original Message-----
From: owner-midrange-l@midrange.com
[mailto:owner-midrange-l@midrange.com]On Behalf Of Joseph L. Eaton
Sent: Monday, April 09, 2001 4:13 PM
To: midrange-l@midrange.com
Subject: ILE C Program Write Access

 Hello all,
         We have just recently installed ILE-C on our AS/400(v4r3) and
are
 having difficulty opening any files with write access with the
compiled
 programs.  Any files on the system can be opened and read without
 problems.  As soon as I set the fopen flag to allow write access the
 open fails with errno = 3101.  I have tried this on files that I
myself
 have create, and also have tried running the program as qsecofr with
the
 same results.  The following is the dspfd output for the file and the
 open command in the code.  What am I missing?

         Thanks,
                 Joe Eaton

 Open command that fails with errno = 3101
 if ((bciin = fopen("eatonj/pg2001_bci", "r+")) == NULL)

 DSPFD FILE(EATONJ/PG2001_BCI)

     4/04/01                Display File Description
   DSPFD Command Input
     File  . . . . . . . . . . . . . . . . . . . : FILE
PG2001_BCI
       Library . . . . . . . . . . . . . . . . . :            EATONJ
     Type of information . . . . . . . . . . . . : TYPE       *ALL
     File attributes . . . . . . . . . . . . . . : FILEATR    *ALL
     System  . . . . . . . . . . . . . . . . . . : SYSTEM     *LCL
   File Description Header
     File  . . . . . . . . . . . . . . . . . . . : FILE
PG2001_BCI
     Library . . . . . . . . . . . . . . . . . . :            EATONJ
     Type of file  . . . . . . . . . . . . . . . :            Physical
     File type . . . . . . . . . . . . . . . . . : FILETYPE   *DATA
     Auxiliary storage pool ID . . . . . . . . . :            01
   Data Base File Attributes
     Externally described file . . . . . . . . . :            Yes
     SQL file type . . . . . . . . . . . . . . . :            TABLE
  File level identifier . . . . . . . . . . . :
1010321150900
     Creation date . . . . . . . . . . . . . . . :            03/21/01
     Text 'description'  . . . . . . . . . . . . : TEXT
     Distributed file  . . . . . . . . . . . . . :            No
     DBCS capable  . . . . . . . . . . . . . . . :            No
     Maximum members . . . . . . . . . . . . . . : MAXMBRS        1
     Number of constraints . . . . . . . . . . . :                0
     Number of triggers  . . . . . . . . . . . . :                0
     Number of members . . . . . . . . . . . . . :                1
     Member size . . . . . . . . . . . . . . . . : SIZE       *NOMAX
     Allocate storage  . . . . . . . . . . . . . : ALLOCATE   *NO
     Contiguous storage  . . . . . . . . . . . . : CONTIG     *NO
     Preferred storage unit  . . . . . . . . . . : UNIT       *ANY
     Records to force a write  . . . . . . . . . : FRCRATIO   *NONE
     Maximum file wait time  . . . . . . . . . . : WAITFILE   *IMMED
     Maximum record wait time  . . . . . . . . . : WAITRCD       60
     Max % deleted records allowed . . . . . . . : DLTPCT     *NONE
     Reuse deleted records . . . . . . . . . . . : REUSEDLT   *YES
     Coded character set identifier  . . . . . . : CCSID         37
     Allow read operation  . . . . . . . . . . . :            Yes
     Allow write operation . . . . . . . . . . . :            Yes
     Allow update operation  . . . . . . . . . . : ALWUPD     *YES
     Allow delete operation  . . . . . . . . . . : ALWDLT     *YES
     Record format level check . . . . . . . . . : LVLCHK     *YES
     Access path . . . . . . . . . . . . . . . . :            Arrival
     Access path size  . . . . . . . . . . . . . : ACCPTHSIZ  *MAX1TB
     Maximum record length . . . . . . . . . . . :               16
     File is currently journaled . . . . . . . . :            No
   Access Path Description
     Access path . . . . . . . . . . . . . . . . :            Arrival
     Sort Sequence . . . . . . . . . . . . . . . : SRTSEQ     *HEX
     Language identifier . . . . . . . . . . . . : LANGID     ENU
 Member Description
     Member  . . . . . . . . . . . . . . . . . . : MBR
PG2001_BCI
       Member level identifier . . . . . . . . . :
 1010321150900
       Member creation date  . . . . . . . . . . :            03/21/01
       Text 'description'  . . . . . . . . . . . : TEXT
       Expiration date for member  . . . . . . . : EXPDATE    *NONE
       Member size . . . . . . . . . . . . . . . : SIZE       *NOMAX
       Current number of records . . . . . . . . :
2606
       Number of deleted records . . . . . . . . :
0
       Allocate storage  . . . . . . . . . . . . : ALLOCATE   *NO
       Contiguous storage  . . . . . . . . . . . : CONTIG     *NO
       Preferred storage unit  . . . . . . . . . : UNIT       *ANY
       Records to force a write  . . . . . . . . : FRCRATIO   *NONE
       Share open data path . . . . . . . .  . . : SHARE      *NO
       Max % deleted records allowed . . . . . . : DLTPCT     *NONE
       Data Space Activity Statistics  . . . . . :
         Data space size in bytes  . . . . . . . :              57344
         Physical file open accesses . . . . . .
:                            55
         Physical file close accesses  . . . . .
:                            55
         Write operations  . . . . . . . . . . .
:                         2,606
         Update operations . . . . . . . . . . .
:                             4
         Delete operations . . . . . . . . . . . :
         Logical Reads . . . . . . . . . . . . . : 226,046
         Physical Reads  . . . . . . . . . . . .
:                           377
         Clear operations  . . . . . . . . . . . :
         Data space copy operations  . . . . . . :
         Reorganize operations . . . . . . . . . :
         Access paths builds/rebuilds  . . . . . :
         Records rejected by key selection . . . :
         Records rejected by non-key selection . : 10,420
         Records rejected by group-by selection. :
       Access Path Activity Statistics . . . . . :
         Access path logical reads . . . . . . . :
         Access path physical reads  . . . . . . :
         Implicit access path sharing  . . . . . :            No
       Last change date/time . . . . . . . . . . :            03/23/01
11:06:45
       Last save date/time . . . . . . . . . . . :            04/04/01
01:28:48
       Last restore date/time  . . . . . . . . . :
       Date last used  . . . . . . . . . . . . . :            04/04/01
       Days used count . . . . . . . . . . . . . :                5
       Date use count reset  . . . . . . . . . . :
   Record Format List
                          Record  Format Level
    Format       Fields   Length  Identifier
    PG2001_BCI        2       16  300AB1914628D
      Text . . . . . . . . . . . . . . . . . . . :
    Total number of formats  . . . . . . . . . . :           1
    Total number of fields . . . . . . . . . . . :           2
    Total record length  . . . . . . . . . . . . :          16
   Member List
                                Source Creation    Last Change
    Member           Size        Type  Date       Date     Time
Records
    PG2001_BCI            57344        03/21/01 03/23/01 11:06:45 2606
      Text:
    Total number of members  . . . . . . . . . :                 1
    Total number of members not available  . . :                 0
    Total records  . . . . . . . . . . . . . . :              2606
    Total deleted records  . . . . . . . . . . :                 0
    Total of member sizes  . . . . . . . . . . :             57344


-----------------------------------------------------------------------
----
Viox Services Inc. - Information Systems
15 West Voorhees Street
Cincinnati Ohio  45215

Voice:  513.679.3377
FAX:    513.679.3308
EMail:  joe.eaton@viox-services.com
-----------------------------------------------------------------------
----
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...

Replies:

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 on our policy page. If you have questions about this, please contact [javascript protected email address].