This page is intended for PASE providers learning how to call PASE from ILE.

If you know little about PASE see this link PASE In A Nutshell.

Q Can my ILE RPG/C *PGM load/call functions in PASE shared libraries (libc.a, libmy.a, etc.)?

Answer: Yes. Click here to run demo … {Run RPG CGI call PASE libmy.a -> accounts}


  • 2012–09–12 - RPG call PASE libmy.a
    • callpase-pase-1.0.zip - PASE libmy.a (PASE source)
      • call qp2term
        > mkdir /home/callpase
        > cd /home/callpase
        -- unzip callpase-pase-1.0.zip FTP to /home/callpase --
        > make -f mymake
        -- xlc compiler must be installed on your IBM i machine --
    • callpase-rpg-1.0.zip - ILE library CALLPASE (RPG source)
      • 1. Unzip callpase-rpg-1.0.zip to callpase.savf
        2. FTP callpase.savf to QGPL library (empty savf must exist already)
           > crtSAVF FILE(QGPL/CALLPASE)
           > clrSAVF FILE(QGPL/CALLPASE)
        3. Install CALLPASE source code library on IBM i
           Note: if updating/replacing and you get "objects not restored," try options MBROPT(*ALL) ALWOBJDIF(*ALL)   
        4. Create RPG programs
           > call crtcall

Bill of materials (view on-line):

Example callpase.rpgle *PGM is faced with many of the typical issues calling PASE

  • PASE needs to be activated in this job (start32), RPG needs to use ILE API Qp2RunPase
  • PASE needs to be deactivated when done, RPG needs to use ILE API Qp2EndPase
  • PASE libmy.a needs to be found/loaded, RPG needs to use ILE API Qp2dlopen
  • PASE libmy.a function accounts needs to be found for call, RPG needs to use Qp2dlsym
    • PASE function in libmy.a: int accounts(int max, account_t *find[])
      • (Whew, look at the PASE pointers account_t *find[] returned to RPG!)
  • PASE can only see memory that PASE created, RPG needs to use ILE API Qp2malloc/Qp2free
  • PASE returns an array of addresses 32-bit (account_t *find[]), RPG wants to use space pointers (D accPtr S *)
    • PASE addresses returned from anywhere in PASE memory, RPG needs PASE help to understand (_SETSPPM)
    • PASE _SETSPPM knows how to convert 32/64-bit to space pointers, RPG wants to use this function
    • PASE address mathematics all 32 bit (10u 0), RPG needs PASE origin based calculations (accParms2 + (%addr(accArgs.accRec(1)) - accParms))
  • PASE strings ASCII null terminated (char *first_name), RPG wants EBCDIC characters (D iaccFirst 32A)
    • Tip: QDCXLATE is used in this example (easy/simple), but please use iconv for production work
    This site url:
    Apache directives (httpd.conf):
    # callpase demos
    ScriptAlias /demo/ /QSYS.LIB/CALLPASE.LIB/
    <Directory /QSYS.LIB/CALLPASE.LIB/>
      AllowOverride None
      order allow,deny
      allow from all
      SetHandler cgi-script
      Options +ExecCGI
    Single job run RPG CALLPASE and PASE libmy.a:
          :                     :                     :
      |----------|---------|  | : |  |----------|---------|
      |        PASE        |  | : |  |       OS/400       |
      | libmy.a->accounts  |  | : |  | PGM-CALLPASE (RPG) |
      |                    |  | : |  | Qp2RunPase,        |
      |                    |  | : |  | Qp2dlopen,         |
      |                    |  | : |  | Qp2CallPase, etc.  |
      ========================| : |======================== MI (OS/400)
      AIX/PASE SYSCALL        | : |MI instructions
      privileged mode boundary| : |privileged mode boundary
      ========================| : |========================
      | IBM i SLIC kernel, same for OS/400 + PASE         |
      | (completely replaced AIX kernel /unix)            |
      |  POWER PC hardware processor                      |
    * PASE/AIX compiled binaries are NOT emulated
    * PASE/AIX Power PC processor supports both 32/64-bit binaries
    * PASE/ILE programs share same SLIC kernel, and also share same basic SLIC exception/signal processing
    * PASE/ILE memory for program run stack/heap/shared memory is acquired from same SLIC pools (teraspace)
      (however, PASE can ONLY see memory PASE acquired through it's own syscall APIs)


Tony “Ranger” Cairns - IBM i PHP / PASE