Rob,

I downloaded code from Scott K a while back, I was having issues with NSLOOKUP.
Would DNSNAME work for you?

CRTCLMOD DNSNAME
CRTPGM DNSNAME BNDDIR(QC2LE)

Here's the code. Note that since this has a 256 long parameter, it should not be called from the command line

PGM PARM(&ADDR &DNSNAM)

DCL VAR(&ADDR) TYPE(*CHAR) LEN(30)
DCL VAR(&DNSNAM) TYPE(*CHAR) LEN(256)
DCL VAR(&ADDRZ) TYPE(*CHAR) LEN(31)
DCL VAR(&ZERO) TYPE(*CHAR) LEN(1) VALUE(x'00')
DCL VAR(&IPADDR) TYPE(*UINT) LEN(4)
DCL VAR(&IPADRLEN) TYPE(*INT) LEN(4) VALUE(4)
DCL VAR(&ADDRFAM) TYPE(*INT) LEN(4) VALUE(2)

DCL VAR(&NULL) TYPE(*PTR)
DCL VAR(&P_HOSTENT) TYPE(*PTR)
DCL VAR(&HOSTENT) TYPE(*CHAR) LEN(56) +
STG(*BASED) BASPTR(&P_HOSTENT)
DCL VAR(&P_HOST) TYPE(*PTR) +
STG(*DEFINED) DEFVAR(&HOSTENT 1)
DCL VAR(&LEN) TYPE(*UINT) LEN(4)
DCL VAR(&RESPTR) TYPE(*PTR)


/* Convert Human-Readable IP address into binary format */

CHGVAR VAR(&ADDRZ) VALUE(&ADDR *TCAT &ZERO)

CALLPRC PRC('inet_addr') PARM((&ADDRZ *BYREF)) +
RTNVAL(&IPADDR)
IF (&IPADDR *EQ 4294967295) DO
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGTYPE(*ESCAPE) +
MSGDTA('Invalid IP address. Must be in format x.x.x.x')
RETURN
ENDDO



/* Perform DNS or Host-Table Lookup of binary IP Address */

CALLPRC PRC('gethostbyaddr') PARM((&IPADDR *BYREF) +
(&IPADRLEN *BYVAL) +
(&ADDRFAM *BYVAL)) +
RTNVAL(&P_HOSTENT)
IF (&P_HOSTENT *EQ &NULL) DO
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGTYPE(*ESCAPE) +
MSGDTA('Host not found')
RETURN
ENDDO

/* The result will be that &P_HOST is a pointer to a C-style +
string. Use some C functions to convert this to a CL *CHAR */

CALLPRC PRC('strlen') PARM((&P_HOST *BYVAL)) +
RTNVAL(&LEN)
IF (&LEN *GT 0) DO
CALLPRC PRC('memcpy') PARM((&DNSNAM *BYREF) +
(&P_HOST *BYVAL) +
(&LEN *BYVAL)) +
RTNVAL(&RESPTR)
ENDDO

ENDPGM

Paul

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Rob Berendt
Sent: Thursday, December 22, 2016 3:26 PM
To: midrange-l@xxxxxxxxxxxx
Subject: How to do a dns lookup on a system without

If you load the following on your system you will get the NSLOOKUP
command:
Resource
ID Option Feature Description
5770SS1 31 5050 Domain Name System

I've removed that option from many lpars because IBM uses such an old version of bind that one fails audits. I wanted to ensure that it just could not be started, accidentally or otherwise.
I really feel that the nslookup command is a 'client' command and not a server command and should exist independently of that option. However I'm trying to get work done so instead of submitting another RFE I'd like to find an IBM i based alternative. (Noticed I dropped off the word
"native"?) QP2TERM and QSH both lack the 'ix commands HOST and DIG (unless you load option 31). Are they there but just not in the default path?


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.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.