PL/I

PL/I

PL/I

 View Only
Expand all | Collapse all

How to specify LIMITS(FIXEDBIN(31,31)) under USS

  • 1.  How to specify LIMITS(FIXEDBIN(31,31)) under USS

    Posted Thu August 30, 2018 11:29 PM

    When invoking the compiler under USS you can use a -q option to specify limits.

     

    For example

      -qlimits=fixedbin=63

    is, presumably, the same as LIMITS(FIXEDBIN(63))

     

    I'd like to specify. LIMITS(FIXEDBIN(31,31)) but I don't seem to have a way to do that.

    If I use -qlimits=fixedbin=31,31 I get the message:

     

       IBM1159I W The string 31 is not recognized as a valid option keyword and is ignored

     

    If I use -qlimits=fixedbin='(31,31)' I get these messages:

       IBM2618I W The suboption ( is not valid for the suboption FIXEDBIN of the LIMITS compiler option.
       IBM1158I W A ) is missing in the specification of the LIMITS option.  One is assumed.
       IBM1161I W The suboption 31 is not valid for the LIMITS compiler option.
       IBM1159I W The string ) is not recognized as a valid option keyword and is ignored.
       IBM1159I W The string 31 is not recognized as a valid option keyword and is ignored.

    Any idea on how to specify LIMITS(FIXEDBIN(31,31)) under USS via a -q option?

     

     

    tdr


  • 2.  Re: How to specify LIMITS(FIXEDBIN(31,31)) under USS

    Posted Fri August 31, 2018 04:42 PM

    Hi,

    You need to specify the FIXEDBIN option in same way you do in JCL based compiles, the Unix-like syntax is not capable of rendering the second suboption explicitly:

    -q'limits(fixedbin(31,63))'

    Note that fixedbin(31,31) is not a valid combination, both "FIXEDBIN(63,31) and FIXEDBIN(31,31) are not allowed" per the Programming Guide.

    Bernie

    brataj


  • 3.  Re: How to specify LIMITS(FIXEDBIN(31,31)) under USS

    Posted Fri September 14, 2018 05:38 PM

    Thanks Bernie,

     

     I don't see in the programming guide where LIMITS(FIXEDBIN(31,31)) is disallowed.   In fact, it says:

     

        FIXEDBIN(31) and FIXEDBIN(31,31) are equivalent; similarly, FIXEDBIN(63) and FIXEDBIN(63,63) are equivalent.

     

     I only see it says "FIXEDBIN(63,31) is not allowed." 

     

    *Ah!*. Now I see - that's what the PL/I v4.3 Programming Guide says, the v5.2 Programming Guide has 

    been updated to say this:

      FIXEDBIN(31) and FIXEDBIN(31,63) are equivalent; similarly, FIXEDBIN(63) and FIXEDBIN(63,63) are equivalent.

      FIXEDBIN(63,31) and FIXEDBIN(31,31) are not allowed.

     

    So.. there are really only 2 possibilities:  LIMITES(FIXEDBIN(31,63)) and LIMITS(FIXEDBIN(63,63))  - is that right?  (the other two

    possibilities having been rendered invalid.)

     

      - Dave R. -

     

    tdr


  • 4.  Re: How to specify LIMITS(FIXEDBIN(31,31)) under USS

    Posted Fri September 14, 2018 06:08 PM

    One more question along the lines of the FIXEDBIN limits option.

     

    If I'm understanding things correctly - a LIMITS(FIXEDBIN(63,63)) option indicates that the compiler's intermediate values can be 63-bits and the maximum declared precision is 63 bits.

     

    If I have this example code:

     

     test:proc options(main);

     

      dcl left fixed bin(31);

      dcl right fixed bin(31);

      dcl res fixed bin(31);

     

      left = 5;

      right = 6;

     

      res = (left+right)*2;

     

      display('res is ' || res);

     end;

     

    compiled with LIMITS(FIXEDBIN(63,63)) (in a 31-bit environment) - it produces this assembly:

     

                               000011 |       *    res = (left+right)*2;

     000068  5800  D0B0        000011 |                   L        r0,LEFT(,r13,176)

     00006C  1E01              000011 |                   ALR      r0,r1

     00006E  8900  0001        000011 |                   SLL      r0,1

     000072  5000  D0B8        000011 |                   ST       r0,RES(,r13,184)

     

     

    It seems to be exactly the same code as compiled with the default setting of LIMITS(FIXEDBIN(31,63)).

     

    With LIMITS(FIXEDBIN(63,63)) - I would have expected the addition to produce a temporary with precision (32,0) (since the size can be more than 32.)

    I would then expect the multiplication to produce a result with precision (38,0) (following the rules for FIXED BIN(32,0) * FIXED BIN(1,0).)

    So.. I thought there would be 64-bit arithmetic to evaluate this... but - it's all done in 32-bit instructions.

    Am I missing something here? 

    The reason I ask is that if I do a 64-bit compilation (using the LP(64) option) with LIMITS(FIXEDBIN(63)), I see this code:

     

                               000011 |       *    res = (left+right)*2;

     00001E  E300  48C0  0014  000011 |                   LGF      r0,LEFT(,r4,2240)

     000024  E360  48C4  0014  000011 |                   LGF      r6,RIGHT(,r4,2244)

     00002A  B90A  0006        000011 |                   ALGR     r0,r6

     00002E  EB00  0001  000D  000011 |                   SLLG     r0,r0,1

     000034  B914  0000        000011 |                   LGFR     r0,r0

     000038  5000  48C8        000011 |                   ST       r0,RES(,r4,2248)

     

    where it is clear the compiler is evaluating the intermediate results as 64-bit values.   To really add to this story, if I _don't_ use the LIMITS(FIXEDBIN(63)) option, I see this code for an LP(64) compilation: 

     

                               000011 |       *    res = (left+right)*2;

     00001E  E300  48C0  0014  000011 |                   LGF      r0,LEFT(,r4,2240)

     000024  E360  48C4  0014  000011 |                   LGF      r6,RIGHT(,r4,2244)

     00002A  B90A  0006        000011 |                   ALGR     r0,r6

     00002E  EB00  0001  000D  000011 |                   SLLG     r0,r0,1

     000034  5000  48C8        000011 |                   ST       r0,RES(,r4,2248)

     

    (note the missing LGFR instruction in the FIXEDBIN(31) situation.)

    This seems to suggest that for LP(64), FIXEDBIN(63) does cause the compiler to use 64-bit intermediate values and FIXEDBIN(31) causes the compiler to use 31-bit intermediate values.   

     

    But - the same doesn't appear to be true for a 31-bit (non-LP(64)) compilation.

     

    Is there some other (undocumented?) restriction to compiler temporaries when compiling in 32-bit mode with LIMITS(FIXEDBIN(63)) - is LIMITS(FIXEDBIN(63)) only supported in a 64-bit compilation perhaps?  Or.. is something else going on here?

     

       - Thanks! -

      - Dave

     

    tdr


  • 5.  Re: How to specify LIMITS(FIXEDBIN(31,31)) under USS

    Posted Tue October 23, 2018 06:27 PM

    Hi Dave,

     

    When LIMITS( FIXEDBIN(31,63) ) is in effect, the maximum precision used in a fixed bin arithmetic operation is 31 - unless one of the operands has a precision > 31. When LIMITS( FIXEDBIN(63) ) is in effect, the maximum precision used in a fixed bin arithmetic operation is always 63. The first of my sentences accounts for what you are seeing and is probably most easily seen by compiling and running this variant of your code

     


      dcl left  fixed bin(31);
      dcl right fixed bin(31);
      dcl res   fixed bin(31);
      dcl res8  fixed bin(63);

      left = '7f_ff_ff_ff'xn;
      right = 6;

      res8 = (left+right)*2;

      display('res8 is ' || res8);

      res8 = (prec(left,63)+right)*2;

      display('res8 is ' || res8);         

     

     

     

    pelderon