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



fyi, the dual use length parm rffilinfprv was the problem.

thanks!

On Sat, Jul 3, 2010 at 2:14 AM, Simon Coulter <shc@xxxxxxxxxxxxxxxxx> wrote:

On 03/07/2010, at 8:52 AM, rick baird wrote:

d RfFilInf        ds          4096
d  RfFilInfPrv                  10i 0 OverLay(RfFilInf:5)
d                                     Inz( %Size(RfFilInf))

Interesting approach ... but a bit stupid.

c                   call      'QDBRTVFD'
c                   parm                    RfFilInf
c                   parm                    RfFilInfPrv


You are using the RfFilInfPrv field for two different purposes. The
first use is on the call to the API where it indicates how much space
YOU made available. The second use is by the API where it indicates
how much data IT could return if you provided sufficient space. So on
the first call to the API you tell it you have 4K of space and it
fills <=4K. It also sets bytes_available to be the lesser of 4k or the
amount it actually returned. In addition, it sets bytes_provided to
the amount of space needed if you want all of the file information.
This may be greater than the amount you provided.

Because you chose to use the same field for indicating both how much
space you gave the API and how much space it could fill the first call
will work but the second and subsequent calls will fail. The actual
failure will depend entirely on what happens to be in storage
following your 4K allocation.

The process is as follows:
       RfFilInfPrv = 4096
       Call QDBRTVFD
               API returns 4K of data but sets RfFilInfPrv to a larger value
       RfFilInfPrv = >4096
       Call QDBRTVFD
               API returns >4K of data and trashes storage causing kaboom!

Despite the documentation you should think of the three values
involved as follows:
       Bytes provided:  Space you make available to the API (generally
parameter 2)
       Bytes returned:  Amount of space filled by the API (first 4 bytes of
receiver)
       Bytes available: Amount of data that could be returned (second 4
bytes of receiver)

Note that in some cases your very unsafe technique will appear to work
so you may have lots of "working" code that uses this technique. If so
I suggest you find and fix it. The cases where it will work without
problems are those where you provide enough space on the first call
for all the information to be returned. In other cases it may be an
"accident waiting to happen".

The fix, and the correct code, is to use a separate field for the
amount of space you make available to the API.

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         OS/400, i5/OS Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 2 6657 8251   Mobile: +61 0411 091 400        /"\
   Fax:   +61 2 6657 8251                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



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.