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



Thank you all for your help.

rgds
Lakshmi



                                                                                
                 
                    Scott Klement                                               
                 
                    <klemscot@klements.        To:     RPG programming on the 
AS400 / iSeries    
                    com>                       <rpg400-l@xxxxxxxxxxxx>          
                 
                    Sent by:                   cc:                              
                 
                    rpg400-l-bounces@mi        Subject:     Re: 1-Byte Integer 
data type in RPG  
                    drange.com                                                  
                 
                                                                                
                 
                                                                                
                 
                    16/02/2004 04:18 PM                                         
                 
                    Please respond to                                           
                 
                    RPG programming on                                          
                 
                    the AS400 / iSeries                                         
                 
                                                                                
                 
                                                                                
                 





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.
>
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




Confidentiality Caution
=======================
Privileged/Confidential Information may be contained in this message. If
you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
message to anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Opinions, conclusions and other
information in this message that is not of an official nature shall be
deemed as neither given nor endorsed by SGX unless indicated by an
authorised representative independent of this message.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.