|
On Wednesday 28 November 2001 21:53, Buck Calabro wrote:
> >this is the debug info (just before %str()
> >
> >creates a pointer error):
> > > EVAL result
> >
> > RESULT = SPP:*NULL
> >
> > > EVAL Resultchar
> >
> > Variable not available to display.
> >
> > > EVAL pdu_ds
> >
> > NEXT OF PDU_DS = SPP:E9EB3556D5003A10
> > OID OF PDU_DS = SPP:E9EB3556D5003A20
> > ASN_TYPE OF PDU_DS = SPP:E9EB3556D5003A30
> > VAL_LEN OF PDU_DS = 90
> > RESULT OF PDU_DS = SPP:E9EB3556D5003A50
>
> Whoa, freaky! And there's no operations between any of the EVAL's? I'm
> grasping here, but is there a chance that the first "result" is in a
> different procedure from the "result of pdu_ds"?
>
> Try basing Resultchar on a different pointer, and doing an eval
> newptr=result.
>
> Very odd. Is this a PTF issue?
Good idea but probably not - I get the same problem on different releases...
I see that the RESULT OF PDU_DS = SPP:E9EB3556D5003A50 is sequential to the
other varaibles so it's probably a pointer within the DS, which should
contain the pointer for the string... which brings me back to my original
question - there's too many pointers for me! So either I got the prototypng
wrong or I'm going wrong in my actual call.
The V4R5 comesup with a different problem about the IBM program (QTOMAPI) not
being able to change a literal constant, so this probably means I'm getting
the pointers mixed up...
the actual RPG code is (including a few comments:)
0002.00 D
0003.00 D getsnmp PR 10I 0 ExtProc('snmpGet')
0004.00 D pdu_ptr * value
0005.00 D host_ptr * value options(*string)
0006.00 D timeout 10I 0 value
0007.00 D comm_ptr * value
0008.00 D comm_len 10I 0 value
0009.00
0010.00 D pdu_ptr_parm S *
0011.00 D pdu_ptr_s S *
0012.00 D pdu_ds DS 1000 based(pdu_ptr_s)
0013.00 D next *
0014.00 D oid *
0015.00 D asn_type *
0016.00 D val_len 10I 0
0017.00 D result *
0018.00
0019.00 D**ResultPtr S *
0020.00 D Resultchar S 90 based(result)
0021.00
**** 3 ways of specifying '1.1.0' - i dont know which is the right way to
specify an ascii string
0022.00 D*oidname S 6 inz(x'312E312E3000')
0023.00 D oidname S 6 inz(x'F14BF14BF000')
0024.00 D*oidname S 5 inz('1.1.0')
**** my local ip address
0025.00 D hostname S 11 inz('10.128.40.2')
0026.00 D commname S 6 inz(X'7075626C6963')
0027.00 D x S 10I 0
0028.00 D str S 20
0029.00
0030.00 ** alloc 90 ResultPtr
0031.00 c alloc 1000 pdu_ptr_parm
0032.00 c eval pdu_ptr_s = pdu_ptr_parm
0033.00 c eval next = *NULL
0034.00 c eval oid = %addr(oidname)
0035.00 c eval val_len = 90
0036.00 c eval x = getsnmp(pdu_ptr_parm:
0037.00 c %addr(hostname):
0038.00 c 5:
0039.00 c %addr(commname):
0040.00 c 6)
0041.00 c eval pdu_ptr_s = pdu_ptr_parm
0042.00
0043.00 c if x = 0 and
0044.00 c result <> *NULL
0045.00 ** eval resultptr = Result
0046.00 c eval str = %str(result)
0047.00 C dsply str
0048.00 c else
0049.00 c dsply x
0050.00 c endif
0051.00 c return
> --buck
> _______________________________________________
> This is the C programming iSeries / AS400 (C400-L) mailing list
> To post a message email: C400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/c400-l
> or email: C400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/c400-l.
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.