Search code examples
mainframepl-i

PL1 structure assignment with BY NAME option at runtime or compilation


In PL1 it is possible to assign a structure with the option BY NAME. Is this functionality used during runtime or during compile only?

The IBM documentation is not very helpful in this case.


Solution

  • Are you talking about the BY NAME in procedure assignment (better known as BY Reference) or the BY NAME in assignment ???.

    From the manual reference, I presume you are talking about the BY NAME assignment option in PL1 assignment which is a variation on the Cobol Move Corresponding clause.

    Yes it is possible to assign a pl1 structure with the BY NAME option. It would be determined at compiled time exactly what is assigned to what.

    See By Name Example in PL1

    This basically lists:

      declare      declare       declare
      1 One,       1 Two,        1 Three,
       2 Part1,     2 Part1,      2 Part1,
        3 Red,       3 Blue,       3 Red,
        3 Orange,    3 Green,      3 Blue,
       2 Part2,      3 Red,        3 Brown,
        3 Yellow,   2 Part2,      2 Part2,
        3 Blue,      3 Brown,      3 Yellow,
        3 Green;     3 Yellow;     3 Green;
    

    Assignment statements using by name clause

     One = Two, by name;
     One.Part1 = Three.Part1, by name;
    

    1 The first assignment statement is the same as the following:

      One.Part1.Red    = Two.Part1.Red;
      One.Part2.Yellow = Two.Part2.Yellow;
    

    2 The second assignment statement is the same as the following:

      One.Part1.Red = Three.Part1.Red;