VMS %descr and PL/I - VMS

This is a discussion on VMS %descr and PL/I - VMS ; It occurred to me while writing about pass by descriptor for Fortran assumed shape arrays that there is a difference between PL/I and Fortran. Since VMS standardizes the %descr calling convention it would seem to support one or the other. ...

+ Reply to Thread
Results 1 to 16 of 16

Thread: VMS %descr and PL/I

  1. VMS %descr and PL/I


    It occurred to me while writing about pass by descriptor for
    Fortran assumed shape arrays that there is a difference between
    PL/I and Fortran. Since VMS standardizes the %descr calling
    convention it would seem to support one or the other.

    PL/I passes the lower bounds for arrays, where Fortran does not.
    A called routine in Fortran addresses the array with lower bounds
    of 1, or other lower bound specified in the called routine.

    It would seem that VMS would follow one or the other, but I
    didn't find anything searching descr or %descr in the VMS
    documentation web page.

    -- glen


  2. Re: VMS %descr and PL/I

    On Sep 4, 6:21 pm, glen herrmannsfeldt wrote:
    > It occurred to me while writing about pass by descriptor for
    > Fortran assumed shape arrays that there is a difference between
    > PL/I and Fortran. Since VMS standardizes the %descr calling
    > convention it would seem to support one or the other.
    >
    > PL/I passes the lower bounds for arrays, where Fortran does not.
    > A called routine in Fortran addresses the array with lower bounds
    > of 1, or other lower bound specified in the called routine.
    >
    > It would seem that VMS would follow one or the other, but I
    > didn't find anything searching descr or %descr in the VMS
    > documentation web page.
    >
    > -- glen


    Glen,

    The documentation that you want is contained in the VAX Architecture
    reference manual (I admit that I do not have an online citation, I
    still look this kind of thing up in my numerous hardcopy sets of the
    books).

    You also want to check the Programmer's Guide for the language, which
    may contain useful related information (depending on the language,
    these may be available on the OpenVMS www site).

    - Bob Gezelter, http://www.rlgsc.com


  3. Re: VMS %descr and PL/I

    Bob Gezelter wrote:

    (snip about VMS, call by descriptor (%descr), for Fortran and PL/I)

    >>It would seem that VMS would follow one or the other, but I
    >>didn't find anything searching descr or %descr in the VMS
    >>documentation web page.


    > The documentation that you want is contained in the VAX Architecture
    > reference manual (I admit that I do not have an online citation, I
    > still look this kind of thing up in my numerous hardcopy sets of the
    > books).


    Does that mean it is VAX specific, and not VMS specific?

    -- glen


  4. Re: VMS %descr and PL/I

    On Tue, 04 Sep 2007 15:21:02 -0700, glen herrmannsfeldt
    wrote:

    >
    > It occurred to me while writing about pass by descriptor for
    > Fortran assumed shape arrays that there is a difference between
    > PL/I and Fortran. Since VMS standardizes the %descr calling
    > convention it would seem to support one or the other.
    >
    > PL/I passes the lower bounds for arrays, where Fortran does not.
    > A called routine in Fortran addresses the array with lower bounds
    > of 1, or other lower bound specified in the called routine.
    >
    > It would seem that VMS would follow one or the other, but I
    > didn't find anything searching descr or %descr in the VMS
    > documentation web page.
    >
    > -- glen
    >

    I would _guess_ that it is the same descriptor, but the Fortran compiler
    inserts 1 in the lower bound, at least that is how I did it with Fortran.
    Isn't the descriptor defined in SDL?


    --
    PL/I for OpenVMS
    www.kednos.com

  5. Re: VMS %descr and PL/I

    On Sep 4, 6:36 pm, "Tom Linden" wrote:
    > On Tue, 04 Sep 2007 15:21:02 -0700, glen herrmannsfeldt
    >
    >
    >
    >
    >
    > wrote:
    >
    > > It occurred to me while writing about pass by descriptor for
    > > Fortran assumed shape arrays that there is a difference between
    > > PL/I and Fortran. Since VMS standardizes the %descr calling
    > > convention it would seem to support one or the other.

    >
    > > PL/I passes the lower bounds for arrays, where Fortran does not.
    > > A called routine in Fortran addresses the array with lower bounds
    > > of 1, or other lower bound specified in the called routine.

    >
    > > It would seem that VMS would follow one or the other, but I
    > > didn't find anything searching descr or %descr in the VMS
    > > documentation web page.

    >
    > > -- glen

    >
    > I would _guess_ that it is the same descriptor, but the Fortran compiler
    > inserts 1 in the lower bound, at least that is how I did it with Fortran.
    > Isn't the descriptor defined in SDL?
    >
    > --
    > PL/I for OpenVMSwww.kednos.com- Hide quoted text -
    >
    > - Show quoted text -


    HP OpenVMS Calling Standard
    http://h71000.www7.hp.com/doc/82fina..._contents.html
    Chapter 7 OpenVMS Argument Descriptors
    7.4 Array Descriptor (CLASS_A)
    http://h71000.www7.hp.com/doc/82fina...array_desc_sec

    Hein


  6. Re: VMS %descr and PL/I

    glen herrmannsfeldt wrote:
    >
    > It occurred to me while writing about pass by descriptor for
    > Fortran assumed shape arrays that there is a difference between
    > PL/I and Fortran. Since VMS standardizes the %descr calling
    > convention it would seem to support one or the other.
    >
    > PL/I passes the lower bounds for arrays, where Fortran does not.
    > A called routine in Fortran addresses the array with lower bounds
    > of 1, or other lower bound specified in the called routine.
    >
    > It would seem that VMS would follow one or the other, but I
    > didn't find anything searching descr or %descr in the VMS
    > documentation web page.


    As you well know, being an active participant in comp.lang.fortran,
    assumed shape arrays are a very recent addition to Fortran (F90)
    compared to the history of both Fortran and VMS. Prior to F90,
    there were neither assumed shape arrays nor any intrinsics to
    retrieve (declared) array bounds. And as is discussed periodically
    in c.l.f, 1 is the only reasonable lower bound for array slices
    and the like. (I won't bore c.o.v or c.l.pl1 readers with
    Fortran features which allow the called procedure to use an
    arbitrary lower bound, etc.)

    OTOH, it seems quite plausible (in my ignorance) that other
    language standards might specify that called procedures have
    access to and/or use the bounds as declared in the caller. I
    don't know. Sounds like PL/I perhaps does.

    But VMS arrays descriptors are flexible enough to handle either
    requirement. I didn't read Hein's references as to what the
    calling standard has to say on the subject, but it seems
    reasonable not to force either convention on a given language
    and its compiler.

    -Ken
    --
    Ken & Ann Fairfield
    What: Ken dot And dot Ann
    Where: Gmail dot Com

  7. Re: VMS %descr and PL/I

    Tom Linden wrote:

    > On Tue, 04 Sep 2007 15:21:02 -0700, glen herrmannsfeldt
    > wrote:


    >> It occurred to me while writing about pass by descriptor for
    >> Fortran assumed shape arrays that there is a difference between
    >> PL/I and Fortran. Since VMS standardizes the %descr calling
    >> convention it would seem to support one or the other.

    (snip)

    > I would _guess_ that it is the same descriptor, but the Fortran compiler
    > inserts 1 in the lower bound, at least that is how I did it with Fortran.
    > Isn't the descriptor defined in SDL?


    That should work for Fortran calling other languages with %descr, but
    how about PL/I calling Fortran? I will look at the references
    provided in another post.

    -- glen


  8. Re: VMS %descr and PL/I

    Tom Linden wrote:

    (snip)

    > I would _guess_ that it is the same descriptor, but the Fortran compiler
    > inserts 1 in the lower bound, at least that is how I did it with Fortran.
    > Isn't the descriptor defined in SDL?


    Now it gets interesting. The formula given to find the
    address of an array element is (are):

    E = A0 + S1*I1 + . . . + Sn*In
    = POINTER + S1*[I1 - L1] + . . . + Sn*[In - Ln]

    Note that there are two ways to do it. The first uses A0, the virtual
    origin (address of the array element with all subscripts zero, which may
    or may not actually be inside the array). The second uses POINTER which
    is the address of the actual first element of the array.

    IBM PL/I compilers use only the first method, and so would be dependent
    on the lower bounds being the same. Using the second method, the called
    routine can use different lower bounds from the caller, and still find
    the right array elements, though with added work.

    The rule seems to be that a caller should fill in all fields, even
    those that it doesn't actually need. It would seem that Fortran should
    use the second method, and PL/I the first.

    -- glen


  9. Re: VMS %descr and PL/I

    "Tom Linden" wrote in message newsp.tx5ieelzhv4qyg@murphus...

    > I would _guess_ that it is the same descriptor, but the Fortran compiler
    > inserts 1 in the lower bound, at least that is how I did it with Fortran.


    The upper bound would also have to be set to extent-1, or
    extent - LB + 1 if LB were supplied by the caller and specified
    as the lower bound.



  10. Re: VMS %descr and PL/I

    "glen herrmannsfeldt" wrote in message
    news:5IednYgOFuL9VkDbnZ2dnUVZ_t6onZ2d@comcast.com. ..
    >
    > It occurred to me while writing about pass by descriptor for
    > Fortran assumed shape arrays that there is a difference between
    > PL/I and Fortran. Since VMS standardizes the %descr calling
    > convention it would seem to support one or the other.
    >
    > PL/I passes the lower bounds for arrays, where Fortran does not.


    PL/I passes both upper and lower bounds, whereas Fortran
    passes only the extent.

    In PL/I the upper and lower bounds are accessible in the called routine
    via the functions HBOUND and LBOUND resp.

    > A called routine in Fortran addresses the array with lower bounds
    > of 1, or other lower bound specified in the called routine.


    Defaulting the lower bound to 1 was a design flaw.
    That's a return to the old days, when it was necessary in FORTRAN
    to pass even the upper bound!



  11. Re: VMS %descr and PL/I

    HP Fortran for OpenVMS User Manual, Chapter 10.2 "HP Fortran
    Procedures and Argument Passing":
    http://h71000.www7.hp.com/doc/82fina...fort_call_conv


  12. Re: VMS %descr and PL/I

    On Tue, 04 Sep 2007 23:12:42 -0700, glen herrmannsfeldt
    wrote:

    > Tom Linden wrote:
    >
    > (snip)
    >
    >> I would _guess_ that it is the same descriptor, but the Fortran compiler
    >> inserts 1 in the lower bound, at least that is how I did it with
    >> Fortran.
    >> Isn't the descriptor defined in SDL?

    >
    > Now it gets interesting. The formula given to find the
    > address of an array element is (are):
    >
    > E = A0 + S1*I1 + . . . + Sn*In
    > = POINTER + S1*[I1 - L1] + . . . + Sn*[In - Ln]
    >
    > Note that there are two ways to do it. The first uses A0, the virtual
    > origin (address of the array element with all subscripts zero, which may
    > or may not actually be inside the array). The second uses POINTER which
    > is the address of the actual first element of the array.
    >
    > IBM PL/I compilers use only the first method, and so would be dependent
    > on the lower bounds being the same. Using the second method, the called
    > routine can use different lower bounds from the caller, and still find
    > the right array elements, though with added work.
    >
    > The rule seems to be that a caller should fill in all fields, even
    > those that it doesn't actually need. It would seem that Fortran should
    > use the second method, and PL/I the first.


    Following doesn't specifically answer your question, but gives some hints
    http://www.kednos.com/pli/docs/USERS...toc_chapter_11
    The DESCRIPTOR builtin function
    http://www.kednos.com/pli/docs/REFER...l#index_x_1625
    is used to pass arguments to non-PL/I routines and is common to VMS, so I
    think the
    lower bound must be included, it certainly is for our internal Dope
    vectors.

    To sort out which method is used I think you need to write a small test
    and look at
    the map.
    >
    > -- glen
    >




    --
    PL/I for OpenVMS
    www.kednos.com

  13. Re: VMS %descr and PL/I

    "Ken Fairfield" wrote in message
    news:5k6o68F2d0oqU1@mid.individual.net...

    > As you well know, being an active participant in comp.lang.fortran,
    > assumed shape arrays are a very recent addition to Fortran (F90)
    > compared to the history of both Fortran and VMS. Prior to F90,
    > there were neither assumed shape arrays nor any intrinsics to
    > retrieve (declared) array bounds. And as is discussed periodically
    > in c.l.f, 1 is the only reasonable lower bound for array slices
    > and the like.


    In PL/I array slices have the dimensions of the parent array.
    There's no problem with that.
    That facility has been available for 40 years.



  14. Re: VMS %descr and PL/I

    "glen herrmannsfeldt" wrote in message
    news:Ke2dnZbuAYJxpEPbnZ2dnUVZ_ualnZ2d@comcast.com. ..
    > Tom Linden wrote:
    >
    > (snip)
    >
    > > I would _guess_ that it is the same descriptor, but the Fortran compiler
    > > inserts 1 in the lower bound, at least that is how I did it with Fortran.
    > > Isn't the descriptor defined in SDL?

    >
    > Now it gets interesting. The formula given to find the
    > address of an array element is (are):
    >
    > E = A0 + S1*I1 + . . . + Sn*In
    > = POINTER + S1*[I1 - L1] + . . . + Sn*[In - Ln]
    >
    > Note that there are two ways to do it. The first uses A0, the virtual
    > origin (address of the array element with all subscripts zero, which may
    > or may not actually be inside the array). The second uses POINTER which
    > is the address of the actual first element of the array.
    >
    > IBM PL/I compilers use only the first method, and so would be dependent
    > on the lower bounds being the same.


    If you are discussing the facility in general, references to
    one particular manufacturer are inappropriate.

    The lower bounds can be anything you want, by
    defining an array having the required lower bounds.



  15. Re: VMS %descr and PL/I

    Tom Linden wrote:

    > On Tue, 04 Sep 2007 23:12:42 -0700, glen herrmannsfeldt
    > wrote:
    >
    >> Tom Linden wrote:
    >>
    >> (snip)
    >>
    >>> I would _guess_ that it is the same descriptor, but the Fortran compiler
    >>> inserts 1 in the lower bound, at least that is how I did it with
    >>> Fortran.
    >>> Isn't the descriptor defined in SDL?

    >>
    >>
    >> Now it gets interesting. The formula given to find the
    >> address of an array element is (are):
    >>
    >> E = A0 + S1*I1 + . . . + Sn*In
    >> = POINTER + S1*[I1 - L1] + . . . + Sn*[In - Ln]
    >>
    >> Note that there are two ways to do it. The first uses A0, the virtual
    >> origin (address of the array element with all subscripts zero, which may
    >> or may not actually be inside the array). The second uses POINTER
    >> which is the address of the actual first element of the array.
    >>
    >> IBM PL/I compilers use only the first method, and so would be dependent
    >> on the lower bounds being the same. Using the second method, the called
    >> routine can use different lower bounds from the caller, and still
    >> find the right array elements, though with added work.
    >>
    >> The rule seems to be that a caller should fill in all fields, even
    >> those that it doesn't actually need. It would seem that Fortran should
    >> use the second method, and PL/I the first.

    >
    >
    > Following doesn't specifically answer your question, but gives some hints
    > http://www.kednos.com/pli/docs/USERS...toc_chapter_11
    >
    > The DESCRIPTOR builtin function
    > http://www.kednos.com/pli/docs/REFER...l#index_x_1625
    >
    > is used to pass arguments to non-PL/I routines and is common to VMS, so
    > I think the
    > lower bound must be included, it certainly is for our internal Dope
    > vectors.
    >


    As I recall, PL/I on VMS uses a class NCA descriptor for passing arrays.
    It has been a long time since I worked on the compilar, and I don't
    have a copy installed locally so I can't verify that.

    Jeff

  16. Re: VMS %descr and PL/I

    Tom Linden wrote:

    (snip)

    > Following doesn't specifically answer your question, but gives some hints
    > http://www.kednos.com/pli/docs/USERS...toc_chapter_11


    > The DESCRIPTOR builtin function
    > http://www.kednos.com/pli/docs/REFER...l#index_x_1625


    > is used to pass arguments to non-PL/I routines and is common to VMS, so
    > I think the
    > lower bound must be included, it certainly is for our internal Dope
    > vectors.


    > To sort out which method is used I think you need to write a small test
    > and look at
    > the map.


    My understanding from the previously indicated document is that
    the descriptor includes both addresses, and callers are supposed
    to fill in both. Callees can use either one.

    -- glen


+ Reply to Thread