On 26 Apr 2012 10:23, Jack Tucky wrote:
I have a file that has a BLOB in it and I'm trying to read it using
standard Chain and ReadE. I don't need the BLOB's, how can I drop
them or tell the compiler to just ignore them?
I have built a logical with just the fields I need but I think there
must be a better way. Do I have to use embedded SQL instead?
Because the F-spec uses the external description of the file, the LF
seems the obvious way; with that, there is no reason to use SQL instead.
While there is an IGNORE for record formats, there is not an IGNOREFLD
If the mention of SQL was because the pre-LOB column file is
currently being or needs to be queried by OPNQRYF, then...
The program could be compiled against an external description EXTDESC
that excludes the LOB fields, and the run-time could refer to a query
ODP which uses the same record format as that named by\for the External
Description. That is done using the FORMAT() on the OPNQRYF request.
The format-file need not be an LF; could be a PF with no member, as
would be done typically for a REFFILE. The following uses a VIEW
Logical File merely for simplicity; when keys are relevant, the PF or LF
with key specs is a better choice, the SQL TABLE and INDEX are less
flexible [e.g. having no member is not supported], but may be a
reasonable choice as well:
create table blobfile (a char, b blob)
create view nblobfile as (select a from blobfile)
rpg: fBLOBFILE ... EXTDESC(nblobfile)
ovrdbf blobfile share(*yes) /* scoped as required */
opnqryf blobfile FORMAT(nblobfile) /* scoped as required */
call rpg_pgm /* compiled against RcdFmt of nblobfile */