<recio.h>
The <recio.h
> include file defines
the types and macros, and prototypes functions for all the ILE C record
input and output (I/O) operations.
The following functions are defined in <recio.h
>:
_Racquire | _Rclose | _Rcommit | _Rdelete |
_Rdevatr | _Rfeod | _Rfeov | _Rformat |
_Rindara | _Riofbk | _Rlocate | _Ropen |
_Ropnfbk | _Rpgmdev | _Rreadd | _Rreadf |
_Rreadindv | _Rreadk | _Rreadl | _Rreadn |
_Rreadnc | _Rreadp | _Rreads | _Rrelease |
_Rrlslck | _Rrollbck | _Rupdate | _Rupfb |
_Rwrite | _Rwrited | _Rwriterd | _Rwrread |
The following positioning macros are defined in recio.h
:
__END | __END_FRC | __FIRST | __KEY_EQ |
__KEY_GE | __KEY_GT | __KEY_LE | __KEY_LT |
__KEY_NEXTEQ | __KEY_NEXTUNQ | __KEY_PREVEQ | __KEY_PREVUNQ |
__KEY_LAST | __KEY_NEXT | __NO_POSITION | __PREVIOUS |
__PRIOR | __RRN_EQ | __START | __START_FRC |
__LAST | __NEXT |
The following macros are defined in recio.h
:
__DATA_ONLY | __DFT | __NO_LOCK | __NULL_KEY_MAP |
The following directional macros are defined in recio.h
:
__READ_NEXT | __READ_PREV |
The following functions and macros support locate or move mode:
_Rreadd | _Rreadf | _Rreadindv | _Rreadk |
_Rreadl | _Rreadn | _Rreadnc | _Rreadp |
_Rreads | _Rupdate | _Rwrite | _Rwrited |
_Rwriterd | _Rwrread |
Any of the record I/O functions that include a buffer parameter may work in move mode or locate mode. In move mode, data is moved between the user-supplied buffer and the system buffer. In locate mode, the user must access the data in the system buffer. Pointers to the system buffers are exposed in the _RFILE structure. To specify that locate mode is being used, the buffer parameter of the record I/O function is coded as NULL.
A number of the functions include a size parameter. For move mode, this is the number of data bytes that are copied between the user-supplied buffer and the system buffer. All of the record I/O functions work with one record at a time regardless of the size that is specified. The size of this record is defined by the file description. It may not be equal to the size parameter that is specified by the user on the call to the record I/O functions. The amount of data that is moved between buffers is equal to the record length of the current record format or specified minimum size, whichever is smaller. The size parameter is ignored for locate mode.
The following types are defined in recio.h
:
typedef _Packed struct {
char reserved1[16];
volatile void *const *const in_buf;
volatile void *const *const out_buf;
char reserved2[48];
_RIOFB_T riofb;
char reserved3[32];
const unsigned int buf_length;
char reserved4[28];
volatile char *const in_null_map;
volatile char *const out_null_map;
volatile char *const null_key_map;
char reserved5[48];
const int min_length;
short null_map_len;
short null_key_map_len;
char reserved6[8];
}_RFILE;
- Element
- Description
- in_null_map
- Specifies which fields are to be considered NULL when you read from a database file.
- out_null_map
- Specifies which fields are to be considered NULL when you write to a database file.
- null_key_map
- Specifies which fields contain NULL if you are reading a database by key.
- null_map_len
- Specifies the lengths of the in_null_map and out_null_map.
- null_key_map_len
- Specifies the length of the null_key_map.
typedef struct {
unsigned char *key;
_Sys_Struct_T *sysparm;
unsigned long rrn;
long num_bytes;
short blk_count;
char blk_filled_by;
int dup_key :1;
int icf_locate :1;
int reserved1 :6;
char reserved2[20];
}_RIOFB_T;
- Element
- Description
- key
- If you are processing a file using a keyed sequence access path, this field contains a pointer to the key value of the record successfully positioned to, read or written.
- sysparm
- This field is a pointer to the major and minor return code for ICF, display, and printer files.
- rrn
- This field contains the relative record number of the record that was successfully positioned to, read or written.
- num_bytes
- This field contains the number of bytes that are read or are written.
- blk_count
- This field contains the number of records that remain in the block. If the file is open for input, blkrcd=y is specified, and a read function is called, this field will be updated with the number of records remaining in the block.
- blk_filled_by
- This field indicates the operation that filled the block. If the file is open for input, blkrcd=y is specified, and a read function is called. This field will be set to the __READ_NEXT macro if the _Rreadn function filled the block or to the __READ_PREV macro if the _Rreadp function filled the block.
typedef struct {
void *sysparm_ext;
_Maj_Min_rc_T _Maj_Min;
char reserved1[12];
} _Sys_Struct_T;
typedef struct {
char major_rc[2];
char minor_rc[2];
} _Maj_Min_rc_T;
recio.h
:
- _FILENAME_MAX
- Expands to an integral constant expression that is the size of a character array large enough to hold the longest file name. This is the same as the stream I/O macro.
- _ROPEN_MAX
- Expands to an integral constant expression that is the maximum number of files that can be opened simultaneously.
recio.h
:
- Element
- Description
- _CLEAR_NULL_MAP(file, type)
- Clears the null output field map that indicates that there are no null fields in the record to be written to file. type is a typedef that corresponds to the null field map for the current record format.
- _CLEAR_UPDATE_NULL_MAP(file, type)
- Clears the null input field map that indicates that no null fields are in the record to be written to file. type is a typedef that corresponds to the null field map for the current record format.
- _QRY_NULL_MAP(file, type)
- Returns the number of fields that are null in the previously read record. type is a typedef that corresponds to the null field map for the current record format.
- _CLEAR_NULL_KEY_MAP(file, type)
- Clears the null key field map so that it indicates no null key fields in the record to be written to file. type is a typedef that corresponds to the null key field map for the current record format.
- _SET_NULL_MAP_FIELD(file, type, field)
- Sets the specified field in the output null field map so that field is considered NULL when the record is written to file.
- _SET_UPDATE_NULL_MAP_FIELD(file, type, field)
- Sets the specified field in the input null field map so that field is considered null when the record is written to file. type is a typedef that corresponds to the null key field map for the record format.
- _QRY_NULL_MAP_FIELD(file, type, field)
- Returns 1 if the specified field in the null input field map indicates that the field is to be considered null in the previously read record. If field is not null, it returns zero. type is a typedef that corresponds to the NULL key field map for the current record format.
- _SET_NULL_KEY_MAP_FIELD(file, type, field)
- Sets the specified field map that indicates that the field will be considered null when the record is read from file. type is a typedef that corresponds to the null key field map for the current record format.
- _QRY_NULL_KEY_MAP(file, type)
- Returns the number of fields that are null in the key of the previously read record. type is a typedef that corresponds to the null field map for the current record format.
- _QRY_NULL_KEY_MAP_FIELD(file, type, field)
- Returns 1 if the specified field in the null key field map indicates that field is to be considered null in the previously read record. If field is not null, it returns zero. type is a typedef that corresponds to the null key field map for the current record format.