On 11-Apr-2012 10:34 , Stone, Joel wrote:
Is there a way to retrieve this directly in CL (as in RTVMBRD or
some such command?)

No OS-supplied RTVxxx command that I am aware of, that would provide the Record Format Level Identifier.

Or must I DSPFD to an outfile and RCVF the outfile?

Both DSPFD TYPE(*RCDFMT) [model file QAFDRFMT in QSYS, RcdFmt QWHFDFMT, Field RFID] and DSPFFD, each with OUTPUT(*OUTFILE), enable obtaining the data with RCVF from the Output File. The latter enables a more thorough comparison, to the field level.

As David suggests in another reply, use the Retrieve Database File Description (QDBRTVFD) API [with FILD0200 using RcdFmt(*FIRST) for a Physical File]. With a PF assumption, the following CLP source [from before based and defined storage is available in a CLP] gives an example to get the sequence\identifier identified in the documentation as Qddfseq:

<code>

pgm (&qfn) /* qualified file name */
dcl &qfn *char 20
dcl &rcv *char 257 /* min for Fmt header */
dcl &qfnrtn *char 20
dcl &len *char 4
dcl &errcde *char 8
dcl &Qddfseq *char 13
chgvar %bin(&len 1 4) 257
chgvar %bin(&errcde 1 4) 0
chgvar %bin(&errcde 5 4) 0
call qdbrtvfd (&rcv &len &qfnrtn 'FILD0200' &qfn '*FIRST ' +
'0' '*LCL ' '*EXT ' &errcde)
/* ensure Qddbyrtn >= 257 before trusting next chgvar */
chgvar &Qddfseq %sst(&rcv 81 13)
dmpclpgm /* for testing; pgm assumes interactive: */
dspsplf qppgmdmp splnbr(*last)
dltsplf qppgmdmp splnbr(*last)
endpgm

</code>

(Want to compare the File Format level identifier of an old and new
file version to check if a conversion pgm should be run or not)

Always remember that the RcdFmt LvlID is just a hash. The database could create an identical hash for two different formats. As such, the onus is on the developer to ensure that the new version of the record format does indeed have a different Record Format Level Identifier than the old version of the Record Format.

Regards, Chuck

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].