RPGLE - Retrieve IP with RPGLE
H DFTACTGRP(*NO) BNDDIR('QC2LE')
D GetIpAdr PR 20a
D Device 10a CONST
*
D I_Net_Adr S 16a
*
D SDS
D Device 244 253
*---------------------------------------------------------
* Retrieve IP Address
C Eval I_Net_Adr = GetIpAdr(Device)
C Eval I_Net_Adr = %trim(I_Net_Adr)
C I_Net_Adr Dsply
C Eval *Inlr = *On
* RtvIpAdr - Subprocedure To Get IP Address
*---------------------------------------------------------
P GetIpAdr B Export
D GetIpAdr PI 20A
D Inp_Device 10A Const
D Apierr DS
D Bytprv 1 4B 0 Inz(216)
D Bytavl 5 8B 0 Inz
D Errorid 9 15A Inz
D Reserved 16 16A Inz
D ErrorDesc 17 216A Inz
D Net_Address S 20A INZ
D Format S 8A Inz('DEVD0600')
D Rcvar S 5000A Inz
D Varlen S 4B 0 Inz(5000)
C Eval Device = Inp_Device
C Call 'QDCRDEVD'
C Parm Rcvar
C Parm Varlen
C Parm Format
C Parm Device
C Parm Apierr
C If BytAvl = 0
C Eval Net_Address = %Subst(Rcvar:877:16)
C Endif
C Return Net_Address
P GetIpAdr E
H DFTACTGRP(*NO) BNDDIR('QC2LE')
D GetIpAdr PR 20a
D Device 10a CONST
*
D I_Net_Adr S 16a
*
D SDS
D Device 244 253
*---------------------------------------------------------
* Retrieve IP Address
C Eval I_Net_Adr = GetIpAdr(Device)
C Eval I_Net_Adr = %trim(I_Net_Adr)
C I_Net_Adr Dsply
C Eval *Inlr = *On
* RtvIpAdr - Subprocedure To Get IP Address
*---------------------------------------------------------
P GetIpAdr B Export
D GetIpAdr PI 20A
D Inp_Device 10A Const
D Apierr DS
D Bytprv 1 4B 0 Inz(216)
D Bytavl 5 8B 0 Inz
D Errorid 9 15A Inz
D Reserved 16 16A Inz
D ErrorDesc 17 216A Inz
D Net_Address S 20A INZ
D Format S 8A Inz('DEVD0600')
D Rcvar S 5000A Inz
D Varlen S 4B 0 Inz(5000)
C Eval Device = Inp_Device
C Call 'QDCRDEVD'
C Parm Rcvar
C Parm Varlen
C Parm Format
C Parm Device
C Parm Apierr
C If BytAvl = 0
C Eval Net_Address = %Subst(Rcvar:877:16)
C Endif
C Return Net_Address
P GetIpAdr E
No comments:
Post a Comment