|
I've seen that technique before. I always thought it was so that the
compile would work, even when your DCLF was a QTEMP file.
Rob Berendt
==================
A smart person learns from their mistakes,
but a wise person learns from OTHER peoples mistakes.
"Simon Coulter"
<shc@flybynight.com To: MIDRANGE-L@midrange.com
.au> cc:
Sent by: Subject: Re: Journal
receiver problems
owner-midrange-l@mi
drange.com
05/22/01 09:45 PM
Please respond to
MIDRANGE-L
e
Hello Ron (and everyone else with an opinion on this topic),
The "problem" is in how most midrange programmer's handle outfiles. They
build
permanent 'work files' and declare the work file in the processing program.
WRONG!
Here is how it is intended to work:
Outfiles are a release independant method of retrieving information. IBM
provides template files in QSYS for each of the DSPxxx commands. These
files
are created without members and with LVLCHK(*NO) specified. Using LVLCHK
(*NO)
allows IBM to add new fields at the end of the record format. They will
not
change the existing layout, they will not rename fields, they will not
change
field attributes. (If they do then generally a Rochester developer got it
WRONG
and you can APAR them.)
Your code should declare the TEMPLATE, not the work file. You issue the
DSPxxx
command specifying the desired outfile and then OVERRIDE the declared
template
to the outfile.
If you create a work file based on the template (via CRTDUPOBJ or by
running the
DSPxxx command once to create the work file) then your code will break when
the DSPxxx command is enhanced to output additional fields. You should
always
let the DSPxxx command create the outfile on EVERY run -- unless you are
using
MBROPT(*ADD) -- to avoid problems with enhanced layouts. If you (and
Rochester)
follow the rules you won't have a problem with updated outfiles.
Using the APIs avoids the issue and probably results in better performance
due
to reduced I/O but at the expense of increased complexity.
Here are some examples of correct processing of outfiles to make the point
clear:
CL
===
PGM
DCLF QADSPOBJ /*DSPOBJD outfile template */
DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/OBJLIST)
OVRDBF QADSPOBJ TOFILE(TQEMP/OBJLIST)
READ: RCVF
/* do stuff until end of file */
ENDPGM
RPG with CL driver
==================
PGM
DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/OBJLIST)
OVRDBF QADSPOBJ TOFILE(TQEMP/OBJLIST)
CALL RPGPGM
ENDPGM
FQADSPOBJ IF E DISK
C READ QLIDOBJD
C DOW NOT(%EOF(QADSPOBJ))
* Do stuff until end of file
C READ QLIDOBJD
C ENDDO
C SETON LR
C RETURN
Regards,
Simon Coulter.
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software AS/400 Technical Specialists «»
«» Eclipse the competition - run your business on an IBM AS/400. «»
«» «»
«» Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ «»
«» Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au \ / «»
«» X «»
«» ASCII Ribbon campaign against HTML E-Mail / \ «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.