Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote on 20/03/2006 12:55:51 PM:

> >     D JOBI0600        DS           322
> >     D   @@GRPPRF            137    146
> >
> >     D QUsrParmL       S              4B 0 inz(322)
> 
> 
> The problem here isn't that they added more data to the API, it's that 
you 
> defined a parameter as a BINARY(2) when the API expects BINARY(4).
> 
> In RPG, when you're defining a variable, you define the number of digits 

> that it needs to store.  For example, a packed variable that's defined 
as 
> "7P 0" occupies only 4 bytes of memory, but it stores numbers up to 7 
> digits long.  Similarly, a "4B 0" variable stores up to 4 digits, but 
only 
> occupies 2 bytes of memory.

Right - for some reason I was thinking that the B type was the BINARY the 
API docs were referring to.  Ouch.  Time to RTFM on data types again.

 
> The B data type is crippled. It converts everything to packed whenever 
you 
> use it, which makes it slower, and also means that it's limits are 
defined 
> in decimal digits instead of binary digits.  A true binary type is much 
> faster, and isn't confined by decimal digits.  In RPG, data type I and U 

> are true binary types.  Use them instead.

Thanks - I'll keep that in mind.

 
> What does it overwrite?  What does it corrupt?  Who knows. It's whatever 

> happens to be after your data structure in memory.  It could be memory 
> that's not currently being used. It could be other variables in your 
> program.  Or even in another program.  Or even memory in use by the 
> operating system.  And the API just overwrote it because you told it the 

> variable was longer than it really was.

Yikes!  You mean there's no such thing as a segfault in i5/OS?!

Thanks for the comprehensive response,
Adam
#####################################################################################
Attention:
The above message and/or attachment(s) is private and confidential and is 
intended 
only for the people for which it is addressed. If you are not named in the 
address 
fields, ignore the contents and delete all the material. Thank you.

For more information on email virus scanning, security and content
management, please contact administrator@xxxxxxxxxxxx
#####################################################################################

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.