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



/*   Get local host name.        Scott Klement, April 14, 2005    +
The following code demonstrates                          +
 how to do this in ILE CL (V5R3 or later):      */
                                                                  +
     To compile:                                                  +
        CRTBNDCL PGM(HOSTNM) SRCFILE(xxx/QCLSRC)                 */

PGM
   DCL VAR(&HOSTNAME) TYPE(*CHAR) LEN(100)
   DCL VAR(&LEN)      TYPE(*INT)  LEN(4) VALUE(100)
   DCL VAR(&RC)       TYPE(*INT)  LEN(4)
   DCL VAR(&X)        TYPE(*INT)  LEN(4)
   DCL VAR(&X00)      TYPE(*CHAR) LEN(1) VALUE(x'00')


   /* Get Host Name */

   CALLPRC PRC('gethostname') PARM((&HOSTNAME *BYREF)  +
                                   (&LEN      *BYVAL)) +
                                   RTNVAL(&RC)
   IF (&RC *NE 0) DO
      SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) +
                 MSGDTA('Retrieval of host name failed!') +
                 MSGTYPE(*ESCAPE)
   ENDDO


   /* Strip out the x'00' character */

   DOFOR VAR(&X) FROM(1) TO(&LEN)
      IF (%SST(&HOSTNAME &X 1) *EQ X00) DO
         CHGVAR VAR(&X) VALUE(&X - 1)
         CHGVAR VAR(&HOSTNAME) VALUE(%SST(&HOSTNAME 1 &X))
         LEAVE
      ENDDO
   ENDDO


   /* Display the results as a *COMP message */

   SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) +
              MSGDTA('Host is' *BCAT &HostName) +
              MSGTYPE(*COMP)


ENDPGM



----------------------------
Bryan Dietz
Aktion Associates


> message: 7
> date: Mon, 25 Apr 2005 09:15:05 -0700 (PDT)
> from: Ashish Kulkarni <kulkarni_ash1312@xxxxxxxxx>
> subject: RE: find full AS400 system name
>
> Hi
> Do you have a code example of calling in API from ROG,
> or CL or java
>
>
> ashish


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.