The symbolic maps we have shown so far consisted of a fixed set of fields for each named map field (the A and O subfields, and so on, in Figure 104). Such fields are the most common, but BMS provides two options for field definition which produce slightly different structures, to account for two common programming situations.
Sometimes, you have to refer to subfields within a single field on the display. For example, you may have a date field that appears on the screen like this:
03-17-92
It is one field on the screen (with one attributes byte, just before the digit "0"), but you must be able to manipulate the month, day, and year components separately in your program.
You can do this with a "group field", using the GRPNAME option of the DFHMDF macro. To create one, you code a DFHMDF macro for each of the component subfields; each definition names the same group field in the GRPNAME option. To define the date above as a group field starting at the beginning of line 10, for example, we would write:
MO DFHMDF POS=(10,1),LENGTH=2,ATTRB=BRT,GRPNAME=DATE
SEP1 DFHMDF POS=(10,3),LENGTH=1,GRPNAME=DATE,INITIAL='-'
DAY DFHMDF POS=(10,4),LENGTH=2,GRPNAME=DATE
SEP2 DFHMDF POS=(10,6),LENGTH=1,GRPNAME=DATE,INITIAL='-'
YR DFHMDF POS=(10,7),LENGTH=2,GRPNAME=DATE
These definitions produce the following in the symbolic output map:
02 DATE.
03 FILLER PICTURE X(2).
03 MOA PICTURE X.
03 MOO PIC X(2).
03 SEP1 PIC X(1).
03 DAO PIC X(2).
03 SEP2 PIC X(1).
03 YRO PIC X(2).
Several rules must be observed when using a group field:
Sometimes a screen contains a series of identical fields that you want to treat as an array in your program. Suppose, for example, that you need to create a display of 40 numbers, to be used when a clerk assigns an unused telephone number to a new customer. (The idea is to give the customer some choice.) You also want to highlight numbers which have been in service recently, to warn the customer of the possibility of calls to the previous owner.
You can define the part of your screen which shows the telephone numbers with a single field definition:
TELNO DFHMDF POS=(7,1),LENGTH=9,ATTRB=NORM,OCCURS=40
This statement generates 40 contiguous but separate display fields, starting at position (7,1) and proceeding across the rows for as many rows as required (five, in our case). We have chosen a length that (with the addition of the attributes byte) divides the screen width evenly, so that our numbers appear in vertical columns and are not split across row boundaries. The attributes you specify, and the initial value as well, apply to each field.
The description of these fields in the symbolic map looks like this in COBOL:
02 TELNOG OCCURS 40.
03 FILLER PICTURE X(2).
03 TELNOA PICTURE X.
03 TELNOO PIC X(9).
This structure lets you fill the map from an array in your program (or any other source) as follows:
PERFORM MOVENO FOR I FROM 1 THROUGH 40.
...
MOVENO.
MOVE AVAIL-NO (I) TO TELNOO (I).
IF DAYS-SINCE-USE (I) < 90, MOVE DFHBMBRY to TELNOA (I).
(DFHBMBRY is a CICS®-supplied constant for setting the field intensity to bright; we explain more in Attribute value definitions: DFHBMSCA.)
Labels for OCCURS fields vary slightly for the different languages that CICS supports, but the function is the same.
Each element of an array created by the OCCURS option is a single map field. If you need to repeat a series of fields (an array of structures, in other words), you cannot use OCCURS. To use such an array in a program, you must define all of the fields individually, without OCCURS, to produce the necessary physical map. Then you can modify the resulting symbolic map, replacing the individual field definitions with an array whose elements are the structure you need to repeat. You must ensure that the revised symbolic map has exactly the same field structure as the original, of course. An alternative is to use SDF II, which allows you to define such an array directly.
[[ Contents Previous Page | Next Page Index ]]