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



Yeah, I was looking to do some generic I/O...

But it turned out I needed eval-corr also...

So now I've got 24 identical procedures except for the dcl-f and dcl-ds
likerec() (6 lines)...

At least they were easy to write with the snippet functionality in RDi. :)

I suppose I could try generating dynamic SQL. But that'd probably blow the
mind of anybody maintaining it after me and there's little advantage at
this point to the added complexity. In addition, my input file has to be
processed row by row (per the vendor _and experience). So I'd be doing
single row create/update/deletes with SQL; which won't perform as well as
the RPG RLA.

Charles


On Fri, Jun 27, 2014 at 11:04 AM, Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
wrote:

Charles

I've often thought of using the _R* C functions to update Julian
Monypenny's generic file I/O stuff - he used an internally-defined file -
and those can't deal with NULL (for sure) and varying length (maybe).

The C functions give us even more of the I/O capabilities than RPG does -
and you can work directly with the buffers.

For most things, there probably isn't a good-enough reason to use C
functions instead of native RPG, but this one is, IMO.

Now to find some time!!

Vern


On 6/27/2014 7:19 AM, Charles Wilt wrote:

Thanks Thomas,

I ended up not using the C I/O for other reasons..

Charles


On Fri, Jun 27, 2014 at 2:27 AM, <thomas.raddatz@xxxxxx> wrote:

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



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



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.