Hello Sharon,

I cannot find a way to create the program to do so. When I create the RPG module it is not teraspace enabled. The ILE Concepts book says RPG ILE is teraspace enabled but it isn't working. We are on V5R3.

Yes, RPG modules are teraspace enabled starting with V4R4. However, maybe I need to clarify what is meant by "teraspace enabled".

Teraspace enabled means that the RPG module is capable of working with teraspace pointers. You can allocate memory in teraspace by calling the _C_ts_malloc() API. You can perform pointer math on these teraspace pointers. You can dereference the pointer and copy data to/from the teraspace memory.

That's what "teraspace enabled" means.

In RPG, every module (V4R4 or later) is automatically teraspace enabled. You do not have to do anything special to make them so. In ILE C, however, you have to specify TERASPACE(*YES) to make a program teraspace enabled.

Now, ILE C has a bunch of additional teraspace options that go above and beyond the enablement of teraspace. It has an option called *TSIFC that tells the preprocessor to automatically substitute a call to _C_ts_malloc() instead of malloc(). Same for realloc(), cmalloc(), an free() -- the teraspace equivalent is automatically substituted.

RPG does not have that option. It has to explicitly call the _C_ts_malloc() API (and friends) if it wants to use teraspace. The ALLOC op-code, or the %alloc() BIF will only allocated in single-level storage.

C also has an option called STGMDL(*TERASPACE), that lets it use teraspace for EVERYTHING, not just when you deliberately allocate memory from teraspace. The ILE Concepts manual refers to this as the "Teraspace Storage Model", and states that it "goes beyond" normal teraspace enablement. RPG does not have an equivalent option.

When you create a service program that uses STGMDL(*TERASPACE), it'll run in a teraspace activation group instead of a normal one. This can be a problem if you specify ACTGRP(*CALLER) on the service program, because you;re (presumably) calling it from an RPG program, and that RPG program creates the activation group.

The RPG program will create a normal activation group. When it tries to load the C service program with ACTGRP(*CALLER), the activation will fail with MCH4430 (Activation access violation) because the C service program requires a special teraspace activation group! But, again, this only happens when the C module and service program are created with STGMDL(*TERASPACE), and not for simple teraspace enablement.

If this is whats happening to you, there are a few ways to fix it:

a) Compile the C module and service program with the following settings:

       CRTCMOD TERASPACE(*YES *TSIFC) STGMDL(*INHERIT)
       CRTSRVPGM STGMDL(*INHERIT) ACTGRP(*CALLER)

   This tells the ILE environment to use a single-level storage model
   when called from an activation group that's designed for single-level
   storage, and a teraspace storage model when called from an
   activation group that's designed for teraspace.

   Calls to malloc() and friends will still allocate memory in teraspace,
   but any memory allocated by the system (instead of an explicit call
   to malloc/calloc/realloc) will depend on the activation group it's
   called from.

b) Continue using STGMDL(*TERASPACE), but do NOT specify ACTGRP(*CALLER).
   Instead, use a named activation group that's separate from the one
   that the RPG program is using.

c) Use STGMDL(*SNGLVL) throughout.  Only teraspace-enable your programs,
   do not use the teraspace storage model.


Hope that helps. If not, please provide more information about the problem. I had to take a guess at what the problem was, since you said there was an error, but didn't say how the programs were created, or what the error was!

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.