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


  • Subject: Re: Retrieve File Description
  • From: David Morris <dmorris@xxxxxxxxxxxxx>
  • Date: Mon, 13 Apr 1998 08:25:54 -0600

Ravi,

You have to use the offsets from the record format structure.  QDBRTVFD is
one of the most convoluted APIs ever written, any API that requires a 105
page include structure is trying to do way to much.  It does everything,
but nothing is strait forward.  I have attached a piece of code to help you
sort through the offsets.  First the re-definition of the heading, format,
and key structures.  Then the code that parses out the key fields.

     DKeyInfOff        S              5I 0
     DAPIKeyHdr        DS                  BASED(pAPIKeyHdr)
     D APIRtnLen                           LIKE(QDBBR)
    Length returned.
     D APIAvlLen                           LIKE(QDBBA)
    Length available.
     D APIMaxKeyLen                        LIKE(QDBMKL)
    Max key length.
     D APIKeyCnt                           LIKE(QDBKC)
    Max key count.
     D KeyRes01                            LIKE(QDBERVED01)
    Reserved.
     D APIRcdFmtCnt                        LIKE(QDBFC01)
    Record format count.
     D********************************************
     D* API Record Format Key Information Array. *
     D********************************************
     DAPIRcdFmtInf     DS                  BASED(pAPIRcdFmtInf)
     D APIRcdFmt                           LIKE(QDBRN00)
     D RcdRes01                            LIKE(QDBRSV102)
     D APINbrKey                           LIKE(QDBNBROK00)
     D RcdRes02                            LIKE(QDBRSV202)
     D APIKeyOff                           LIKE(QDBKIO00)
     D************************************
     D* API Key Field Information Array. *
     D************************************
     DAPIKeyFldInf     DS                  BASED(pAPIKeyFldInf)
     D APIIntKeyFld                        LIKE(QDBIFN)
     D APIExtKeyFld                        LIKE(QDBEFN)
     D APIKeyFldTyp                        LIKE(QDBDT01)
     D APIKeyFldLen                        LIKE(QDBFL)
     D APIKeyNumDig                        LIKE(QDBNBROD)
     D APIKeyDecPos                        LIKE(QDBDP)
     D APIKeyFldAtr                        LIKE(QDBBITS56)
     D APIAltNamLen                        LIKE(QDBANL)
     D APIKeyAltNam                        LIKE(QDBAN)

     D KeyFldRes01                         LIKE(QDBRSV103)
     D APIAddKeyAtr                        LIKE(QDBBITS67)
     D KeyFldRes02                         LIKE(QDBRSV203)
...
     C* Set address to API key field header
     C                   EVAL      pAPIKeyHdr = %ADDR(APIKeyInf)
     C*
     C* Set initial key information offset to length of key field header
     C                   EVAL      KeyInfOff = %LEN(APIKeyHdr)
     C*
     C* Set initial address to record format information
     C                   EVAL      pAPIRcdFmtInf = pAPIKeyHdr + KeyInfOff
     C*
     C* Set record format count
     C                   EVAL      RcdFmtCnt   = APIRcdFmtCnt
     C*
     C* Create data structure for record formats
     C                   EVAL      RcdFmtStr = CrtDtaStr(%SIZE(RcdFmt):
     C                                         RcdFmtCnt)
     C*
     C* Process each record format
     C                   DO        RcdFmtCnt     RcdFmtOcc
     C*
     C* Set occurrence of record format data structure
     C                   EVAL      pRcdFmt = DtaStrOcc(RcdFmtStr:RcdFmtOcc)
     C*
     C* Set record format name
     C                   EVAL      RcdFmtNam = APIRcdFmt
     C*
     C* Set record format key count
     C                   EVAL      RcdFmtKeyCnt = APINbrKey
     C*
     C* Increment key information offset by length of record format
information
     C                   EVAL      KeyInfOff = KeyInfOff +
     C                                         %LEN(APIRcdFmtInf)
     C*
     C* Create data structure for key fields
     C                   EVAL      KeyFldStr = CrtDtaStr(%SIZE(KeyFld):
     C                                         APINbrKey)
     C*
     C* Process each key field
     C                   DO        RcdFmtKeyCnt  KeyFldOcc
     C*
     C* Set occurrence of key field data structure
     C                   EVAL      pKeyFld = DtaStrOcc(KeyFldStr:KeyFldOcc)
     C*
     C* Set API key field address
     C                   EVAL      pAPIKeyFldInf = pAPIKeyHdr + APIKeyOff +
     C                                             (%LEN(APIKeyFldInf) *
     C                                             (KeyFldOcc-1))
     C*
     C* Key field name
     C                   EVAL      KeyFldNam = APIExtKeyFld
     C*
     C* Check if descending key
     C                   TESTB     '0'           APIKeyFldAtr             01
     C                   IF        *IN01 = *ON
     C                   EVAL      KeyFldDsc = *ON
     C                   ELSE
     C                   EVAL      KeyFldDsc = *OFF
     C                   ENDIF
     C*
     C* Increment key information offset by length of key field information
     C                   EVAL      KeyInfOff = KeyInfOff + %LEN(APIKeyFldInf)
     C                   ENDDO
     C*
     C* Set next record format address
     C                   EVAL      pAPIRcdFmtInf = pAPIKeyHdr + KeyInfOff
     C                   ENDDO
    

David Morris

>>> Ravi Kumar <RKumar@manhattanassociates.com> 04/13 6:53 AM >>>
Hi All,
I'm using File API  Retrieve Data base File description QDBRTVFD with
format parameter as FILD0300(Key field information template). I copied

the data structure from QSYSINC/QRPGSRC, according to the data structure
i should get no. of keys in pos. 13 to 14 but i don't get that no. in
those positions and i also i don't get name of the record in pos. 1 to
10.
Any suggestions would be greatly appreciated.

TIA
Ravi














                                   

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.