工作生活与爱好

工作中的记录; 生活中的记忆; 业余爱好的记载。

2007-05-15

 

取IP地址的方法

取IP地址的方法
*&---------------------------------------------------------------------*
*& Report Z_IP *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT Z_IP .
DATA HOSTADR LIKE UINFO-HOSTADR.
DATA HOSTADDR(8).
DATA TERM LIKE UINFO-TERM.
DATA XHCOUNT TYPE I.
DATA: IPTXT(15),ITIMES TYPE I,ITIMES1 TYPE I,HX(2).
DATA: RESULT TYPE I,RESULTTXT(3).
CALL FUNCTION 'TH_USER_INFO'
IMPORTING HOSTADDR = HOSTADR "like UINFO-HOSTADR (hex)
TERMINAL = TERM. "like UINFO-TERM
HOSTADDR = HOSTADR.
DO 4 TIMES.
HX = HOSTADDR+ITIMES1(2).
ITIMES = 0.
RESULT = 0.
DO 2 TIMES.
CASE HX+ITIMES(1).
WHEN 'A'.
IF ITIMES = 0.
RESULT = RESULT + 10 * 16.
ELSE.
RESULT = RESULT + 10.
ENDIF.
WHEN 'B'.
IF ITIMES = 0.
RESULT = RESULT + 11 * 16.
ELSE.
RESULT = RESULT + 11.
ENDIF.
WHEN 'C'.
IF ITIMES = 0.
RESULT = RESULT + 12 * 16.
ELSE.
RESULT = RESULT + 12.
ENDIF.
WHEN 'D'.
IF ITIMES = 0.
RESULT = RESULT + 13 * 16.
ELSE.
RESULT = RESULT + 13.
ENDIF.
WHEN 'E'.
IF ITIMES = 0.
RESULT = RESULT + 14 * 16.
ELSE.
RESULT = RESULT + 14.
ENDIF.
WHEN 'F'.
IF ITIMES = 0.
RESULT = RESULT + 15 * 16.
ELSE.
RESULT = RESULT + 15.
ENDIF.
WHEN OTHERS.
IF ITIMES = 0.
RESULT = RESULT + HX+ITIMES(1) * 16.
ELSE.
RESULT = RESULT + HX+ITIMES(1).
ENDIF.
ENDCASE.
ITIMES = ITIMES + 1.
ENDDO.
RESULTTXT = RESULT.
IF IPTXT <> ''.
CONCATENATE IPTXT '.' RESULTTXT INTO IPTXT.
ELSE.
IPTXT = RESULTTXT.
ENDIF.
ITIMES1 = ITIMES1 + 2.
ENDDO.
WRITE IPTXT.

Comments: 发表评论



<< Home

Archives

1990-1-15   2007-1-14   2007-1-15   2007-1-16   2007-1-17   2007-1-18   2007-1-19   2007-1-20   2007-1-22   2007-1-23   2007-1-24   2007-1-25   2007-1-26   2007-1-27   2007-1-29   2007-1-30   2007-1-31   2007-2-1   2007-2-2   2007-2-3   2007-3-13   2007-5-15   2007-5-16   2007-6-2  

This page is powered by Blogger. Isn't yours?