I have resolved an issue that I wanted to share with everyone.
The issue: on V7R1 QDFRTVFD doesn't appear to process correctly when the
second input parameter (Length of receiver variable ) is inside the
memory of the first parameter (Receiver variable).
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/apis/qdfrtvfd.htm
Background:
We went to V7R1 last year and all of our programs went through the
conversion process, most without recompiling.
I had need to update a RPGLE program that was using the QDFRTVFD api.
The original program was compiled on our test system when our test
system was at v7r1 and our production system was at v5r4.
The program was compiled on v7r1, created for release V5R4, and then
eventually converted to V7R1.
The V5R1 version functioned like this:
Data structure DSPF0100 is based into a Userspace that was created in
QTEMP as auto-extendable.
The program was coded to call the API twice. First to retrieve the
needed size, and second to retrieve the data using that size.
D QDFRTVFD PR EXTPGM('QDFRTVFD')
D Receiver 1A CONST OPTIONS(*VARSIZE)
D Receiverlen 10I 0 CONST
D Dataformat 8A CONST
D Qualfile 20A CONST
D Apierror LIKEDS(Apierrords)
D ptrDSPF0100 S *
D DSPF0100 DS BASED(ptrDSPF0100) QUALIFIED
D BytesRetn 10I 0
D Bytesavail 10I 0
D Offset_QDFFINFO...
D 5U 0
D RcdFmtCount 5U 0
D DspAtrBits 1A
D ScnSizeCount 5U 0
D Offset_SortSeqTable...
D 5U 0
D Source_ccsid 2A
// Retrieve display file description
QDFRTVFD(DSPF0100 :8 :'DSPF0100' :FILE :APIERRORDS);
IF APIERRORDS.BYTESAVAIL = 0;
QDFRTVFD(DSPF0100 :DSPF0100.BytesAvail
:'DSPF0100' :FILE :APIERRORDS);
ENDIF;
On V5R4 and the converted V7R1 the second call correctly retrieves the
data into the userspace.
Once the program was compiled on V7R1 for V7R1 the second call to the
API stopped actually retrieving the data into the userspace.
During debugging I ended up recompiling the program on V7R1 without any
changes, and still the second call does not populate the userspace with
the requested data.
I made a small modification.
Added a work field:
D wkBytes S 10I 0
Modified the second call to use the work field:
// Retrieve display file description
QDFRTVFD(DSPF0100 :8 :'DSPF0100' :FILE :APIERRORDS);
IF APIERRORDS.BYTESAVAIL = 0;
wkBytes = DSPF0100.BytesAvail;
QDFRTVFD(DSPF0100 :wkBytes
:'DSPF0100' :FILE :APIERRORDS);
ENDIF;
Now the data is being returned to the user space just like the prior
(V5R4) version of the program.
Chris Hiebert
Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the
author and do not necessarily represent those of the company.
As an Amazon Associate we earn from qualifying purchases.