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



Has the same problem as I outlined Niels - if there is any packed or binary data it will be unreadable. Of course that may not matter but ...


Jon P

On Feb 14, 2022, at 5:06 AM, Niels Liisberg <nli@xxxxxxxxxxxxxxxxx> wrote:

You can use the C library's _Rwrite function - simply provide a buffer huge
enough, and it will tell you how much it placed into the record in the
file.

https://www.ibm.com/docs/en/ssw_ibm_i_73/pdf/sc415607.pdf

From the doc:

_Rwrite() — Write the Next Record
Format
#include <recio.h>
_RIOFB_T * _Rwrite(_RFILE *fp, void *buf, size_t size);
Language Level
ILE C Extension
Threadsafe
Yes
However, if the file pointer is passed among threads, the I/O feedback area
is shared among those
threads.
Description
The _Rwrite() function has two modes: move and locate. When buf points to a
user buffer, _Rwrite()
is in move mode. When buf is NULL, the function is in locate mode.
The _Rwrite() function appends a record to the file specified by fp. The
number of bytes copied from
buf to the record is the minimum of size and the record length of the file
(move mode only). If size is
greater than the record length, the data is truncated and errno is set to
ETRUNC. One complete record is
always written if the operation is successful.
If you are using _Ropen() and then _Rwrite() to output records to a source
physical file, the sequence
numbers must be manually appended.
The _Rwrite() function has no effect on the position of the file for a
subsequent read operation.
Records might be lost although the _Rwrite() function indicates success
when the following items are
true:
• Record blocking is taking place.
• The file associated with fp is approaching the limit of the number of
records it can contain and the file
cannot be extended.
• Multiple writers are writing to the same file.
Because the output is buffered, the _Rwrite() function returns success that
indicates the record is
successfully copied to the buffer. However, when the buffer is flushed, the
function might fail because the
file has been filled to capacity by another writer. In this case, the
_Rwrite() function indicates that an
error occurred only on the call to the _Rwrite() function that sends the
data to the file.
The _Rwrite() function is valid for all types of files.
352 IBM i: ILE C/C++ Runtime Library Functions
Return Value
The _Rwrite() function returns a pointer to the _RIOFB_T structure that is
associated with fp. If the
_Rwrite() operation is successful the num_bytes field is set to the number
of bytes written for both
move mode and locate mode. The function transfers the bytes from the user's
buffer to the system buffer.
If record blocking is taking place, the function only updates the rrn and
key fields when it sends the
block to the database. If fp is a display, ICF or printer file, the
function updates the sysparm field. If it is
unsuccessful, the num_bytes field is set to a value less than size
specified (move mode) or zero (locate
mode) and errno is changed.
The value of errno may be set to:
Value
Meaning
ENOTWRITE
The file is not open for write operations.
ETRUNC
Truncation occurred on an I/O operation.
EIOERROR
A non-recoverable I/O error occurred.
EIORECERR
A recoverable I/O error occurred.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


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.