× 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 Rob,

> I am trying to use the QMHRCVPM API in a RPG iv program at V5R2M0.  I keep
> on getting the error CPF3C21 (Format name &1 is not valid) even though the
> format I am using is RCVM0200. Can someone PLEASE tell me what I am doing
> wrong???


The only thing I can see in your code that's actually coded incorrectly is
the ERRCDE variable.  You've got it declared as 1A, but it should be a
data structure containing at least 2 binary(4) fields, and optionally
some additional ones.

Also, this isn't causing any error messages, but.. one of the nice
differences between RPGIV and the older versions of RPG is that you don't
have to declare your binary variables in a data structure, you can
declare them as regular variables in your D-specs.

Also, although the "B" data type WILL work for most APIs, it's not exactly
what the API manual is asking for.  The B data type allows values from
-999999999 to 999999999, but the APIs are expecting a true 4-byte binary
integer, which allows values from -2147483646 to 2147483645.  That data
type in RPGIV is data type I.

The following code demonstrates these things.  I tried compiling and
running this code, and it does not produce a CPF3C21.  I didn't try
sending a program message to it's callstack entry to see if an error would
be removed from the job log, I'll leave that up to you...

     d MSGDTA2         s            500
     d msglen          s             10I 0 inz
     d cstkcn          s             10I 0 inz
     d waittm          s             10I 0 inz

      **
      ** Simple Error Code...  upon error, the API will send us an
      **    escape message, since we told it that we have no space
      **    to retrieve an error message into.
      **
     D ERRCDE          ds
     D  bytesprov                    10I 0 inz(0)
     D  bytesavail                   10I 0 inz(0)


      **
      ** Complete Error Code... upon error, the API will put error
      **    information into the data structure.
      **
     D ERRCDE2         ds
     D  bytesprov2                   10I 0 inz(%size(ERRCDE2))
     D  bytesavail2                  10I 0 inz(0)
     D  msgid                         7A
     D  reserved                      1A
     D  msgdata                     240A

     c                   MOVE      'RCVM0200'    FMTNAM

      ** Example 1: Simple error code...

     C                   CALL(E)   'QMHRCVPM'
     C                   PARM                    MSGDTA2
     C                   PARM      500           MSGLEN
     C                   PARM                    FMTNAM            8
     C                   PARM      '*'           CSTKEN           10
     C                   PARM                    CSTKCN
     C                   PARM      '*LAST'       MSGTYP           10
     C                   PARM      *BLANKS       MSGKEY            4
     C                   PARM                    WAITTM
     C                   PARM      '*REMOVE'     MSGACT           10
     C                   PARM                    ERRCDE

     c                   if        %error
      ** API failed, handle error.  Error should be in job log
     c                   endif

     C                   CALL      'QMHRCVPM'
     C                   PARM                    MSGDTA2
     C                   PARM      500           MSGLEN
     C                   PARM                    FMTNAM            8
     C                   PARM      '*'           CSTKEN           10
     C                   PARM                    CSTKCN
     C                   PARM      '*LAST'       MSGTYP           10
     C                   PARM      *BLANKS       MSGKEY            4
     C                   PARM                    WAITTM
     C                   PARM      '*REMOVE'     MSGACT           10
     C                   PARM                    ERRCDE2

     c                   if        bytesavail > 0
      ** API failed, error message id is in "msgid" variable.
      **    any fill-in data for that message is in "msgdata" variable.
     c                   endif

     c                   eval      *inlr = *on

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.