Topic
  • 3 replies
  • Latest Post - ‏2013-09-26T01:56:08Z by markboonie
markboonie
markboonie
9 Posts

Pinned topic CONNECTED storage

‏2013-09-09T17:07:27Z |

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

  • Robin400
    Robin400
    36 Posts
    ACCEPTED ANSWER

    Re: CONNECTED storage

    ‏2013-09-23T00:00:06Z  

    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".)

    Updated on 2013-09-23T05:47:17Z at 2013-09-23T05:47:17Z by Robin400
  • markboonie
    markboonie
    9 Posts

    Re: CONNECTED storage

    ‏2013-09-09T17:11:35Z  

    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

  • Robin400
    Robin400
    36 Posts

    Re: CONNECTED storage

    ‏2013-09-23T00:00:06Z  

    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".)

    Updated on 2013-09-23T05:47:17Z at 2013-09-23T05:47:17Z by Robin400
  • markboonie
    markboonie
    9 Posts

    Re: CONNECTED storage

    ‏2013-09-26T01:56:08Z  
    • Robin400
    • ‏2013-09-23T00:00:06Z

    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".)

    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