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



On Mon, Dec 5, 2011 at 11:29 AM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:
On 2011/12/5 11:16 AM, jmmckee flinthills.com wrote:
...
APHSP# P 1   2 0
APACCT P 3   6 0

The above came from the first file.

Those are used to chain to the second file, where the fields are:
HMHSP#  P   3 0
HMACCT  Z   7 0

I got both definitions from the compiler list.  I am confused as to
why this would have ever seemed to work.  From what I am encountering,
it doesn't, at least not consistently.


The compiler builds the search argument for the CHAIN to the second file
using the data types from the second file. For a KLIST, it requires that
the length and number of decimals be the same for the KFLD and the
actual key field in the file, which they are (2-byte packed is 3 digits,
4 byte packed is 7 digits). But it doesn't require that they have the
exact same numeric type, since it has no difficulty assigning the
packed(7,0) KFLD to the signed(7,0) key in the search argument. It does
this in the same way that it would do
     eval  HMACCT = APACCT

It is one of the fundamental features of RPG that the data types in the
I/O buffers and search arguments do not have to exactly match the data
types of the internal fields. If your input buffer has a zoned field and
your internal field is packed, the compiler will handle that conversion.
(I blogged about this in the RPG Cafe, here, sorry about the mega-long
URL:
https://www.ibm.com/developerworks/mydeveloperworks/blogs/b542d3ac-0785-4b6f-8e53-f72051460822/entry/rpg_s_move_fields_logic_and_its_cousin_eval_corr?lang=en)



I appreciate the response. My first thought was that was the
mechanism where records were missing. Only one program maintains the
file that is being read. Nothing is deleted unless an action code is
stored in the first file. My guess was that the delete was running
wild. If it wasn't in an if on eof, I would suspect that having the
klist on factor 1 of delete would be the issue.

John McKee

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.