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



An SQL view could probably get you the layout you want - and you an use it in RPG in an F-spec. Only issue, no key.

Now if you are far enough along - make an SQL index - you can now specify the key, of course, plus the fields you want to see in it - and this is ALSO usable as a keyed file in RPG.

HTH
Vern

On 10/19/2017 4:34 PM, James H. H. Lampert wrote:
I've got an externally described file, from DDS roughly like (not all fields shown):

A          R WTEX01R
 *
A            CDATE          8S 0       TEXT('Created Date')
A            CTIME          6S 0       TEXT('Created Time')
A            CUSER         10A         TEXT('Created By User')
. . .
A            U01052       012A COLHDG('E-Unit#')
A            U01053       008S00       COLHDG('E-Item#')
. . .
A            U01265       010A COLHDG('Model Code')
A            U01266       003A         COLHDG('Major Equip. Class')

with a result something like:
Field      T  Len   From   To
CDATE      S    8      1    8
CTIME      S    6      9   14
CUSER      A   10     15   24
. . .
U01052     A   12     87   98
U01053     S    8     99  106
. . .
U01265     A   10    502  511
U01266     A    3    512  514


And I have an RPG program that already opens the file as externally described. Now, for a new function in the program, I would like to be able to read a record from the file in such a way that everything from byte 87 through byte 514 of the record is contained in a single field (for comparison with a byte stream that contains a record image).

Overlaying a single field containing the "bytes of interest" over the byte stream is of course trivial.

I'm trying to set up an overlay on the record. Preferably without having to put all the file's fields into a DS, because that would be one more big thing to go wrong.

First, knowing that starting in V6, files opened as externally described can be read into a data structure (as opposed to traditional RPG scatter-gather I/O), I tried setting up a data structure, containing only my "bytes of interest" overlay field.

> D TESTREC            DS
> D  BYTESOFINT              87     514

and then doing

> C    MYKEY        CHAIN    MYFILE       TESTREC

That was rejected with an RNF7595, "The result data structure does not include a subfield in position 1 . . . ."; I added a subfield starting in position 1.

> D TESTREC            DS
> D  IGNORE                   1      87
> D  BYTESOFINT              87     514

That didn't work, so I looked up the error message, and found that I had to use a data structure derived from the file, so I tried:

> D TESTREC            DS                 LIKEREC(REALREC)
> D  BYTESOFINT              87     514

and it gave me TWO error messages (an RNF3703 and an RNF3602) on the "BYTESOFINT" field.

At this point, noticing that at some point, I'd put in a couple of I-specs on the file, to rename a single field, I tried giving up on the above approach, and plugging my overlay field in as another I-spec, and it only took one failed compilation before I realized that wasn't going to work, because of the mechanics of scatter-gather.

So I'm back to the "TESTREC" approach, but I can't figure out what it wants.

--
JHHL


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.