×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hi Steve,
RPG cant allocate teraspace directly, but it can copy to and from
teraspace memory. Most important, RPG can set its own pointers
anywhere within a 16meg+ sized teraspace allocation. All you need is
an ILE C module that contains a procedure that runs malloc to alloc
the space and another that runs free to free the teraspace.
Actually, you don't need an ILE C module or the ILE C compiler. You can
call the teraspace APIs directly from an RPG program to do the
allocation for you. This has been available since V4R4.
Hi Steve,
> RPG cant allocate teraspace directly, but it can copy to and from
> teraspace memory. Most important, RPG can set its own pointers
> anywhere within a 16meg+ sized teraspace allocation. All you need is
> an ILE C module that contains a procedure that runs malloc to alloc
> the space and another that runs free to free the teraspace.
Actually, you don't need an ILE C module or the ILE C compiler. You can
call the teraspace APIs directly from an RPG program to do the
allocation for you. This has been available since V4R4.
You need V5R2 or later to exceed 4gb per allocation, however, because
the API takes a 32-bit unsigned integer as a parameter. In V5R2, they
added a 2nd API that allows bigger numbers.
Here's a copybook called TERASPC_H:
/if defined(*V5R2M0)
D TS_malloc PR * ExtProc('_C_TS_malloc64')
D size 20U 0 value
/else
D TS_malloc PR * ExtProc('_C_TS_malloc')
D size 10U 0 value
/endif
D TS_realloc PR * ExtProc('_C_TS_realloc')
D ptr * value
D size 10U 0 value
D TS_free PR ExtProc('_C_TS_free')
D ptr * value
And a simple program to demosntrate it:
H DFTACTGRP(*NO) BNDDIR('QC2LE')
/copy TERASPC_H
D myPtr s *
/free
// Allocate 100gb to a pointer:
myPtr = TS_malloc(100 * 1024 * 1024 * 1024);
TS_free(myPtr);
As an Amazon Associate we earn from qualifying purchases.