|
On 5/18/2015 3:36 PM, Steinmetz, Paul wrote:
I've created a utility that inputs an IPv4 address and returns the DNS name.
It uses the DIG command with the out file option.
Does anything exist that does something similar?
I'm planning on using this as part of a larger project to create and populate a log file of all external communications, (FTP, SSL, SSH, etc)
0008.00 PGM PARM(&IPV4 &DNSNAM)
0009.00
0010.00 /* VARIABLE DECLARATIONS */
0011.00
0012.00 DCL VAR(&IPV4) TYPE(*CHAR) LEN(30)
0013.00 DCL VAR(&DNSNAM) TYPE(*CHAR) LEN(256 )
0014.00
0015.00 RMVLNK OBJLNK('/DIGOUT')
0016.00
0017.00 DIG HOSTNAME(&IPV4) REVERSE(*YES) +
0018.00 IPVSN(*IPV4ONLY) SHORT(*YES) +
0019.00 IDENTIFY(*YES) TOSTMF(DIGOUT)
0020.00
0021.00 CPYFRMIMPF FROMSTMF('/DIGOUT') TOFILE(QGPL/DIGOUT) +
0022.00 MBROPT(*REPLACE) RCDDLM(*LF) +
0023.00 RPLNULLVAL(*FLDDFT)
0024.00
0025.00 CALL PGM(DIGCONV) PARM(&DNSNAM) /* Search DIG +
0026.00 outfile, find and return DNS name */
0027.00
0028.00 DMPCLPGM
0029.00
0030.00 END: ENDPGM
0001.00 H DEBUG
0009.00 **************************************************************************
0010.00 Fdigout ipe f 3965 disk
0011.00 **************************************************************************
0012.00 dsearchfor s 12
0013.00 **************************************************************************
0014.00 * Input Parameters
0015.00 idigout AA 01
0016.00
0017.00 * Record type
0018.00
0019.00 i 1 3965 irec
0020.00 **************************************************************************
0021.00 C *entry plist
0022.00 C parm dnsfnd 256
0023.00
0024.00 c eval searchfor = 'from server '
0025.00 c exsr search
0026.00 **************************************************************************
0027.00 C search begsr
0028.00 **************************************************************************
0029.00 /free
0030.00 pos = %scan(searchfor: irec :1);
0031.00 if pos <> 0;
0032.00 dnsfnd = %Subst(irec:1 :pos-3);
0033.00 endif;
0034.00 /end-free
0035.00 c endsr
Thank You
_____
Paul Steinmetz
IBM i Systems Administrator
Pencor Services, Inc.
462 Delaware Ave
Palmerton Pa 18071
610-826-9117 work
610-826-9188 fax
610-349-0913 cell
610-377-6012 home
psteinmetz@xxxxxxxxxx
http://www.pencor.com/
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.