Am 30.03.2014 00:41, schrieb Shmuel Metz (Seymour J.):
In <[email protected]>, on 03/29/2014
at 11:03 AM, Bernd Oppolzer <[email protected]> said:
PL/1, BTW, does other strange things using descriptors,
FSVO strange. PL/I supports call by reference, and the
locator/descriptor is simply the mechanism used by current
implementations, not something that your PL/I code deals with
explicitly. From my perspective, it's C that is strange.
At our site we have hundreds of programmers who are working with
PL/1, some of them for more then 20 years, and I sometimes do programming
classes for them. And my experience is that over 90 percent of them have
no clue what the descriptor logic of PL/1 is all about, for example
adjustable lenghts of char strings within structures. If you pass a
structure,
then a structure descriptor is built, and the char strings inside this
structure
may have different lengths in the subprogram (or even CHAR (*)). Most people
think that the structures are simply overlaid when passed as arguments
(like "trivial" by reference mechanisms in other programming languages,
for example Pascal; and C, but in C you have to do by reference explicitly
by passing pointers) and have no idea of the structure descriptors
and their effects.
For example: a receiving structure containing a CHAR instead of a PIC
(of same length) is supposed to work by most of my students at first ...
before I tell them that the descriptors look totally different and they
will probably get 0C4 abends, when doing this.
This is different from every other programming language.
I call that strange, because most programmers, even some considering
themselves as experienced, don't master this concept.
At the same time, our management thinks, that PL/1 is easy to learn and
that there is no need to invest in training ...
BTW: is this kind of flexibility - adjustable lengths inside structures
- really useful?
It works only for CHAR strings, for DEC FIXED etc. the lengths have to
be the
same on both sides; there is no length information in the descriptor for
scalar
components of the structure. But if you need to change a structure
definition, which
is part of a programming interface, it is also common that you have to
change
the size of the DEC FIXED fields inside of some structures.
The newer PL/1 versions allow NODESCRIPTOR (and BYVALUE, BTW) ... this
is nice;
you can choose what kind of parameter passing mechanism you want, depending
on your needs. The PL/1 descriptor mechanism is a proprietary PL/1 solution
which - for example - rules out C callers, but also COBOL and FORTRAN
callers, IMO;
probably every caller that is not PL/1. Because at our site we want
every function
to be callable from every of the 3 supported languages (ASSEMBLER, PL/1,
C),
we work without descriptors since 1980 ... even before NODESCRIPTOR was
available. You can achieve this with some tricks even with old PL/1
compilers.
(This is because it was an ASSEMBLER only shop first, PL/1 was the
second language and appeared ca. 1980. C appeared ca. 1990. The architects
decided in 1980 that they didn't want descriptor interfaces).
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN