|
Hi Dave,Here's an RPGLE pgm that does LOCKSL/UNLOCSL, but I'm not sure whether it does what you were trying to do with the system pointer.
--Dave -------------------------------------------------------------------- h bnddir( 'QC2LE' ) d rslvsp2 pr extproc( '_RSLVSP2' ) d Pointer * d Template 34a const d setsppfp pr * extproc('setsppfp') d inPtr 16a value d locksl2 pr extproc( '_LOCKSL2' ) d Pointer * value d unlocksl2 pr extproc( '_UNLOCKSL2' ) d Pointer * value d ds d theptr 1 16* d theptra 1 16 d lslTempl ds d numReq 1 4i 0 d offSel 5 6i 0 d MItime 7 14a d lockReq 15 17a d newMask 18 19a d prvMask 20 21a d spcLocP 33 48* d lckStSel 49 49a d ussyp s * d usspp s * d templP s * d templPP s * c callp rslvsp2 (ussyp : X'1934' + c 'AUSRSPC ' + c X'0000') c eval theptr = ussyp c eval usspp = setsppfp(theptra) c eval lslTempl = *allx'00' c eval numReq = 1 c eval offSel = 48 c eval lckStSel = x'09' LENR c eval spcLocP = usspp c eval templP = %addr(lslTempl) c eval templPP = %addr(templP) c callp locksl2 (templPP) c callp unlocksl2 (templPP) c eval *inlr = *on -------------------------------------------------------------------- Dave Schnee wrote:
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.Dave Schnee, Barsa Consulting Group, LLC- - - - - Dave McKenzie wrote - - - - -date: Tue, 13 Jun 2006 12:23:50 -0700 from: Dave McKenzie <davemck@xxxxxxxxxxxxx> subject: Re: Fastest access: user space, data area, data queue Dave, Did you mean you didn't try LOCKSL/UNLOCKSL in RPGLE (only C), or you tried it in RPGLE and it didn't work? --Dave Dave Schnee wrote: > Albert: > You don't make it clear what you mean by "accessing". If you need to read/increment/update something in a user space or data area, you will want to prevent others from doing so at the "same time". That means allocating the object. The retrieval from or writing to a dataqueue does not use that kind of locking mechanism. >> If you use a user space and do NOT need to lock it, your speed depends upon how often you need to get a pointer to the (data part of) the space. If it's a "one guy does any updating and many guys read the current value", then the user space might be your best bet (only one guy needs to do the ALCOBJ/DLCOBJ). If many guys need to do a read-then-update, you need to allow time to locate the object for each part of ALCOBJ, Read, change, DLCOBJ - at least for a DTAARA. For a user space, you may be able to get a pointer to the space once then do many cycles of ALCOBJ, read, change, DLCOBJ which will only need to locate theobject 2 times instead of 4. >> A data queue will need 2 rounds of "locate the object" but will alsoneed time to get and/or put a message. > The BEST speed combination if many guys need toALCOBJ/read/change/DLCOBJ is probably the user space. I had a requirement to have many jobs doing just this and I found that the name resolution inherent in the ALCOBJ/DLCOBJ took 99% of the time if I used a user space and I could keep the pointer to the space between updates. I was able to use the MI LOCKSL and UNLOCKSL interfaces (but only in C, not RPGLE) to get a "system pointer" to the user space and save this pointer between retrieval/update cycles to save 99% of the time. > That's not for the faint-of-heart but it was most effective. > > Dave Schnee, > Barsa Consulting Group, LLC
As an Amazon Associate we earn from qualifying purchases.
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.