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



I use CrtFldList() from the RPG xTools to do the same kind of application.
WRKFFD is the command I wrote. 
The keyfields were initially a challenge too because they're sort of hidden
in the new "Retrieve File Information" API that came out long after QUSLFLD
and the rest. Others have given you the OS/400 API name to do that. Good
luck with it. If you have the xTools, however, you can use the RtvKeyList()
procedure as follows:
      /INCLUDE QCPYSRC,lists
     D pKeys           S               *   Inz(%addr(CustKeys))
     D CustKeys        S            165A
     D Keys            S             11A   Dim(15) Based(pKeys)
     D nKeys           S             10I 0
     C                   eval      nKeys=RtvKeyList('MYLIB/CUSTMAST':
     C                                   CustKeys : %size(CustKeys):1)
The elements of the array named KEYS contain the key field name in the first
10 positions and the letter "A" or "D" in position 11 to indicate ascending
or descending sequence. The 4th parm of RtvKeyList indicates the type of
information returned:  0=Just the keyfield names, 1=Keyfield names and A/D;
2=All key field name information.
-Bob Cozzi
www.rpgxtools.com


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Tony Carolla
Sent: Thursday, September 23, 2004 10:51 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Key field info

I have written a quick little app to list the fields in a physical
file, using the QUSCRTUS, QUSPTRUS, QUSLRCD and QUSLFLD APIs.  The
fields are placed in a subfile, and listed for the user.  It's
basically like DSPFFD, without all the extra 'stuff' that I don't
usually need to see at a glance.  Neato.

I would like to also indicate which fields are key fields, and what
order these key fields are in.  I can't see which API would help me
with this detail.  I don't see any option on the QUSLFLD API to show
this, nor on the QUSLRCD API.

Also, I don't see a way of knowing how many fields are returned from
the QUSLFLD API.  I currently have a DS based on a POINTER to the user
space, and I increment the pointer after each field retrieval to the
subfile.  I test the first character of the field name for containing
an alpha character, and if it does not, I assume I have reached the
end of the loop.  Kind of messy, but it works.  Is there a better way?

TIA

Tony Carolla, 
Programmer/Analyst
MedAmerica Billing Services, Inc.

-- 
"Enter any 11-digit prime number to continue..."
--
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.