Calculating the Absolute Cursor Position in HATS

In IBM Rational's HATS product, you will often see reference to the cursor position, or absolute cursor position. The simple cursor position is simply the row (comma) column number: i.e. 4,67. The absolute cursor position is a single number that is a calculation of the row and position.

The formula is as follows:

[(actual rows-1) * max columns] + actual columns

For example, take a 5250 session with a screen size of 24x80. That's 24 rows, and 80 columns. A field at position 5,40 would have an absolute cursor position of:

[(5-1) * 80] + 40 = 360

This absolute cursor position is often used in JavaScript functions found in lxgwfunction.js. If you familiarize yourself with those events, you can do some neat UI tricks in HATS.