ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

I need to bind in a teraspace and a non teraspace service program

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

  • I need to bind in a teraspace and a non teraspace service program

    I am new to teraspace, and pretty new to service programs and binding, so please go easy on me

    I have a service program P9600S with two modules
    Module P9600MA, which needs to call many procedures in teraspace service program P9140S
    Module P9600MB, which needs to call one procedure in non-teraspace service program P2150S

    This cannot be done, right? A service program cannot bind in both teraspace and non teraspace service programs?

    So what to do about this.

    So much of what service program P9600S does is related to other teraspace service programs, that I think P9600S should be teraspace too.

    So I assume my only alternative is to create a teraspace version of P2150S?
    P2150S contains only one module, P2150M. Would it be possible to bind that same module into two service programs, one teraspace and one not, and have programs binding it in automatically choose the correct one? I do not know how the system resolves it when it can find more than one of the same named procedure in a binding directory.
    Or would I simply have to duplicae P2150M's source and have two separate modules in two separate service programs?

  • #2
    My workaround for this has been to avoid using the teraspace storage model -- i.e,, never create objects with STGMDL(*TERASPACE) because of the problem you cite. Instead, I use teraspace allocations by allocating dynamic memory using the ts_malloc() and related APIs. This way, I can still have dynamic memory larger than 16mb, but since the program itself is still a "normal" single-store model program, it can be called normally from everywhere.

    Of course, it entirely depends on what you're trying to do with teraspace.

    Comment


    • #3
      If you code ALLOC(*TERASPACE) in your H spec, RPG will allocate from teraspace heap storage.

      Comment


      • #4
        It's possible to create a service program that links to both teraspace and non-teraspace service programs. The non-teraspace service programs would need to have storage model *inherit. The new service program would have stgmdl(*teraspace), and any programs that use that service program would have to have stgmdl(*teraspace).

        Comment

        Working...
        X