× 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 understand that a lot of the important pieces are written in Modula 2.

On Mon, Oct 7, 2019 at 3:25 PM Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
wrote:

Hi

I'm not sure the entire OS is written in C++, in fact, I'm pretty sure
it isn't. The thing called SLIC is written in C++ - other components are
not - some use a thing called PL-MI or the like.This would likely be
older components that no one dares to convert.

I was contracted at IBM in 2001 and was on the team testing the new
query engine - what we now call SQE. I even wrote a tiny bit of code to
report on statistics in the running of the new engine - have no idea if
it is still there, but it is callable only below the MI layer (except at
the lab). That was in C++.

As to movement of data, as I recall, character data is moved using a set
of registers - I think they were 8 bytes long - so better performance
came from moving blocks of data, not individual bytes.

All of this has probably changed as new chips were brought into use. I
guess I want mostly to say that C++ is not used for everything on the
system. Even using the term OS can be confusing - are we talking about
what is below the MI layer? Or about what we can use, which is the
technology-independent functionality?

Cheers
Vern

On 10/7/2019 12:15 AM, Javier Sánchez wrote:
The first time, almost 20 years ago, that I heard the OS/400 Operating
System is written in C++, lead me to the conclusion that the most
powerful
programming language has always been C. And as C++ is a superset of C,
want it or not, it's still the king.

Before I learned RPG and all its branches, I was already programming in
C,
and not surprisingly, I was also programming in CLIPPER. I wrote
programs
yielding .obj coming from CLIPPER, and other C modules which I bound very
well with MS LINK.EXE.

When I started programming with RPG in 1995, I said "hey, this is more or
less like CLIPPER". LOL if you want. And yes, do it really loud.
CLIPPER
was for me a programming language that did not respect my lexicography in
terms of uppercase and lowercase differentiation. When this was something
very strict when writing C code. So is RPG. You can write programs
pretending writing strict upper- and lower-case respect, and when errors
come around you will read your spool with your variables converted to
uppercase. I read lots of programs where the authors in one line wrote
one
variable name with all kinds of combinations of uppercase and lowercase
characters and in another line completely different, for which I did LOL,
and in one single program! And it would compile!

Well, this is not my subject here. Although this is something "I always
wanted to do that". What I would very much like to address is the fact
that, when declaring variables in RPG, is very important to look after
the
size we give to them.

C and C++ have their efficiency in that their compilers most of the time
take care of doing something you don't get aware of. And it is memory
alignment. Processor access to memory variables have some work to do
when
going for them. Processors love that variables be naturally aligned to
some address pattern of residency.

This is very simple. Processors love byte-multiple-wise orientation of
memory variables declarations. This means: don't think decimal-sized
variable delcarations, but think of hexadecimal -wise variable sized
declarations.

I have been writing a lot of programs with lots of system API calls, and
when I have to go to look for the declaration of the parameters, for
example most of them residing in the QSYSINC library, I learned that they
are really very C-like variable-alignment-wise.

And this is not an accident. The efficiency of the IBM i OS is that it's
written in C++. So, RPG programmers have to keep an eye on this. RPG
programs are actually converted into several calls to service programs
which are written in C or C++.

In general, when declaring variables in RPG nevertheless kind of, try to
always give it a size compatible with a binary equivalent to at least a
16-byte-multiple size.

For example, if you want to declare a variable as CHAR(10), consider
giving
it a size of either CHAR(8) or CHAR(16). Let me tell you, the RPG
compiler
won't let you know it, but it would very much like to do it, that you
did a
smart decision if you did so.

Give stand-alone variables sizes that are multiple of 4-, 8-, 16-, or
32-bit sizes. In terms of performance, you will get a reward.

CHAR variable types, give them sizes of 8, 16, 24, 32, 64 and son on,
sizes.

When declaring structures, give them sizes for wich, in between, you
would
have to pad some dummy variables in order to fit the size of compatible
memory alignment.

Javier Sanchez

--
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://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


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.