|
Bruce,
That would have cut down one of my pointer usages. I had a few others for
processing each list entry. I may do that though. I will sheepishly
admit that one thing is I hate doing the hex to decimal conversion and was
really hoping that I could use a constant in %binary.
The infocenter lists offsets in hex, not decimal.
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: Bruce Vining <bvining@xxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>,
Date: 08/14/2013 03:24 PM
Subject: Re: Pointer manipulation in CLLE.
Sent by: midrange-l-bounces@xxxxxxxxxxxx
Rob,
If what you're after is the number of list entries returned from say
QUSLJOB, then the following should work quite nicely:
Pgm
Dcl Var(&pUsrSpc) Type(*Ptr)
Dcl Var(&LstHdr) Type(*Char) Len(191) Stg(*Based) +
BasPtr(&pUsrSpc)
Dcl Var(&JobCount) Type(*Int) Stg(*Defined) +
DefVar(&LstHdr 133)
Call Pgm(QUSPTRUS) Parm('PLAYSPACE QTEMP' +
&pUsrSpc 0)
EndPgm
After the call to QUSPTRUS &JobCount will be set.
Bruce
On Wed, Aug 14, 2013 at 1:55 PM, <rob@xxxxxxxxx> wrote:
I'll try that. If that works my "initialization" section is going tofull
of comments about this crap.%binary
Sort of like my existing one 'geez, why can't I use a constant in
likelist
chgvar &mydec (%binary(X'0012')
so why must I use a variable?
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>,
Date: 08/14/2013 02:49 PM
Subject: Re: Pointer manipulation in CLLE.
Sent by: midrange-l-bounces@xxxxxxxxxxxx
Rob, I think %OFFSET only changes the offset of the pointer, it doesn't
change the entire address.
When you get to the ChgVar %Offset line of code, pJobCount is null. You
are telling it "I still want you to point to null, but please change the
offset within null to the same offset that's in the pUsrSpc pointer,
except, add some to it..."
Which doesn't make any sense. You can't have an offset unless you're
pointing to an actual space -- You can't offset null!
So I would say you want to do this:
ChgVar &pJobCount value(&pUsrSpc)
ChgVar %offset(&pJobCount) value(%offset(&pJobCount) + &intWork)
That's untested, off the top of my head...
On 8/14/2013 1:24 PM, rob@xxxxxxxxx wrote:
Ok, what am I doing wrong here? (other than using CL please).have
DCL &pJobCount *PTR /* Pointer to &JobCount */
DCL &JobCount *INT BASPTR(&pJobCount) STG(*BASED) +
/* Number of jobs from list job */
...
DCL &pUsrSpc *PTR /* Pointer to physical user space */
...
DCL &BinChar *CHAR 2 /* We can't do %binary(X'000C') so we
to +variable.
use two steps and a temporary
:-( */have
DCL &intWork *INT /* We can't do %binary(X'000C') so we
to +variable.
use two steps and a temporary
:-( */--
...
CALL QUSPTRUS PARM(&UsrSpc &pUsrSpc &ErrCode)
...
CHGVAR &binChar X'0084'
CHGVAR &intWork %binary(&binChar)
CHGVAR %offset(&pJobCount) (%offset(&pUsrSpc) + &intWork)
MCH3601 - Pointer not set for location referenced.
From program . . . . . . . . . : Ex2401PtrDoesNotExistInstruction . . . . . . . . : 0000C8
To program . . . . . . . . . . : UPSJOB
To library . . . . . . . . . : MAILTWO
To module . . . . . . . . . : UPSJOB
To procedure . . . . . . . . : UPSJOB
To statement . . . . . . . . : 249
&PJOBCOUNT = SPP:*NULL
&PUSRSPC = SPP:100500D605001000
Rob Berendt
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
Regards,
Bruce
www.brucevining.com
www.powercl.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
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.