ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

calling a MI instruction from RPG using a prototype

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

  • calling a MI instruction from RPG using a prototype

    I have for a long time been thinking if it is possible to call a MI instruction from RPG using a prototype.
    How do you specify it?


    In the manual Machine Interface Instructions APIs



    the instruction Copy Bits with Left Logical Shift (CPYBTLLS) is described.


    Does any of you know how to implement this in RPG?
    And can you give an example of the required code to do it.

  • #2
    You can only call the instructions that have bound program access.

    To see what I mean, use the _CIPHER instruction as an example. When you look up the page for _CIPHER, you'll see a box explaining the bound program access. CPYBTLLS does not appear to have bound program access -- so can't be called from RPG.

    An easy way to shift one bit to the left is to overlay the data wtih an unsigned integer field (if it' not ready one) and multiply by 2.

    If you need something that perfroms better than multiplying... you coud use the << operator in a C program, and wrap it with a subprocedure, then call it from your RPG.

    Comment


    • #3
      Thank you for your response.
      I have searched for this and found nothing about it.
      The only thing I have found is the solution using the << operator in a C program.

      So I was curious if it could be done.

      Comment


      • #4
        It can be done with multiplication/division -- that's how I've always done it in RPG.

        Comment

        Working...
        X