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



Hi

i found the following program in comp.sys.ibm.as400 :

but i have some problem:

i run the following command

CALL PGM($$APCNAM)

PARM('MYWRKSTNID' ' ' ' ')


with debug i see the IpAddress with the right value the IP32Addr with

the following value 184353849 (that i don't kwon what can be) but the

value of HOSTENTP = SPP:*NULL after the Call Procedure

"gethostbyaddr"

can some one help me ?

Thanks


this is the program


process nomonoprc
IDENTIFICATION DIVISION.
PROGRAM-ID. RTVIPNAME.
AUTHOR. AD.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 QdcrdevdParm.
05 QdcrdevdReceiver.
10 Filler Pic X(858).
10 QdcrdevdProtocol Pic X(001).
88 IpProtocol Value X"02".
10 Filler Pic X(018).
10 QdcrdevdIpAddress Pic X(015).
05 QdcrdevdRecLength PIC S9(09) Comp-4 value 892.
05 QdcrdevdFormat PIC x(08) Value "DEVD0600".
05 QdcrdevdDeviceName PIC x(10).
01 ErrorCode.
05 ErrorBytesProvided PIC 9(09) COMP-4 VALUE 16.
05 ErrorBytesAvailable PIC 9(09) COMP-4.
05 ErrorExceptionId PIC X(07).
05 Filler PIC X(01).
01 HostentP pointer.
01 AddressType PIC S9(09) Comp-4.
88 AFINET Value 2.
01 IP32Addr Pic S9(09) Comp-4.
Linkage Section.
01 DeviceName PIC X(10).
01 IpAddress PIC X(15).
01 IpName PIC X(64).
01 Hostent.
05 namepointer pointer.
01 GetIpName PIC X(64).
01 errno pic s9(9) binary.
*****************************************************************
PROCEDURE DIVISION using DeviceName
IpAddress
IpName.
*****************************************************************
MainProgramRoutine.
Move space to IpName.
Move space to IpAddress
Move space to QdcrdevdReceiver.
Move DeviceName to QdcrdevdDeviceName.
Call "QDCRDEVD" Using QdcrdevdReceiver
QdcrdevdRecLength
QdcrdevdFormat
QdcrdevdDeviceName
ErrorCode.
If ErrorExceptionId not = Space
GoBack.
If not IpProtocol
GoBack.
Move QdcrdevdIpAddress to IpAddress.
Call Procedure "inet_addr" Using QdcrdevdIpAddress
Returning IP32Addr.
If IP32Addr = -1
GoBack.
Set AFINET to true.
Call Procedure "gethostbyaddr"
Using by Reference IP32Addr
by Value length of IP32Addr
by value AddressType
Returning HostentP.
call procedure "__h_errno" returning address of errno.
if HostentP = NULL
continue
else
set address of hostent to HostentP
if NamePointer = NULL
continue
else
set address of Getipname to NamePointer
Inspect GetIpName replacing all X"00" by X"40"
move GetIpName to IpName.
GoBack.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.