Re: QIBM_QTG_DEVINIT
Jon Paris <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <[email protected]> |
Here you go Vern
Felt like doing some coding! Just one of many ways of doing it.
Dcl-ds data;
all uns(10) inz(173409066);
part uns(3) dim(4) samepos(all);
End-Ds;
dcl-s IP varchar(15) inz;
dcl-s i int(3);
For i = 1 to %elem(part);
IP += %char(part(i));
If i < %elem(part);
IP += ':';
endif;
endfor;
Dsply IP;
Jon Paris
[email protected]
> On Aug 22, 2025, at 6:27 PM, Vern Hamberg via RPG400-L <[email protected]> wrote:
>
> Nice summary, Daniel, very helpful. I'd forgot the details!
>
> For the hexadecimally-challenged -
>
> So one could take each byte into base 10 and separate them with periods - as your example has it -
>
> 0x0A56032A
>
> 0A = 10
> 56 = 86
> 03 = 3
> 2A = 42
>
> Hence, 10.86.3.42
>
> I believe I can envision a nifty little RPG subprocedure that could handle this, maybe use an array of uns(3)'s? - but the C version is there, so why bother?
>
> *Regards*
>
> *Vern Hamberg*
>
> IBM Champion 2025 <cid:[email protected]> CAAC (COMMON Americas Advisory Council) IBM Influencer 2023
>
>
> On 8/22/2025 2:44 PM, Daniel Gross wrote:
>> Hi Jay,
>>
>> this is the IP address in "native" or "binary" - not in the usual "readable" 4-decimal-bytes-separated-by-dots form.
>>
>> Lets think of an IP address like:
>>
>> 192.168.123.1
>>
>> That would be 0xC0A87B01 in hex format.
>>
>> And that would be 3232267009 in decimal.
>>
>> That's how IP addresses are internally stored. The dotted notation is only for us humans.
>>
>> Subneting, routing, firewalls - all use these internal forms.
>>
>> Your address 173409066 would read as 0x0A56032A in hex or 10.86.3.42 in readable (dotted) form.
>>
>> HTH
>> Daniel
>>
>>
>>
>>> Am 22.08.2025 um 21:00 schrieb Jay Vaughn<[email protected]>:
>>>
>>> Charles...
>>>
>>> It made a difference for sure but I question if that is really the IP
>>> address...
>>>
>>> Here is my DS (with new embedded DS for ip address you pointed out)
>>>
>>> dcl-ds ds_connect qualified;
>>>
>>> lenConnDsc int(10);
>>>
>>> dcl-ds ds_ip4AddressClient;
>>>
>>> sin_len int(3);
>>>
>>> sin_family int(3);
>>>
>>> sin_port uns(5);
>>>
>>> sin_addr uns(10);
>>>
>>> filler char(12);
>>>
>>> end-ds;
>>>
>>> clientPWValidated char(1);
>>>
>>> workstationType char(14);
>>>
>>> sslConnection char(1);
>>>
>>> …
>>>
>>>
>>>
>>>> EVAL ds_connect
>>> DS_CONNECT.LENCONNDSC = 132
>>>
>>> DS_CONNECT.DS_IP4ADDRESSCLIENT.SIN_LEN = 16
>>>
>>> DS_CONNECT.DS_IP4ADDRESSCLIENT.SIN_FAMILY = 2
>>>
>>> DS_CONNECT.DS_IP4ADDRESSCLIENT.SIN_PORT = 56406
>>>
>>> DS_CONNECT.DS_IP4ADDRESSCLIENT.SIN_ADDR = 173409066
>>>
>>> DS_CONNECT.DS_IP4ADDRESSCLIENT.FILLER = ' '
>>>
>>> DS_CONNECT.CLIENTPWVALIDATED = '0'
>>>
>>> DS_CONNECT.WORKSTATIONTYPE = 'IBM-3477-FC '
>>>
>>> DS_CONNECT.SSLCONNECTION = '1'
>>>
>>> DS_CONNECT.IP4ADDRESSSERVER = '███\█À██ '
>>>
>>> DS_CONNECT.CLIENTAUTHLEVEL = '0'
>>>
>>> DS_CONNECT.RESERVED01 = ' '
>>>
>>> DS_CONNECT.CLIENTCERTVALID = 0
>>>
>>> DS_CONNECT.OFFSETCLIENTCERT = 1362
>>>
>>> DS_CONNECT.CLIENTCERTLEN = 0
>>>
>>> DS_CONNECT.DS_IP6ADDRESSCLIENT.SIN_LEN = 28
>>>
>>> DS_CONNECT.DS_IP6ADDRESSCLIENT.SIN_FAMILY = 24
>>>
>>>
>>> What else?
>>>
>>>
>>> thanks
>>>
>>> Jay
>>>
>>>> On Fri, Aug 22, 2025 at 2:23 PM Jay Vaughn<[email protected]>
>>>> wrote:
>>>>
>>>> That’s totally helpful Charles.
>>>> Yes I’m overlooking the fact that up address is actually another DS!
>>>>
>>>> Let me address that.
>>>>
>>>> Thank you!
>>>>
>>>>> On Aug 22, 2025, at 1:28 PM, Charles Wilt<[email protected]> wrote:
>>>>>
>>>>> Well, I'd say you're doing something wrong... :p
>>>>>
>>>>> Show the DS definition and how it's being loaded...
>>>>>
>>>>> A quick glance at the docs,
>>>>>
>>>> https://www.ibm.com/docs/en/i/7.4.0?topic=program-init0100-format-connection-description-information
>>>>> and I see that the IP address field is actually another DS...
>>>>> Name
>>>>> Size
>>>>> Description
>>>>> sin_len CHAR(1) Size of the sockaddr_in structure
>>>>> sin_family CHAR(1) Protocol family IP (Version 4) is hex 02
>>>>> sin_port CHAR(2) 16-bit unsigned port number
>>>>> sin_addr CHAR(16) 4-byte unsigned
>>>>> An RPG DS would be
>>>>> dcl-ds ipAddr;
>>>>> len int(3);
>>>>> family int(3);
>>>>> port uint(5);
>>>>> addr uint(10);
>>>>> *n char(12)
>>>>> end-ds;
>>>>>
>>>>> Little confused about the sin_addr being defined as char(16) yet the
>>>>> description is "4-byte unsigned"..
>>>>>
>>>>> I'm assuming that there's 12 bytes of filler...which looks to be the case
>>>>> from what you posted...
>>>>>
>>>>> HTH,
>>>>> Charles
>>>>>
>>>>>
>>>>>> On Fri, Aug 22, 2025 at 10:57 AM Jay Vaughn<[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>> has anyone worked with this exit point before.
>>>>>>
>>>>>> My exit pgm is coded and my parms are coming in correctly aligned
>>>> however
>>>>>> some of the data is non legible and look like the following...
>>>>>> 12:54 PM (0 minutes ago)
>>>>>> to me
>>>>>>
>>>>>>> EVAL ds_connect
>>>>>> DS_CONNECT.LENCONNDSC = 132
>>>>>>
>>>>>> DS_CONNECT.IP4ADDRESSCLIENT = '██ÉC█Õ█P '
>>>>>>
>>>>>> DS_CONNECT.CLIENTPWVALIDATED = '0'
>>>>>>
>>>>>> DS_CONNECT.WORKSTATIONTYPE = 'IBM-3477-FC '
>>>>>>
>>>>>> DS_CONNECT.SSLCONNECTION = '1'
>>>>>>
>>>>>> DS_CONNECT.IP4ADDRESSSERVER = '███\█À██ '
>>>>>>
>>>>>> DS_CONNECT.CLIENTAUTHLEVEL = '0'
>>>>>>
>>>>>> DS_CONNECT.RESERVED01 = ' '
>>>>>>
>>>>>> DS_CONNECT.CLIENTCERTVALID = 0
>>>>>>
>>>>>> DS_CONNECT.OFFSETCLIENTCERT = 1362
>>>>>>
>>>>>> DS_CONNECT.CLIENTCERTLEN = 0
>>>>>>
>>>>>> DS_CONNECT.IP6ADDRESSCLIENT = '██ÉC ███Õ█P '
>>>>>>
>>>>>> DS_CONNECT.IP6ADDRESSSERVER = '███\ ███À██ '
>>>>>>
>>>>>>
>>>>>> I have tried ccsid(*utf8) for the first ip4 address variable but no
>>>> luck.
>>>>>>
>>>>>> Any idea why these are not coming through legible?
>>>>>>
>>>>>>
>>>>>> tia
>>>>>>
>>>>>>
>>>>>> Jay
>>>>>> --
>>>>>> This is the RPG programming on IBM i (RPG400-L) mailing list
>>>>>> To post a message email:[email protected]
>>>>>> To subscribe, unsubscribe, or change list options,
>>>>>> visit:https://lists.midrange.com/mailman/listinfo/rpg400-l
>>>>>> or email:[email protected]
>>>>>> Before posting, please take a moment to review the archives
>>>>>> athttps://archive.midrange.com/rpg400-l.
>>>>>>
>>>>>> Please [email protected] for any subscription
>>>> related
>>>>>> questions.
>>>>>>
>>>>>>
>>>>> --
>>>>> This is the RPG programming on IBM i (RPG400-L) mailing list
>>>>> To post a message email:[email protected]
>>>>> To subscribe, unsubscribe, or change list options,
>>>>> visit:https://lists.midrange.com/mailman/listinfo/rpg400-l
>>>>> or email:[email protected]
>>>>> Before posting, please take a moment to review the archives
>>>>> athttps://archive.midrange.com/rpg400-l.
>>>>>
>>>>> Please [email protected] for any subscription
>>>> related questions.
>>> --
>>> This is the RPG programming on IBM i (RPG400-L) mailing list
>>> To post a message email:[email protected]
>>> To subscribe, unsubscribe, or change list options,
>>> visit:https://lists.midrange.com/mailman/listinfo/rpg400-l
>>> or email:[email protected]
>>> Before posting, please take a moment to review the archives
>>> athttps://archive.midrange.com/rpg400-l.
>>>
>>> Please [email protected] for any subscription related questions.
>>>
> --
> This is the RPG programming on IBM i (RPG400-L) mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/rpg400-l.
>
> Please contact [email protected] for any subscription related questions.
>
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact [email protected] for any subscription related questions.