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



Hi guys,

if I use %KDS, I always create constants for the number of keys.
If I have to change it, i.e. an additional key field must be inserted.
I only have to change the constant.
I do not have to search for say '3' which may be coded several times in the
same source,
but for KeyInclMyField.
I think it's easier to read, because I normally not know by heart
if i.e. OrderNo is key 8 or 9 or whatever.

D KeyInclATFINR     C                      const(1)
D KeyInclATKNDB     C                      const(2)
D KeyInclATBNR      C                      const(3)
D KeyInclATPNR      C                      const(4)
*--------------------------------------------------------------------------
/Free
   SetLL %KDS(KeyATEIL0: KeyInclATBNR)  LLATEIF0;
   ReadE %KDS(KeyATEIL0: KeyInclATKNDB) LLATEIF0;
   Chain %KDS(KeyATEIL0: KeyInclATPNR)  LLATEIF0;
/End-Free

But to be honest I prefer to list the keyfields, if possible.

Birgitta


-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Simonse, Arco (CMK)
Gesendet: Freitag, 27. Mai 2005 23:00
An: RPG programming on the AS400 / iSeries
Betreff: RE: %kds flexible number of keys


I also use that method (key1 : key2 : key3) in other situations and
found it very useful.
But here I have to code for key structures with many fields. It depends
on calculations in the code for how many keys the file would be updated.
The number of keys to be used can vary from 7 keys to 19 keys for
example.

Now I just repeat the code:

when KeyNum = 7;
   setll %kds(KeyGroup_ds: 7) ttvlcdl01
when KeyNum = 8;
   setll %kds(KeyGroup_ds: 8) ttvlcdl01
......
when KeyNum = 19;
   setll %kds(KeyGroup_ds: 19) ttvlcdl01

In this way I become a lot of repeating code and I would try to avoid
that.

> -----Oorspronkelijk bericht-----
> Van: rpg400-l-bounces@xxxxxxxxxxxx
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Namens Alan Campin
> Verzonden: vrijdag 27 mei 2005 19:59
> Aan: rpg400-l@xxxxxxxxxxxx
> Onderwerp: %kds flexible number of keys
>
> Why use %kds at all. Just use
>
> Setll KeyField1 FileName
>
> or
>
> Setll (KeyField1:KeyField2) FileName
>
> etc....
>
> Used to use %kds but don't since I found this trick.
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>
DISCLAIMER:
This message contains information that may be privileged or
confidential and is the property of C.Meijer B.V. It is intended only for
the person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy,disseminate, distribute,
or use this message or any part thereof. If you
receive this message in error, please notify the sender immediately and
delete all copies of this message.

This footnote also confirms that this email message has been swept by the
presence of computer viruses


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-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.