+ Reply to Thread
Results 1 to 4 of 4

Thread: API returns blanks

  1. #1
    Guest.Visitor Guest

    Default API returns blanks


  2. #2
    Guest.Visitor Guest

    Default API returns blanks

    I'm trying to use the QCLRPGMI API to check the COMMIT setting of our SQL programs. When the API runs, it returns all blanks. Here is my code: D ds D PGMI0200 600 D COMMIT 10 OVERLAY(PGMI0200:370) D ErrLength s 4b 0 inz(0) D Length s 4b 0 inz(600) c eval qpgm = odobnm + odlbnm C Call 'QCLRPGMI' C Parm PGMI0200 C Parm Length C Parm 'PGMI0200' Format 8 C Parm QPgm 20 C Parm ErrLength I can see the object, and I'm authorized to it, because I can do a DSPPGM. I can't check for an error code because I can't get the last parm to work with anything but a 0. When I try to use the error field (from qsysinc/qrpglesrc,qusec) I get MCH3601/RNQ0222 errors (Pointer not set). TIA Tom

  3. #3
    D.Handy Guest

    Default API returns blanks

    Thomas, D ErrLength s 4b 0 inz(0) D Length s 4b 0 inz(600) This is a very common mistake for RPG programmers to make with APIs. The API documentation is written without regard to HLL used, and many APIs list an argument as Binary(4). What this really means is 4 *bytes*, not 4 digits. In RPG IV, a D spec for a stand-alone numeric variable (not in a DS) names the number of *digits* desired, not the *bytes* required. For example, a packed number listed as "9P 0" would have nine digits though it takes five bytes of storage. Likewise, RPG supports either 2-byte or 4-byte binary numbers, but this equates to 4 or 9 digits respectively. Consequently, you could change the "4b" to "9b" since a 9 digit binary number in RPG creates a 4 byte binary field to satisfy the API (and most other APIs). That being said, it would be even better to change it to a 10 digit integer field with no decimal places by using "10i 0". Although RPG III syntax does not have an integer data type, the RPG IV integer is really the best equivalent field type to use for APIs. What is happening is that by specifying "4b 0", you are only passing a 2-byte value where the API expected 4 bytes. Consequently, it is not correctly getting the second parameter which is the length to return. There is a *very* good redbook on using RPG IV which I highly recommend. The link to the PDF copy is href="http://www.redbooks.ibm.com/abstracts/sg245402.html">here. Doug

  4. #4
    B.Myrick Guest

    Default API returns blanks

    Doug, I agree with the RPG IV redbook **.****% (IBM's version of 100%). I liked the book so much, that I ordered it through fatbrain.com for $20.00 and 7.95 for 2nd day delivery. Used my debit card and it was here before the transaction hit (no lie) my account. Starting to dog-ear the thing, but what an inexepensive investment. Later, Bret Myrick

+ Reply to Thread

Similar Threads

  1. Replacing blanks in a field
    By KLS01 in forum RPG
    Replies: 2
    Last Post: 11-15-2008, 02:11 AM
  2. Leading blanks.
    By David Abramowitz in forum RPG
    Replies: 11
    Last Post: 06-30-2006, 02:36 PM
  3. CODESRV stripping out blanks
    By Guest.Visitor in forum Programming
    Replies: 5
    Last Post: 08-15-2001, 05:08 AM
  4. Trailing blanks
    By Guest.Visitor in forum Programming
    Replies: 6
    Last Post: 09-09-1999, 08:04 AM
  5. A query that returns nothing??
    By Guest.Visitor in forum Programming
    Replies: 1
    Last Post: 06-29-1999, 02:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts