GUI ScreenIO for Windows

 ScreenIO.com


Array Definitions

Sometimes, it's convenient to define fields as an array.  GUI ScreenIO makes it easy to create one row (or column) of an array, and then replicate this down (or to the right) as many times as you like.

You can also specify the spacing between the replicated rows/columns of your array.

Arrays appear in your copybooks as a typical COBOL array (table), compete with predefined index items.  The attributes for your array also appear in an array so that you can use the same logic to reference them as you use to address the data elements of your array.

Preparation for Arrays:

Fields that are going to be part of an array must be adjacent (per the rules of COBOL).  However, normally,  fields are added to the copybook in the order they are defined.  Therefore, before creating an array it is a good idea to use the main menu option to set the copybook field sequence to the physical BEFORE you define the array.

Select Panel, Copybook, Field Sequence,  as shown below

You will then see the Reorder Fields In Copybook screen:

 

If you have no other reason to prefer a specific order of fields in the copybook, (and most users don't) then just press the Reset Copybook to Physical button on the screen above.  This will assure that your fields are in the proper order for array creation.  Remember to do this BEFORE you create an array.

It is also a good idea to set your Tabbing Sequence (main menu option Field, Tabbing Sequence) before creating an array.

Creating an array

This image shows the array definition screen.  We have already created the top row, and we have SELECTED that row so that the array definition knows which controls it should replicate.  These fields are called the Original fields...

Note we asked for 5 replicates, to appear visually as rows (down the screen), spaced with 4 units between rows.  When you press the Generate button, you'll see your array of fields.   The newly created fields are called Replicates. 

Modifying properties of controls in an array

The Editor will select all the Original field and Replicates when you click any one of the fields. Note that if you right-click a control that is part of an array, the Properties option on the context menu for that control is grayed out. 

This is because the control is a member of an array - a fixed data structure - and therefore, you cannot change only one member of the array. 

If you want to change the properties of controls that are in an array, select the array and then select the Array tool again from the menu.  You will then be able to select the Remove Replicates from the Restructuring option.

After removing the  replicates, the Original fields will still be selected.  You may now double click any of these fields to edit them.  When done, select Tools, Array Definition again, and the array panel will still have your prior definition, ready for you to re-create the array.

Once an array is created, reordering the fields in the copybook (with the "reorder fields in copybook tool) will treat all array fields en mass, and selecting any one of them will cause all of them to be selected and inserted into the copybook at the specified location.

Data definition in the panel copybook

Here's how the data fields for your array look like in the panel-4 area of your panel copybook. 

Note that the indexes and array vectors are named with the array name you provide.  Note that you can produce two dimensional arrays, with more than one elementary element.  Our sample array has 4 elementarily elements but only a single dimension.

 01  SAMP1-4.
     05  MY-CERTS-ROW OCCURS 5
                     INDEXED BY MY-CERTS-ROWFX.
       10  STATE                          PIC X(20).
       10  L1                             PIC 9 VALUE 0.
           88 L1-ON  VALUE 1.
           88 L1-OFF VALUE 0.
       10  L1                             PIC 9 VALUE 0.
           88 L1-ON  VALUE 1.
           88 L1-OFF VALUE 0.
       10  D1                             PIC 9(06).

© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom