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



On 08/08/07, Peter Dow (ML) <maillist@xxxxxxxxxxxxxxx> wrote:
Hi Everyone,

I have a general purpose utility program (CPYTOCSV) that uses a
program-described file for its input and writes to the IFS. Up until
today, no one had used it to copy a file that contained null-capable
fields. My first thought was, just put ALWNULL(*INPUTONLY) on the
H-spec and recompile. No such luck.

I did a little reading of the v5r3 RPGLE manual and found these two notes:

* An input operation from a program-described file using a data
structure in the result field does not affect the null indicator
associated with the data structure or any of its subfields.

* Reading null-capable fields using input specifications for
program-described files always sets off the associated null indicators.

I think the assumption for these two statements is that the input specs
for the program-described file match the externally-defined fields. In
my case, I have a single 32k field. And it gets a data-mapping error
when it reads a record with a null field. Not just null-capable, but
actually null.

Is there a way around this?

Hi Peter

My CRTCSVDTA utility has the same problem, so I worked round it by
converting the nulls to a non-null default value first[1]. From what
I've read here and elsewhere, there isn't a way to handle this
situation using standard RPG. The method that should work is to use
the C-APIs to read the data instead, and they can deal with the nulls
okay. I've no experience with them, so I can't point you to code
examples :(

Regards, Martin
[1] http://www.dbg400.net/cgi-bin/twiki/view/DBG400/CvtNulFld

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.