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



I don’t want to be pedantic Jonathon - but for the sake of the archives … you’re still wrong.

Passing a char mapped over a B would not have made any difference and never would have done even “back in the day”. Between programs parks are passed by reference (i.e. a pointer is passed) so regardless of the data type the address of the first of the two bytes would have been passed which the API would have treated as the first of four bytes which would result in the exact same scenario that Barbara and I both described.

I’m not sure what you are thinking of - but I can’t think of any time where passing char fields mapped onto B data helps anything.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Oct 16, 2014, at 5:53 AM, Wilson, Jonathan <piercing_male@xxxxxxxxxxx> wrote:

On Wed, 2014-10-15 at 15:35 -0400, Barbara Morris wrote:
On 2014-10-15 11:09, Gary Thompson wrote:

Birgitta, I guess the conversion to 'packed' happens during the API call (the
compile listing shows B(4,0) )


The binary field wouldn't be converted to packed for the API call. The
address of the binary field would be passed to the API which would then
look at the storage of the binary field followed by the next 2 bytes of
storage. If the binary field had the value 4096 (x'1000') and the
following 2 bytes were x'0000', the API would see the 4-byte binary
value x'10000000' which is decimal 268435456.

Interesting how my "belief" that the field type was internally incorrect
(PD) was completely wrong... even if the logical aspect of the corrupted
data held true and its resolution was to, back in the day, pass a "char"
field mapped over a B field. I guess I failed to look into it deeply
enough, and instead made an assumption, that while incorrect resolved
the problem.


Binary fields are only converted to/from packed when they are used in
calculations. For example, if you have a 4B0 field NUM, and code
NUM = NUM + 1
the compiler defines a 4P0 temporary, call it temp4p.

temp4p = NUM
add 1 to temp4p
NUM = temp4p

If NUM was a 5I, the compiler would just add 1 to NUM directly.

--
Barbara



--
This is the RPG programming on the IBM i (AS/400 and 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.