ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

System API's learning tool for RPG programmers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • System API's learning tool for RPG programmers

    Its name is APIGUIDE. Not an utility, just a learning tool.

    The tool provides a number of examples of calling IBM i system API's from RPG programs.
    The examples were taken from several www.easy400.net site utilities.

    You can download this tool at zero charge.

    See page http://www.easy400.net/apiguide/html/page1.html .

    download this tool

  • #2
    Fantastic resource, thank you sir and a happy new 2018 to you.
    the smoking gnu

    Comment


    • #3
      I agree, thanks jbperotti, this is a good thing!

      There is no way to know all of the APIs that exist on out machine... however, this is a wonderful resource for those of us who know what we want but cannot remember the name.


      Best Regards and Good Luck!

      Fred Williams

      Comment


      • #4
        For alist ofavailable API's., see page https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/aplist.htm

        Giovanni B. Perotti

        Comment


        • #5
          Nice!

          Comment


          • #6
            I am always interested in how people call the QRCVDTAQ API. The example http://www.easy400.net/apiguidep/dspsrc.pgm doesn't make the common mistake of thinking that the length parameter is an input parameter. But it does make a possible mistake of having the data parameter shorter than the maximum length of an entry. For this little example, it's fine, since the entry is much shorter than the data length of 512. But in real life, having a data parameter with a length of only 512 where the maximum entry length is 32767, could lead to storage corruption, if an entry is longer than 512.

            So, I recommend calling QRCVDTAQ with the extra parameters that allow you to specify the length of the receiver variable.

            Code:
                 D QRCVDTAQ        pr                  extpgm('QSYS/QRCVDTAQ')                                  
                 D  DtaqName                     10                                                             
                 D  DtaqLib                      10                                                             
                 D  DataLen                       5p 0                                                          
                 D  Data                      [COLOR=#FF0000]32767    options(*varsize)[/COLOR]                                        
                 D  WaitTime                      5p 0                                                          
            [COLOR=#FF0000]     D  KeyOrder                      2a   const
                 D  KeyDataLen                    3p 0 const
                 D  KeyData                   32767a   options(*varsize)
                 D  SenderLen                     3p 0 const
                 D  SenderInfo                32767a   options(*varsize)
                 D  RemoveMsg                    10a   const
                 D  DataSize                      5p 0 const
                 D  ErrorCode                          likeds(errCode)[/COLOR]
            
            [COLOR=#FF0000]     D ErrCode         ds                  
                 D  BytesPrv                     10i 0 inz(0)
                 D  BytesAvail                   10i 0
            
                 D DummyKeyData    s              1a
                 D DummySender     s              1a[/COLOR]
            
                    ...
                    // Receive an entry from the data queue                                                    
                    WaitTime=-1;     // wait until something there                                             
                    QRCVDTAQ(DtaqName:DtaqLib:DataLen:Data:WaitTime
            [COLOR=#FF0000]                : ' ' : 0 : DummyKeyData : 0 : DummySender
                            : '*YES' : 512 : ErrCode);[/COLOR]

            Comment


            • #7
              Useful suggestion Barbara. Will do that.

              Comment

              Working...
              X