Troubleshooting
Problem
This document has an example of retrieving the cursor location from the Information Data Structure in ILE RPG IV.
Resolving The Problem
The following display file and ILE RPG IV program show an example of retrieving the cursor location from the Information Data Structure:
Display file INFDSPF:
Display file INFDSPF:
A DSPSIZ(24 80 *DS3)
A CF03(03 'EXIT')
A R SCRN1
A 10 2'MOVE CURSOR ANYWHERE'
A COLOR(WHT)
A 12 4'AND PRESS ENTER TO'
A COLOR(WHT)
A 14 6'DISPLAY CURSOR LOCATION'
A COLOR(WHT)
A 23 3'F3=Exit'
A COLOR(BLU)
RPG program INFRPG3:
**FREE
Dcl-F INFDSPF WORKSTN
INFDS(INFDS);
//
//**************************************************************
// Remember in RPG you always have to add 367 to the offset for
// the I/O feedback area. So for example in the Common I/O
// feedback area Cursor location is offset 3. Add 367 + 3 = 370.
// The value for cursor location comes back in Hex so this
// program has a little routine to convert it to character.
//**************************************************************
Dcl-Ds INFDS;
HROW Char(1) Pos(370);
HCOL Char(1) Pos(371);
End-Ds;
Dcl-Ds WDBIN;
BROW BinDec(4:0) Pos(1);
CROW Char(1) Pos(2);
BCOL BinDec(4:0) Pos(3);
CCOL Char(1) Pos(4);
End-Ds;
BROW = 0;
BCOL = 0;
CROW = HROW;
CCOL = HCOL;
Dsply BROW;
Dsply BCOL;
//**************************************************************
// Before any output is done to the screen the DS INFDS contains
// meaning less data. The above display statements will always
// display 64 for both row and column.
//**************************************************************
//
Exfmt SCRN1;
DoW *IN03 = *OFF;
//
BROW = 0;
BCOL = 0;
CROW = HROW;
CCOL = HCOL;
Dsply BROW;
Dsply BCOL;
//
Exfmt SCRN1;
EndDo;
//
*INLR = '1';
Compile using CRTBNDRPG
CALL INFRPG3



[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
8485515
Was this topic helpful?
Document Information
More support for:
IBM i
Component:
Programming ILE Languages
Software version:
All Versions
Operating system(s):
IBM i
Document number:
683123
Modified date:
15 November 2024
UID
nas8N1010154
Manage My Notification Subscriptions