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



This might actually work better:

0001 D                 DS
0002 D IP                            12s 0 Inz
0003 D  ip1                           3s 0 overlay( ip : *next)
0004 D  ip2                           3s 0 overlay( ip : *next)
0005 D  ip3                           3s 0 overlay( ip : *next)
0006 D  ip4                           3s 0 overlay( ip : *next)

0007 D  editedIP       S             15A

0008 C                   eval       IP = yourIPAddress
0009 C                   eval       editedIP = %trim(%editc( ip1:'3')) +
'.' +
0010 C                                         %trim(%editc( ip2:'3')) +
'.' +
0011 C                                         %trim(%editc( ip3:'3')) +
'.' +
0012 C                                         %trim(%editc( ip4:'3'))

Note on lines 9 to 12 that I've switched the edit code to '3'. An IP
that is 0 in the say 3 position, should be set as 123.345.0.128
otherwise you end up with 123.345..128 and that isn't valid.

Bob Cozzi
cozzi@rpgiv.com
Visit the on-line  Midrange  Developer  forum at: http://www.rpgiv.com


> -----Original Message-----
> From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]
On
> Behalf Of Richard B Baird
> Sent: Thursday, March 07, 2002 10:15 AM
> To: rpg400-l@midrange.com
> Subject: Re: EDTWRD for IP adress
>
>
> Try this:
>
> D                 DS
> D $ipNum                        12s 0
> D  $ip1                          3s 0   overlay($ipNum:*next)
> D  $ip2                          3s 0   overlay($ipNum:*next)
> D  $ip3                          3s 0   overlay($ipNum:*next)
> D  $ip4                          3s 0   overlay($ipNum:*next)
>
> D $editedIP       S             15a
>
> C                   eval      $ipNum = yourIPAddress
> C                   eval      $editedIP = %trim(%editc($ip1:'Z')) +
'.' +
> C                                         %trim(%editc($ip2:'Z')) +
'.' +
> C                                         %trim(%editc($ip3:'Z')) +
'.' +
> C                                         %trim(%editc($ip4:'Z'))
>
>
> --- original message ---
> Hello all,
>
> I have a field that holds an IP address (numeric 12 digits). I want to
> display/print it as 999.999.999.999
>
> I tought I'd used the edit word EDTWRD('   .   .   .   ')
>
> But this does not work because the "." is considered the decimal
> separatior.
>
> Is there an easy way to format an IP address on a report?
>
> thanks
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.