Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
isam.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 
00037 /*
00038  *       C-ISAM version 3.00
00039  *  Indexed Sequential Access Method
00040  *  Relational Database Systems, Inc.
00041  */
00042 /***********************************************************************
00043  *
00044  *  Edit history:
00045  *
00046  *  12-Sep-87   MAN     (012)
00047  *      Added EBIGRECN for COBOL85, used when the relative record number
00048  *      read, no longer fits into the COBOL data-item that is to hold it.
00049  *  24-Aug-87   RPL 011
00050  *      Add error code 166 for bad PL/I F format (PER 6060).
00051  *      Remove tabs from some comments.
00052  *  10-Aug-87   IAG 010
00053  *      This version is to be used with rev. 3 of ISAM. 
00054  *   4-Jun-87   RPL 009
00055  *      Move extern data and structure declarations outside of #ifdef.
00056  *  11-May-87   WKD 008
00057  *      Add new file status codes for variable length records.
00058  *  04-Apr-87   WKD 007
00059  *      Add cobol85 new file status codes.
00060  *  12-Mar-87   TLF 006
00061  *      Added comment stating that COLLATE3 code is now used by LPI-RPG
00062  *      to support indexed files in EBCDIC collating sequence.
00063  *   6-Mar-87   ABC 005
00064  *      Comment out extraneous tokens on 'endif' line (non-portable)
00065  *  21-Jan-87   PLB 004
00066  *      Undo macro defs for ldint/stint for STORAGE_RIGHT_TO_LEFT case
00067  *      (these guys are portable as is)
00068  *  30-Jul-86   RCG 003
00069  *      Corrected a #end to #endif (causing cc problems)
00070  *  10-Jul-86  PLB
00071  *      Handle macro defs for ldint/stint for 386 portability
00072  *      Add Error defs 142-149 to match with RTLERRORS_IN
00073  *      Reverse edit history
00074  *  30-Jan-86 nlb
00075  *      Add error code for not open for read
00076  *  21-Aug-85  RPL
00077  *      Add definitions to support RPG packed keys.
00078  *
00079  **********************************************************************/
00080 
00081 #ifndef _ISAM_INCL              /* avoid multiple include problems */
00082 #define _ISAM_INCL
00083 
00084 #ifdef __cplusplus
00085 extern "C" {
00086 #endif
00087 
00088 #define CHARTYPE        0
00089 #define DECIMALTYPE     0
00090 #define CHARSIZE        1
00091 
00092 #define INTTYPE         1
00093 #define INTSIZE         2
00094 
00095 #define LONGTYPE        2
00096 #define LONGSIZE        4
00097 
00098 #define DOUBLETYPE      3
00099 #define DOUBLESIZE      (sizeof(double))
00100 
00101 #define FLOATTYPE       4
00102 #define FLOATSIZE       (sizeof(float))
00103 
00104 /*  the following 2 defines are to support RPG Packed keys:  */
00105 #define PACKTYPE        100
00106 #define PACKSIZE        0
00107 
00108 #define USERCOLL(x)     ((x))
00109 
00110 #define COLLATE1        0x10
00111 #define COLLATE2        0x20
00112 
00113 /*  COLLATE3 is used by LPI_RPG to support indexed files in EBCDIC collating sequence  */
00114 
00115 #define COLLATE3        0x30
00116 #define COLLATE4        0x40
00117 #define COLLATE5        0x50
00118 #define COLLATE6        0x60
00119 #define COLLATE7        0x70
00120 
00121 #define MAXTYPE         5
00122 #define ISDESC          0x80    /* add to make descending type  */
00123 #define TYPEMASK        0x7F    /* type mask                    */
00124 
00125 #ifdef _BBN                     /* BBN Machine has 10 bits/byte */
00126 #define BYTEMASK  0x3FF         /* mask for one byte            */
00127 #define BYTESHFT  10            /* shift for one byte           */
00128 #else
00129 #define BYTEMASK  0xFF          /* mask for one byte            */
00130 #define BYTESHFT  8             /* shift for one byte           */
00131 #endif
00132 
00133 #ifndef __ldint
00134 #define ldint(p)        ((short)(((p)[0]<<BYTESHFT)+((p)[1]&BYTEMASK)))
00135 #define stint(i,p)      ((p)[0]=(i)>>BYTESHFT,(p)[1]=(i))
00136 #endif  /* __ldint */
00137 
00138 #define ISFIRST         0       /* position to first record     */
00139 #define ISLAST          1       /* position to last record      */
00140 #define ISNEXT          2       /* position to next record      */
00141 #define ISPREV          3       /* position to previous record  */
00142 #define ISCURR          4       /* position to current record   */
00143 #define ISEQUAL         5       /* position to equal value      */
00144 #define ISGREAT         6       /* position to greater value    */
00145 #define ISGTEQ          7       /* position to >= value         */
00146 
00147 /* isread lock modes */
00148 #define ISLOCK          0x100   /* record lock                  */
00149 #define ISWAIT          0x400   /* wait for record lock         */
00150 #define ISLCKW          0x500   /* ISLOCK + ISWAIT              */
00151 #define ISSLEEPLOCK     0x1000  /* IAG                          */
00152 
00153 /* isopen, isbuild lock modes */
00154 #define ISAUTOLOCK      0x200   /* automatic record lock        */
00155 #define ISMANULOCK      0x400   /* manual record lock           */
00156 #define ISEXCLLOCK      0x800   /* exclusive isam file lock     */
00157 
00158 #define ISINPUT         0       /* open for input only          */
00159 #define ISOUTPUT        1       /* open for output only         */
00160 #define ISINOUT         2       /* open for input and output    */
00161 #define ISTRANS         4       /* open for transaction proc    */
00162 #define ISNOLOG         8       /* no loggin for this file      */
00163 
00164 /* audit trail mode parameters */
00165 #define AUDSETNAME      0       /* set new audit trail name     */
00166 #define AUDGETNAME      1       /* get audit trail name         */
00167 #define AUDSTART        2       /* start audit trail            */
00168 #define AUDSTOP         3       /* stop audit trail             */
00169 #define AUDINFO         4       /* audit trail running ?        */
00170 
00171 #define MAXKEYSIZE      120     /* max number of bytes in key   */
00172 #define NPARTS          8       /* max number of key parts      */
00173 
00174 #define k_start   k_part[0].kp_start
00175 #define k_leng    k_part[0].kp_leng
00176 #define k_type    k_part[0].kp_type
00177 
00178 #define ISNODUPS  000           /* no duplicates allowed        */
00179 #define ISDUPS    001           /* duplicates allowed           */
00180 #define DCOMPRESS 002           /* duplicate compression        */
00181 #define LCOMPRESS 004           /* leading compression          */
00182 #define TCOMPRESS 010           /* trailing compression         */
00183 #define COMPRESS  016           /* all compression              */
00184 #define ISCLUSTER 020           /* index is a cluster one       */
00185 
00186 #define ISAM_ERR_OFFSET 31
00187 #define EDUPL     100+ISAM_ERR_OFFSET           /* Duplicate record     */
00188 #define ENOTOPEN  101+ISAM_ERR_OFFSET           /* File not open        */
00189 #define EBADARG   102+ISAM_ERR_OFFSET           /* Illegal argument     */
00190 #define EBADKEY   103+ISAM_ERR_OFFSET           /* Illegal key desc     */
00191 #define ETOOMANY  104+ISAM_ERR_OFFSET           /* Too many files open  */
00192 #define EBADFILE  105+ISAM_ERR_OFFSET           /* Bad isam file format */
00193 #define ENOTEXCL  106+ISAM_ERR_OFFSET           /* Non-exclusive access */
00194 #define ELOCKED   107+ISAM_ERR_OFFSET           /* Record locked        */
00195 #define EKEXISTS  108+ISAM_ERR_OFFSET           /* Key already exists   */
00196 #define EPRIMKEY  109+ISAM_ERR_OFFSET           /* Is primary key       */
00197 #define EENDFILE  110+ISAM_ERR_OFFSET           /* End/begin of file    */
00198 #define ENOREC    111+ISAM_ERR_OFFSET           /* No record found      */
00199 #define ENOCURR   112+ISAM_ERR_OFFSET           /* No current record    */
00200 #define EFLOCKED  113+ISAM_ERR_OFFSET           /* File locked          */
00201 #define EFNAME    114+ISAM_ERR_OFFSET           /* File name too long   */
00202 #define ENOLOK    115+ISAM_ERR_OFFSET           /* Can't create lock file */
00203 
00204 
00205 
00206 #define EDUPWARN  116+ISAM_ERR_OFFSET           /* Duplicate record (warning) */
00207 #define ENOCRP    117+ISAM_ERR_OFFSET           /* Current record pointer undefined */
00208 #define EBADMEM   118+ISAM_ERR_OFFSET           /* Can't alloc memory   */
00209 #define EBADCOLL  119+ISAM_ERR_OFFSET           /* Bad custom collating */
00210 
00211 #define EINVOP    120+ISAM_ERR_OFFSET           /* Invalid operation */
00212 #define EBOUNDARY 121+ISAM_ERR_OFFSET           /* Boundary violation on write */
00213 #define EBOUNDSQ  122+ISAM_ERR_OFFSET           /* Boundary violation on sq file */
00214 #define EFNOTAVL  123+ISAM_ERR_OFFSET           /* Not available, closed w/ lock */
00215 #define EINVOPN   124+ISAM_ERR_OFFSET           /* Inconsistent attributes */
00216 #define EOPKYAPP  125+ISAM_ERR_OFFSET           /* Open -APPEND on KEYED file */
00217 #define EOPILDAM  126+ISAM_ERR_OFFSET           /* Open -DAM on non-IDRECT file */
00218 #define EOPKYSAM  127+ISAM_ERR_OFFSET           /* Open -SAM on KEYED file */
00219 #define EILLREAD  128+ISAM_ERR_OFFSET           /* Read on output file */
00220 #define EILLWRITE 129+ISAM_ERR_OFFSET           /* Write on input file */
00221 #define ENOTCLOS  130+ISAM_ERR_OFFSET           /* Open on file not yet closed */
00222 #define EKEYSEQ   131+ISAM_ERR_OFFSET           /* KEY specified on sequential file */
00223 #define EKEYSTR   132+ISAM_ERR_OFFSET           /* KEY specified on stream file */
00224 #define ENKYKEY   133+ISAM_ERR_OFFSET           /* No KEY specified on KEYED file */
00225 #define ENPRINT   134+ISAM_ERR_OFFSET           /* Not a PRINT file */
00226 #define ENSTREAM  135+ISAM_ERR_OFFSET           /* Not a STREAM file */
00227 #define ECALLNF   136+ISAM_ERR_OFFSET           /* CALL dataname name not found */
00228 #define EBFORMAT  137+ISAM_ERR_OFFSET           /* B-format error (35) */
00229 #define EBIFORMAT 138+ISAM_ERR_OFFSET           /* BI format error (36) */
00230 #define ECFORMAT  139+ISAM_ERR_OFFSET           /* C format error (32) */
00231 #define EEFORMAT  140+ISAM_ERR_OFFSET           /* E format error (34) */
00232 #define EIOSTACK  141+ISAM_ERR_OFFSET           /* I/O stack overflow */
00233 #define ECONVERT  142+ISAM_ERR_OFFSET           /* Conversion error */
00234 #define ELISTOVF  143+ISAM_ERR_OFFSET           /* LIST input item too long */
00235 #define EIMPOPEN  144+ISAM_ERR_OFFSET           /* Implicit open failed */
00236 #define EEOFFMT   145+ISAM_ERR_OFFSET           /* EOF found while parsing edited input */
00237 #define EENDSTR   146+ISAM_ERR_OFFSET           /* End of string on GET/PUT STRING */
00238 #define EINVSFMT  147+ISAM_ERR_OFFSET           /* Invalid format item for GET/PUT STRING */
00239 #define EINVIFMT  148+ISAM_ERR_OFFSET           /* Invalid format for GET */
00240 #define ERPGSCR   149+ISAM_ERR_OFFSET           /* Cannot initialize RPG screens */
00241 #define ENOTOPRD  150+ISAM_ERR_OFFSET           /* Not open for read */
00242 #define EILLREW   151+ISAM_ERR_OFFSET           /* REWRITE on input file */
00243 #define ENOPOPEN  152+ISAM_ERR_OFFSET           /* File not OPEN on NON-OPTIONAL */
00244 #define EOPOPEN   153+ISAM_ERR_OFFSET           /* File OPEN on OPTIONAL */
00245 #define ESEQERR   154+ISAM_ERR_OFFSET           /* Sequential error on REW or DELE COBOL85 */
00246 #define ESEQERNR  155+ISAM_ERR_OFFSET           /* Sequential error no next record COBOL85 */
00247 #define EBADSIZE  156+ISAM_ERR_OFFSET           /* Bad record size on variable length record */
00248 
00249 #define ELOGREAD  157+ISAM_ERR_OFFSET           /* Cannot read log rec  */
00250 #define EBADLOG   158+ISAM_ERR_OFFSET           /* Bad log record       */
00251 #define ELOGOPEN  159+ISAM_ERR_OFFSET           /* Cannot open log file */
00252 #define ELOGWRIT  160+ISAM_ERR_OFFSET           /* Cannot write log rec */
00253 #define ENOTRANS  161+ISAM_ERR_OFFSET           /* No transaction       */
00254 #define ENOSHMEM  162+ISAM_ERR_OFFSET           /* No shared memory     */
00255 #define ENOBEGIN  163+ISAM_ERR_OFFSET           /* No begin work yet    */
00256 #define ENONFS    164+ISAM_ERR_OFFSET           /* Can't use nfs        */
00257 #define EAUDIT    165+ISAM_ERR_OFFSET           /* Audit trail exists   */
00258 
00259 #define EFFORMAT  166+ISAM_ERR_OFFSET           /* F format error       */
00260 #define EBIGRECN  167+ISAM_ERR_OFFSET           /* Record number tobig for data item */
00261 #ifdef sgi
00262 #define ELONGNAME 168+ISAM_ERR_OFFSET           /* ISAM guest account and/or host names too long */
00263 #endif
00264 
00265 /* NOTE: Any error codes added to the end of the list above MUST be  */
00266 /*       duplicated in errmap.h for COBOL error mapping and in       */
00267 /*       rtlerrs.in for use by PL/I runtimes.  Corresponding changes */
00268 /*       should be recorded in the language User's Guides.           */
00269 
00270 
00271 /*
00272  * For system call errors
00273  *   iserrno = errno (system error code 1-99)
00274  *   iserrio = IO_call + IO_file
00275  *              IO_call  = what system call
00276  *              IO_file  = which file caused error
00277  */
00278 
00279 #define IO_OPEN   0x10          /* open()       */
00280 #define IO_CREA   0x20          /* creat()      */
00281 #define IO_SEEK   0x30          /* lseek()      */
00282 #define IO_READ   0x40          /* read()       */
00283 #define IO_WRIT   0x50          /* write()      */
00284 #define IO_LOCK   0x60          /* locking()    */
00285 #define IO_IOCTL  0x70          /* ioctl()      */
00286 
00287 #define IO_IDX    0x01          /* index file   */
00288 #define IO_DAT    0x02          /* data file    */
00289 #define IO_AUD    0x03          /* audit file   */
00290 #define IO_LOK    0x04          /* lock file    */
00291 #define IO_SEM    0x05          /* semaphore file */
00292 
00293 #define AUDHEADSIZE  14         /* num of bytes in audit header */
00294 
00295 #ifdef __cplusplus
00296 }
00297 #endif
00298 
00299 #ifndef __ldlong
00300 int ldlong(char *);
00301 #endif  /* __ldlong */
00302 
00303 #ifndef _NOFLOAT
00304 #ifndef __ldfloat
00305 double  ldfloat(char *);
00306 #endif  /* __ldfloat */
00307 #ifndef __lddbl
00308 double  lddbl(char *);
00309 #endif  /* __lddbl */
00310 double ldfltnull(char *, short *);
00311 double lddblnull(char * , short *);
00312 #endif
00313 
00314 struct keypart
00315     {
00316     short kp_start;             /* starting byte of key part    */
00317     short kp_leng;              /* length in bytes              */
00318     short kp_type;              /* type of key part             */
00319     };
00320 
00321 struct keydesc
00322     {
00323     short k_flags;              /* flags                        */
00324     short k_nparts;             /* number of parts in key       */
00325     struct keypart
00326         k_part[NPARTS];         /* each key part                */
00327                     /* the following is for internal use only   */
00328     short k_len;                /* length of whole key          */
00329     int k_rootnode;             /* pointer to rootnode          */
00330     };
00331 
00332 struct dictinfo
00333     {
00334     short di_nkeys;             /* number of keys defined       */
00335     short di_recsize;           /* data record size             */
00336     short di_idxsize;           /* index record size            */
00337     int di_nrecords;            /* number of records in file    */
00338     };
00339 
00340 extern int iserrno;             /* isam error return code       */
00341 extern int iserrio;             /* system call error code       */
00342 extern int isrecnum;            /* record number of last call   */
00343 extern char isstat1;            /* cobol status characters      */
00344 extern char isstat2;
00345 extern char *isversnumber;      /* C-ISAM version number        */
00346 extern char *isserial;          /* C-ISAM software serial number */
00347 extern int  issingleuser;       /* set for single user access   */
00348 extern int  is_nerr;            /* highest C-ISAM error code    */
00349 extern char *is_errlist[];      /* C-ISAM error messages        */
00350 /*  error message usage:
00351  *      if (iserrno >= 100 && iserrno < is_nerr)
00352  *          printf("ISAM error %d: %s\n", iserrno, is_errlist[iserrno-100]);
00353  */
00354 
00355 struct audhead
00356     {
00357     char au_type[2];            /* audit record type aa,dd,rr,ww*/
00358     char au_time[4];            /* audit date-time              */
00359     char au_procid[2];          /* process id number            */
00360     char au_userid[2];          /* user id number               */
00361     char au_recnum[4];          /* record number                */
00362     };
00363 
00364 /* Added for prototyping for use in other directories, like libI77 */
00365 extern int mkidxname(char *, char *);
00366 extern int mkdatname(char *, char *);
00367 extern int mklokname(char *, char *);
00368 
00369 #endif /* ISAM_INCL */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines