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



The example I gave using the B data type was a working example from S/38 RPG III. (late 80s/early 90s)

Paul

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Tuesday, August 25, 2020 6:42 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: How do I retrieve the RRN of a PF or LF in a RPG program.

________________________________
CAUTION: This email originated from outside of the PENCOR network. Do not click on any links or open attachments unless the sender is known, and the content is verified as safe.
________________________________

The basic notion behind the B data type was to allow the definition of binary variables in RPG (and COBOL works the same way incidentally) in the traditional way i.e. in terms of number of digits or characters,

Numbers in packed or zoned were capable of holding the full range of values i.e. a 5 digit number could hold -99,999 to +99,999 so when the B type was introduced it was decided to constrain its capacity to the maximum number of digits whose full range could be expressed within it. A 4 byte binary can represent values with 10 digits, but RPG and COBOL constrained it to 9 digits because that was the highest number where the full capacity of that many digits could be expressed.

In order to maintain this limit, when a numeric operation is performed on a type B field the value is copied to a packed field of equivalent precision, the operation is performed (with potential overflow) and the resulting packed value copied back to the B type variable. The result is that a B data type - which should theoretically be the most efficient was to represent (say) loop counters, offsets etc, was actually the least efficient.

The decision was made back in the (I think) RPG III days on S/38. Personally I think it was silly - but then I think Int(10) instead of Int(4) was a mistake too - but the decision was made for similar reasons - i.e. defining numerics in terms of digits not storage occupancy.

When we developed RPG IV the decision was taken to add the U and I data types to allow for real integers. The old B type had to stay for compatibility but is strongly discouraged. Except that sadly a great many IBM examples were never updated (and have not been to this day) to get rid of the stupid B data types,



On Aug 25, 2020, at 5:33 PM, James H. H. Lampert <jamesl@xxxxxxxxxxxxxxxxx> wrote:

On 8/25/20 2:24 PM, Bruce Vining wrote:
Oh please, don't use the B data type, you (unless something in RPG
has
changed) just made a mess of the RRN. Int is how IBM defines it and
is how the program should treat it.

Quite. As I recall, a "B" is only binary in a record within a file. Shocked my <E. asinius> across the room, the first time I got bit by that little "gotcha." What WERE they THINKING?

--
JHHL
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3
a%2f%2flists.midrange.com%2fmailman%2flistinfo%2frpg400%2dl&umid=ea0e1
f60-a931-4f93-b174-673950c49dd4&auth=438b0784514c1757bd202125ca4db8b0a
bdb021e-8ef0842eb591e8d8c25b9506f4acddcff8824406
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2farchive.midrange.com%2frpg400%2dl&umid=ea0e1f60-a931-4f93-b174-673950c49dd4&auth=438b0784514c1757bd202125ca4db8b0abdb021e-355e436174e131a6e1421a6e0943f412f83d0586.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3
a%2f%2famazon.midrange.com&umid=ea0e1f60-a931-4f93-b174-673950c49dd4&a
uth=438b0784514c1757bd202125ca4db8b0abdb021e-04bbf0f7d66cfb32f9f4aeda1
f8dfe09b4fe611f

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2flists.midrange.com%2fmailman%2flistinfo%2frpg400%2dl&umid=ea0e1f60-a931-4f93-b174-673950c49dd4&auth=438b0784514c1757bd202125ca4db8b0abdb021e-8ef0842eb591e8d8c25b9506f4acddcff8824406
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2farchive.midrange.com%2frpg400%2dl&umid=ea0e1f60-a931-4f93-b174-673950c49dd4&auth=438b0784514c1757bd202125ca4db8b0abdb021e-355e436174e131a6e1421a6e0943f412f83d0586.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://smex-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2famazon.midrange.com&umid=ea0e1f60-a931-4f93-b174-673950c49dd4&auth=438b0784514c1757bd202125ca4db8b0abdb021e-04bbf0f7d66cfb32f9f4aeda1f8dfe09b4fe611f

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.