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



Rory Hewitt wrote:

So are EXTNAME and LIKEREC basically implemented in the same way under the
covers?

Sort of. At least, they end up with the same result, having a data structure whose subfields match the fields in a file.


Scott pointed out that doing an explicit read into a LIKEREC DS simply moved
the record buffer, whereas doing an implicit read into an EXTNAME DS did a
field-by-field move, but is that the only difference (under the covers)?


The difference between moving the entire buffer vs field-by-field depends on how you code the READ, not on how you defined the data structure.

If you code a data structure in the result field of the READ, it moves the record buffer. If you don't code a data structure in the result field, it uses the I specs. If the I specs match the subfields of a data structure, the field-by-field move populates the data structure.

To do an implicit read into a LIKEREC, you need PREFIX('DSNAME.') on the F spec, same as you would if you coded QUALIFIED with an EXTNAME. This makes the fields associated with the file have the same names as the subfields of the LIKEREC ds.

Compile a program like this with dbgview(*list) and run it in the debugger. When you step on the READ, you'll see it reading into subfields MYDS.FLD1, MYDS.FLD2 etc.

H option(*debugio)
Fmyfile IF E DISK PREFIX('MYDS.')
D myds DS LIKEREC(myrec)
read myrec;


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.