Getliste.RPG

 
     h NoMain


     d GetListE        pr              *
     d   QUserSpace                  20
     d   Entry#                      10u 0 Value
     d   Total#E                     10u 0 Options(*NoPass)
     d   Subset                       1n   Options(*NoPass)



     p GetListE        b                   Export
     d GetListE        pi              *
     d   QUserSpace                  20
     d   Entry#                      10u 0 Value
     d   Total#E                     10u 0 Options(*NoPass)
     d   Subset                       1n   Options(*NoPass)

     d SUserSpace      s             20    Static
     d pUserSpace      s               *   Static

     d pReturnVal      s               *

     d UserSpace       ds                  Based(pUserSpace)
     d                              124
     d   OS2List                     10u 0
     d                               10u 0
     d   #Entries                    10u 0
     d   EntrySize                   10u 0
     d                                9
     d   ListSubset                   1n


      *  If QUserSpace is blank, reset SUserSpace and return null.
     c                   If        QUserSpace = *Blanks
     c                   MoveL     *Blanks       SUserSpace
     c                   Return    *Null
     c                   EndIf


      *  Get pointer to user space if request is for a new user space.
     c                   If        QUserSpace <> SUserSpace

     c                   Call      'QUSPTRUS'
     c                   Parm                    QUserSpace
     c                   Parm                    pUserSpace

     c                   MoveL     QUserSpace    SUserSpace
     c                   EndIf


      *  Set "Total Number of Entries" and "Subsetted List Indicator"
      *  parameters.
     c                   If        %Parms > 2
     c                   Z-Add     #Entries      Total#E

     c                   If        %Parms > 3
     c                   MoveL     ListSubset    Subset

     c                   EndIf
     c                   EndIf


      *  Check for out-of-bounds request
     c                   If        Entry# > #Entries  Or
     c                             Entry# < 1
     c                   Return    *Null
     c                   EndIf


      *  Set pointer to the requested entry. This will be the procedure's
      *  return value.
     c                   Eval      pReturnVal = pUserSpace + OS2List +
     c                                           ((Entry# - 1) * EntrySize)


     c                   Return    pReturnVal
     p GetListE        e
 

-ADS BY GOOGLE

SearchDataCenter

Close