Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AS/400 Cobol: Moving the cursor back where it came from

Status
Not open for further replies.

NVSbe

Programmer
Sep 9, 2002
153
BE
We're programming with Cobol on an AS/400 machine, using DDS files for interface.

I have a screen which has a calander on it. When the cursor is positioned on a day and the uses presses enter, it shows details for that day. When the user then presses F12, it goes back to the calander, but the cursor is in position 1,1 of the screen. We'd like to keep it where it was enter was pressed.

Now, in the input record, there's a field PSRF, which tells us in which field the cursor is, and a field PRSN, which tells us what position of the field it is in. The key to put the cursor back where it was when the screen is rewritten, would be to move those fields of the input record, to those fields in the output record, and then do a write of the screen. But, alas, no luck.

Does anyone have any thoughts on this?

The calander is not a subfile, it's just a screen with 12 strings (outjan, outfeb, and so on)

An example, if I'd press enter on january the 8th, PSRF of DRS002-I would be "OUTJAN" and PSRN of DRS002-I would be 16. When I move there values to those fields in DRS002-O and do a write however, the cursor is still on position 1/1 of the screen.

Thanks in advance.
Niki --------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
Once again found it right after I posted...

In my DDS a combination of both

RTNCSRPOS (v1 v2 v3)

and

CSRLOC (v4 v5)

was needed.

For seeing where your cursor is after enter, you can use v1 - v3 (recordname, fieldname, field position), and to set your cursor before you write, you can v4 - v5 (X and Y position on the screen). So all you need to do in the cobol program is map the first on the second... (in my case simply adding 7 to the field position, and evaluating the fieldname, moving the right X position to v4).

Thank god for internet references. --------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
Here's a code snippet, for the interested:

DDS
------------------

0003.60 A R DRS002
0003.80 A CA12(99)
0003.90 A CF01(01 'oproepen persnr')
0004.00 A CSRLOC(PRSX PRSY)
0004.10 A RTNCSRLOC(&PRSR &PRSF &PRSP)
0004.20 A PRINT
0004.30 A PRSR 10A H
0004.40 A PRSF 10A H
0004.50 A PRSP 4S 0H
0004.60 A PRSX 3 0H
0004.80 A PRSY 3 0H

------------

Cobol
------

0458.01 Z04-CURS-CONV.
0458.02 *--------------
0458.03 COMPUTE PRSX OF DRS002-O = HZ-MM + 8.
0458.04 COMPUTE PRSY OF DRS002-O = PRSP OF DRS002-I + 6.
0458.05 Z04-EXIT.
0458.06 *---------
0458.07 EXIT. --------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top