× 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.



I prefer the DefVar approach as it avoids ChgVars and, for me, is easier to
visualize when working with structured data (like a generic header or list
entry). I would much rather define the structure once and not try to figure
out what adding an offset of x'0084', through a ChgVar, is doing. But
that's why there are so many styles -- all of which work.

Bruce
On Wed, Aug 14, 2013 at 2:39 PM, <rob@xxxxxxxxx> wrote:

Bruce, I know you've wrote the book on APIs but maybe you're having a bad
day?
If you take the pointer to the user space,
which matches the pointer to the generic list header (as you've pointed
out),
and add the offset x'0084' as per

http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/apiref/usfgeneral.htm
you will get the pointer to the variable "number of list entries". Which,
in my case, is the number of job entries.
Perhaps you're so used to just using DEFVAR (perhaps rightly so) that
using a pointer to get to it seems silly?
For one who is more comfortable with pointers than hex to decimal
conversion, maybe not.


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 02:49 PM
Subject: Re: Pointer manipulation in CLLE.
Sent by: midrange-l-bounces@xxxxxxxxxxxx



I'm not sure what you're trying to do, but &pJobCount is NOT a pointer to
&JobCount. Rather &JobCount is a 4-byte integer definition of where ever
&pJobCount is pointing -- which is currently no where as you have not set
&pJobCount in the program. What is it you're trying to accomplish?

Bruce Vining.

On Wed, Aug 14, 2013 at 1:24 PM, <rob@xxxxxxxxx> wrote:

Ok, what am I doing wrong here? (other than using CL please).

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 have
to +
use two steps and a temporary variable.
:-( */
DCL &intWork *INT /* We can't do %binary(X'000C') so we have
to +
use two steps and a temporary variable.
:-( */
...
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 . . . . . . . . . : Ex2401PtrDoesNotExist
Instruction . . . . . . . . : 0000C8

To program . . . . . . . . . . : UPSJOB
To library . . . . . . . . . : MAILTWO
To module . . . . . . . . . : UPSJOB
To procedure . . . . . . . . : UPSJOB
To statement . . . . . . . . : 249

&PJOBCOUNT = SPP:*NULL
&PUSRSPC = SPP:100500D605001000


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

--
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.




--
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 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.