Here are three effective methods for managing the cursor in CICS screens. These methods will be beneficial for your projects and interviews.
CICS – How to Handle Cursors
1. Using IC Option
The term ‘IC’ stands for insert cursor. The ‘IC’ option should be used when a map contains a single entry field; you can specify the ‘IC’ option in the DFHMDF macro for that field.
For maps with multiple entry fields, the IC technique lacks flexibility. Therefore, you will need to utilize one of the other two techniques: direct or symbolic cursor positioning.
The real use of Cursors in CICS is to place them on screens, telling which field the user needs to enter data. Three top positioning methods are available in CICS
Example:
CUSTNO DFHMDF POS=(2,26), X LENGTH=6, X ATTRB=(NORM,UNPROT,IC), X COLOR=TURQUOISE, X INITIAL='______'
2. Direct Cursor Positioning
To use direct cursor positioning, you include the CURSOR option on the SEND MAP command with a cursor position.
Keep in mind that this cursor position represents a displacement from the start of the screen. It is not a row/column address. Therefore, you need to calculate the value.
You can specify the displacement in the CURSOR option or transfer it to a binary halfword field (PIC S9(4) COMP) within the CURSOR option.
Example:
EXEC CICS
SEND MAP('MNTMAP1')
MAPSET('MNTSET1')
FROM(MNTMAP1O)
CURSOR(346)
END-EXEC.
Formula to find displacement:
The CURSOR value specifies a screen position that represents a displacement from the start of the screen.
For a 24×80 screen, it must be a number from 0 to 1919, where 0 is row 1/column 1 and 1919 is row 24/column 80.
To calculate the displacement for a screen position, use this formula:
(Row-number – 1) x 80 + (Column-number – 1) = Displacement

3. Symbolic Cursor
Direct cursor positioning has two vital drawbacks. First, cursor displacements are awkward to use.
Second, and more importantly, direct cursor positioning ties your program to specific screen locations.
If you move a field to a different spot on your mapset, you must update your program.
Symbolic cursor positioning is much more flexible. With this technique, you move -1 to the corresponding length field. This action in the symbolic map tells the CICS to move the cursor to that field.
Next, issue a SEND MAP command with the CURSOR option, but do not include a displacement value.
*Interview Question:
If you move -1 to more than one length field, the cursor is positioned at the first field containing -1.”
So, when you edit data entry fields, it’s common to move -1 to the length fields of all input fields that are invalid. That way, the cursor will be positioned at the start of the first field that’s in error.
Example:
MOVE –1 TO CUSTNO1L.
EXEC CICS
SEND MAP('MNTMAP1')
MAPSET('MNTSET1')
FROM(MNTMAP1O)
CURSOR
END-EXEC.
Conclusion
Effectively managing cursor positioning in CICS screens is key to improving user experience and data entry efficiency. By using options like the Insert Cursor (IC), Direct Cursor Positioning, and Symbolic Cursor Positioning, developers can customize applications to meet specific needs. Symbolic cursor positioning is flexible, making maintenance and adjustments to screen layouts easier.







You must be logged in to post a comment.