PL/I for AIX

 View Only
  • 1.  CONNECTED storage

    Posted Mon September 09, 2013 01:07 PM

    Originally posted by: markboonie


    I have a structure that includes a union; I'm trying to use the union to refer both to a set of fields used for sorting and to the fields individually.  The structure looks like this:

    Dcl 01 cm_ss_data                 Based(cm_ssd_ptr(cm_ss_index)),
           03 cm_ssd_alloc            Unsigned Fixed Bin (32),
           03 cm_ssd_inuse            Unsigned Fixed Bin (32),
           03 cm_ssd_entry(cm_ssd_entries Refer (cm_ss_data.cm_ssd_alloc)),
              05 * Union,
                 07 sort_data,
                    09 entry_valid    Bit (1),
                    09 fun_type       Char (FDES_MAX_FUN_TYPE_LEN+1),
                    09 key            Char (FDES_MAX_KEY_LEN+1),
                    09 version_name   Char (FDES_MAX_VERSION_NAME_LEN+1),
                 07 key_text          Char (Size(cm_ssd_entry.sort_data));

     

    The last definition, for key_text, is giving me problems.  I get the compiler message "IBM1569I S SIZE argument must be a CONNECTED reference."  The description of the CONNECTED and NONCONNECTED attributes says "[e]lements, arrays, and major structure or unions are always allocated in connected storage."  So, I'm not sure why sort_data is being treated as nonconnected.  Thanks for any help.

    - mb



  • 2.  Re: CONNECTED storage

    Posted Mon September 09, 2013 01:12 PM

    Originally posted by: markboonie


    By the way, I considered simply replacing the Size() function with the sum of the lengths of the individual fields.  However, if the storage really is non-connected for some reason then the code might compile correctly but couldn't be counted on to operate correctly, so I really need to address the error message instead.

    - mb



  • 3.  Re: CONNECTED storage

    Posted Sun September 22, 2013 08:00 PM

    Originally posted by: Robin400


    Hi,

    The structure is NONCONNECTED.

    In the arrays that you have, all the elements are non-connected (they are interleaved).

    (For an example that corresponds to your code, see the section "CONNECTED and NONCONNECTED attributes".)



  • 4.  Re: CONNECTED storage

    Posted Wed September 25, 2013 09:56 PM

    Originally posted by: markboonie


    So, the reference to Size(cm_ssd_entry.sort_data) is a reference to *all* of the sort_datas as an array?  Well, I wasn't expecting that.  How, then, would I refer to just a single element in the array?  After a quick experiment, It turns out that Size(cm_ssd_entry(1).sort_data) is what I want.  (Actually it seems that I can use any index in parentheses -- the compiler doesn't seem to care.)

    - mb