ITPub博客

首页 > Linux操作系统 > Linux操作系统 > IP 地址函数:ZWY_IPADR2STRING

IP 地址函数:ZWY_IPADR2STRING

原创 Linux操作系统 作者:ytfsrs2008 时间:2009-04-03 03:03:38 0 删除 编辑
FUNCTION ZWY_IPADR2STRING.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(IPADR) LIKE  MSXXLIST-HOSTADR
*"  EXPORTING
*"     REFERENCE(STRING) TYPE  C
*"----------------------------------------------------------------------

*****************************************************************
*
*     SAP AG Walldorf
*     Systeme, Anwendungen und Produkte in der Datenverarbeitung
*
*     (C) Copyright SAP AG 1995
*
*****************************************************************
*
*  Project:          R/3 Gateway Monitor
*  Entwickl.-Stand:  BIN-Datenbank
*
*  Source-Typ:       Funktionsbaustein
*
*  Autor:            Werner Rehm , Basis
*
*****************************************************************
*  Entwicklungslog:
*
*  16.11.99 rehm Erste Implementierung
*
*****************************************************************
*
*  Beschreibung:
*
*   Umwandlung des RAW4-Feldes in einen String
*
*****************************************************************

  DATA: I TYPE I,
        X TYPE X,
        IP(20).

*---------------------------------------------------------------------
* Konvertiert Hex-Darstellung in IP-Adresse als String
*---------------------------------------------------------------------
  CLEAR IP.

  X = IPADR(1).
  I = X.
  WRITE I TO IP LEFT-JUSTIFIED.
  IP+4 = '.'.
  CONDENSE IP NO-GAPS.

  X = IPADR+1(1).
  I = X.
  WRITE I TO IP+5 LEFT-JUSTIFIED.
  IP+10 = '.'.
  CONDENSE IP NO-GAPS.

  X = IPADR+2(1).
  I = X.
  WRITE I TO IP+10 LEFT-JUSTIFIED.
  IP+16 = '.'.
  CONDENSE IP NO-GAPS.

  X = IPADR+3(1).
  I = X.
  WRITE I TO IP+15 LEFT-JUSTIFIED.
  CONDENSE IP NO-GAPS.

  STRING = IP.



ENDFUNCTION.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15117617/viewspace-584460/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-10-31

  • 博文量
    52
  • 访问量
    50114