|
Hello Dave,
You can avoid using a system pointer to access a user space by using the
Retrieve (Space) Pointer to User Space (QUSPTRUS) API and the LOCKSL
function together:
**-- Control
pecifications: -------------------------------------------**
H Option( *SrcStmt )
**-- API error information:
D ERRC0100 Ds Qualified
D BytPro 10i 0 Inz( %Size( ERRC0100 ))
D BytAvl 10i 0
D MsgId 7a
D 1a
D MsgDta 256a
**-- Local constants:
D LSRD_LOCK c x'80'
D LSRO_LOCK c x'40'
D LSUP_LOCK c x'20'
D LEAR_LOCK c x'10'
D LENR_LOCK c x'08'
**-- Global variables:
D pUsrSpc s *
**-- Global constants:
D USR_SPC c 'USRSPC001 QUSRSYS'
**-- Create user space:
D CrtUsrSpc Pr ExtPgm( 'QUSCRTUS' )
D SpcNamQ 20a Const
D ExtAtr 10a Const
D InzSiz 10i 0 Const
D InzVal 1a Const
D PubAut 10a Const
D Text 50a Const
D Replace 10a Const Options( *NoPass )
D Error 32767a Options( *NoPass:
*VarSize )
D Domain 10a Const Options( *NoPass )
**-- Retrieve pointer to user space:
D RtvPtrSpc Pr ExtPgm( 'QUSPTRUS' )
D SpcNamQ 20a Const
D SpcPtr *
D Error 32767a Options( *NoPass:
*VarSize )
**-- Delete user space:
D DltUsrSpc Pr ExtPgm( 'QUSDLTUS' )
D SpcNamQ 20a Const
D Error 32767a Options( *VarSize )
**-- Lock space location:
D LckSpcLoc Pr ExtProc( '_LOCKSL1' )
D SpcLoc * Const
D LckRqs 1a Const
**-- Unlock space location:
D UnlckSpcLoc Pr ExtProc( '_UNLOCKSL1' )
D SpcLoc * Const
D LckRqs 1a Const
/Free
CrtUsrSpc( USR_SPC
: 'LOCKSL'
: 1024
: x'00'
: '*CHANGE'
: *Blanks
: '*YES'
: ERRC0100
);
RtvPtrSpc( USR_SPC: pUsrSpc: ERRC0100 );
LckSpcLoc( pUsrSpc: LENR_LOCK );
// Update user space...
UnlckSpcLoc( pUsrSpc: LENR_LOCK );
DltUsrSpc( USR_SPC: ERRC0100 );
Return;
/End-Free
This way you get the user space's space pointer directly as opposed to
retrieve a system pointer to the user space object and then use the setsppfp
function to get to the object's space pointer.
Best regards,
Carsten Flensburg
----- Original Message -----
From: "Dave Schnee" <DSchnee@xxxxxxxxxxxxxxxxxxx>
To: <midrange-l@xxxxxxxxxxxx>
Sent: Wednesday, June 14, 2006 3:10 PM
Subject: Re: Fastest access: user space, data area, data queue
Dave: The problem is that RPGLE cannot handle nor pass a "system pointer" at all. When you look at a pointer in RPGLE, you can see a procedure
pointer
or a space pointer and show its value (say, using STRDBG). If you pass
a
system pointer back from MI or C to RPGLE, the "pointer" attribute (and value) are lost. So, yes, I did try, but I had to keep the system pointer stored in a C module and use an entry to that module to use the LOCK/UNLOCK mechanism
to
get this to work.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.