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



Hello Lakshmi,

You cannot declare a 1-byte integer in V4R2, that capability did not exist
until V4R4.

However, you can declare a 1-byte alphanumeric variable and send that.
Unless you need to use it with math operations, an alphanumeric field
should be just fine.

For example, to send the decimal number 123 (which is hex 7B) you can do:


     D char            s              1A

     c                   eval      char = x'7B'
     c                   callp     send(sock: %addr(char): 1: 0)


If you truly need an integer that you can use in math operations, you can
simply send the 2nd byte of a 2-byte integer.   For example:

     D                 ds
     D int                     1      2U 0 inz(0)
     D byte                    2      2A

     c                   eval      int = 123
     c                   callp     send(sock: %addr(byte): 1: 0)


It's important to note, however, that you cannot use this technique with
negative numbers, if you need support for negative numbers, you'll need
some additional, complex, code to set the bits in the 1A byte manually.


On Mon, 16 Feb 2004 srilaxmi@xxxxxxx wrote:
>
> How can I declare a 1-Byte Integer data type in RPGIV? My version is V4R2.
>
> I am trying to declare as
> DIntByte       S  3I 0
>
> The SEU is giving this error "The length of an integer or unsigned field is
> not valid. "
> I think my system is not supporting this data type. So, is there any other
> way to use 1-byte integer data type.
>
> I have just got an idea. Can I declare as 2-bytes and deactivate
> 1-byte(LSB) and use only 1-byte? Is this possible?
> My requirement is, I need to pass 1-byte of data to one of the PC API over
> a socket.
>
> If anyone worked on this, please reply me. Your answers will be
> appreciated.
>

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.