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



You could overlay a character field over your array, and check the length
there.

Thanks,

Mark

Mark D. Walter
Senior Programmer/Analyst
CCX, Inc.
mwalter@xxxxxxxxxx
http://www.ccxinc.com


                                                                           
             Robert Upshall                                                
             <rupshall@psasoft                                             
             .com>                                                      To 
             Sent by:                  RPG programming on the AS400 /      
             rpg400-l-bounces@         iSeries <rpg400-l@xxxxxxxxxxxx>     
             midrange.com                                               cc 
                                                                           
                                                                   Subject 
             03/07/2005 09:16          Re: ASCII to EBCDIC translation     
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
              RPG programming                                              
              on the AS400 /                                               
                  iSeries                                                  
             <rpg400-l@midrang                                             
                  e.com>                                                   
                                                                           
                                                                           




The problem with this approach is that the byte array returned is of
varying length, and I need to know the varying length, with a char I can
determine the size in rpg with the %len with the integer array this is
not possible.

Is there any way to stop this conversion when using a varying chr field?



Joe Pluta wrote:
> We're going to have to get this into a FAQ, but for now there's a very
> simple rule: if you define your data as type "A" in your prototype, RPG
> will convert a Java byte array from ASCII to EBCDIC.  If you instead
> define it as "3i 0", no conversion will occur.
>
> This is the offender:
>
>
>>d getCDR          pr         65535a   extproc(*JAVA:CGF
>>d                                            :'getCDR')
>>d                                     varying
>
>
> In your case, I think you want to do the following:
>
> d getCDR          pr             3i 0 extproc(*JAVA:CGF
> d                                            :'getCDR')
> d                                     dim(32767)
>
> Note that the max for DIM is 32767, at least at V5R1.  Also, I haven't
> exactly tried this; I've only used it to pass a byte array back and
> forth as a parameter.
>
> Joe
>
>
>
>>From: Robert Upshall
>>
>>I have a java class that receives UPD packets in ASCII.  I have tested
>>the class on a PC and the data written to the file stays intact in
>
> ASCII
>
>>format.  I am now happy with my class so I protoype it in RPG and
>
> write
>
>>the same byte array to an iSeries PF.  The problem is that a
>
> conversion
>
>>of ASCII to EBCDIC occurs.  Where is this conversion taking place and
>>how do I stop it?
>>
>>Here is the java method signature:
>>
>>public byte[] getCDR(int len)
>>
>>Here is the RPG prototype:
>>
>>d getCDR          pr         65535a   extproc(*JAVA:CGF
>>d                                            :'getCDR')
>>d                                     varying
>>d len                           10i 0 value
>
>

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




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.