×
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.
We just upgraded to V7.3 and now I am getting a API_RC_INVALID_PDU_TYPE error on SNMPGET()
I have seen some link about an issue with that on 7.2 but the link do not show what they found.
Here is the code
ctl-opt DEBUG(*YES) DFTACTGRP(*NO) ACTGRP(*CALLER);
ctl-opt OPTION(*srcstmt:*nodebugio);
dcl-pr Translate ExtPgm('QDCXLATE');
Length packed(5:0) const;
Data char(32766) options(*varsize);
Table char(10) const;
end-pr;
dcl-pr getsnmp int(10) extproc('snmpGet');
pdu_ptr pointer value;
host_ptr pointer value options(*string);
timeout int(10) value;
comm_ptr pointer value options(*string);
comm_len int(10) value;
end-pr;
dcl-pr setsnmp int(10) extproc('snmpSet');
pdu_ptr pointer value;
host_ptr pointer value options(*string);
timeout int(10) value;
comm_ptr pointer value options(*string);
comm_len int(10) value;
end-pr;
dcl-pr getnextsnmp int(10) extproc('snmpGetnext');
pdu_ptr pointer value;
host_ptr pointer value options(*string);
timeout int(10) value;
comm_ptr pointer value options(*string);
comm_len int(10) value;
end-pr;
dcl-ds varBind align;
nextBind pointer inz(*NULL);
pOid pointer inz(%addr(oid));
asnType char(1);
valLen int(10) inz(50);
valPtr pointer inz(%addr(value));
end-ds;
dcl-ds snmppdu;
pduType char(1);
errSts int(10);
errIdx int(10);
pVarBind pointer inz(%addr(varBind));
end-ds;
dcl-pi snmpgm01;
host char(100);
cmty char(10);
operation char(7);
p@oid char(50);
p@value char(50);
OK char(1);
end-pi;
dcl-s x int(10);
dcl-c @null const(x'00');
dcl-c asn_unknown const(x'00');
dcl-c asn_integer const(x'02');
dcl-c asn_string const(x'04');
dcl-c asn_null const(x'05');
dcl-c asn_object_id const(x'06');
dcl-c asn_ipaddress const(x'40');
dcl-c asn_counter const(x'41');
dcl-c asn_gauge const(x'42');
dcl-c asn_timeticks const(x'43');
dcl-c asn_opaque const(x'44');
dcl-s value char(50);
dcl-s oid char(50);
dcl-ds valueds;
DSvalue char(50);
DSvaluei int(10) overlay(dsvalue);
end-ds;
ok = 'N';
clear value;
callp Translate(%len(value):value:'QTCPASC');
callp Translate(%len(%trim(cmty)):cmty:'QTCPASC');
oid = %trim(p@oid) + @null;
host = %trim(host) + @null;
if operation = 'GET';
x = getsnmp(%addr(snmppdu) :
%addr(host) :
5:%addr(cmty):
%len(%trim(cmty)));
elseif operation = 'SET';
x = Setsnmp(%addr(snmppdu) :
%addr(host) :
5:%addr(cmty):
%len(%trim(cmty)));
else;
x = getnextsnmp(%addr(snmppdu) :
%addr(host) :
5:%addr(cmty):
%len(%trim(cmty)));
endif;
dump;
if x = 0;
ok = 'Y';
endif;
p@oid = %trim(oid);
select;
when asntype = asn_unknown;
callp Translate(50:value:'QTCPEBC');
p@value = value;
when asntype = asn_integer;
dsvalue = value;
p@value = %char(dsvaluei);
when asntype = asn_string;
callp Translate(50:value:'QTCPEBC');
p@value = value;
when asntype = asn_null;
callp Translate(50:value:'QTCPEBC');
p@value = value;
when asntype = asn_object_id;
p@value = value;
when asntype = asn_ipaddress;
p@value = value;
when asntype = asn_counter;
dsvalue = value;
p@value = %char(dsvaluei);
when asntype = asn_gauge;
dsvalue = value;
p@value = %char(dsvaluei);
when asntype = asn_timeticks;
dsvalue = value;
p@value = %char(dsvaluei);
when asntype = asn_opaque;
callp Translate(50:value:'QTCPEBC');
p@value = value;
endsl;
return;
Thanks
John Slanina
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.