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




Charles,

I use the "ILE C/C++ Runtime Library Functions" PDF to get the information
I need about the C record IO functions.

Basically the "_Ropen" functions return a _RFILE structure, which has
pointer to the IO buffer as well as the NULL indicator map:

Information for controlling opened record I/O operations:

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;


The NULL map buffers are always present, regardless of the file has null
capable fields or not. The sequence number of a field (starting at 1 for
RPG) can be used to get its NULL indicator from the NULL map. You can
check the NULL status of a given field by comparing its NULL indicator
with 1 (= NULL) or 0 (= not NULL). A field is set to NULL by setting its
NULL indicator to 1.

I wrapped the C functions with RPG and use it as shown here:

// Read a record
isEOF = CIO_read(hFile02: bFalse: IO_Buff: IO_NullMap)

// Check field for NULL
if (IO_NullMap(FLDL0100.F1SEQ) = 1);
// field is NULL
else;
// field is not NULL
endif;

// Set field to NULL
IO_NullMap(F1SEQ) = 1


Regards,

Thomas.


rpg400-l-bounces@xxxxxxxxxxxx schrieb am 24.06.2014 23:17:53:

Von: charles.wilt@xxxxxxxxx
An: rpg400-l@xxxxxxxxxxxx,
Datum: 24.06.2014 23:18
Betreff: Re: Looking for good article on using the C runtime record
I/O functions (_Rread, _Ropen, ect)
Gesendet von: rpg400-l-bounces@xxxxxxxxxxxx

In particular, I'm curious how NULL fields are handled when using the C
functions from RPG.

Charles


On Tue, Jun 24, 2014 at 5:02 PM, Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:

I need a refresher...

Thanks!
Charles

--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and email confirmation to the sender.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.