Don't you sometimes wish that you could get to a command line while in an application that doesn't allow it? I have.
I have an attention program that transfers me between group jobs automatically when I press the Attn key. If one of my jobs is showing me an order entry screen and I want to see the local data area (LDA) without exiting the program, what can I do? If I press the Attn key, I will be flipped over to another group job that uses a completely different LDA.
A solution I have come up with is to define a specific location on the screen. When the cursor is in that position and the Attn key is pressed, a command line is presented. Think of it as a hidden command hot spot.
In my case, whenever I place the cursor on line 24, column 80, and press the Attn key, my attention program calls the QUSCMDLN API. Now I can look at the LDA and check file contents, all while still in an active application.
The technique relies on creating a command I called Retrieve Cursor Location (RTVCSRLOC). You can see the source in 2. The command calls the RPG IV program CSR001RG, which you can see in 3. The RPG IV program uses the QsnGetCsrAdr API, which returns the cursor location without requiring a user input operation. Here's an example of how I implemented this in my attention program:
The technique relies on creating a command I called Retrieve Cursor Location (RTVCSRLOC). You can see the source in Figure 2. The command calls the RPG IV program CSR001RG, which you can see in Figure 3. The RPG IV program uses the QsnGetCsrAdr API, which returns the cursor location without requiring a user input operation. Here's an example of how I implemented this in my attention program:
DCL &ROW *DEC (3 0) DCL &COL *DEC (3 0) RTVCSRLOC ROW(&ROW) COL(&COL) IF (&ROW *EQ 24 + *AND &COL *EQ 80) DO CALL QUSCMDLN RETURN ENDDO
- Paul Jackson
TechTalk: Create a hidden link to the command line through an Attn key program.
Figure 2: The RTVCSRLOC Command Source
/*==================================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/RTVCSRLOC) PGM(XXX/CSR001RG) + */ /* SRCFILE(XXX/QCMDSRC) ALLOW(*IPGM) */ /* */ /*==================================================================*/ CMD PROMPT('Retrieve Cursor Location') PARM KWD(ROW) TYPE(*DEC) LEN(3 0) RTNVAL(*YES) + MIN(1) PROMPT('Row (3,0)') PARM KWD(COL) TYPE(*DEC) LEN(3 0) RTNVAL(*YES) + MIN(1) PROMPT('Col (3,0)')
TechTalk: Create a hidden link to the command line through an Attn key program.
Figure 3: CSR001RG RPG IV Source
*=============================================================== * To compile: * * CRTBNDRPG PGM(XXX/CSR001RG) SRCFILE(XXX/QRPGLESRC) + * DFTACTGRP(*NO) ACTGRP(*CALLER) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 DRow s 9B 0 DCol s 9B 0 DEnv s 9B 0 DRtnCode s 9B 0 DErrorDS DS DBytesProv 9B 0 INZ(0) C *entry plist C parm Row RtnRow 3 0 C parm Col RtnCol 3 0 C callb 'QsnGetCsrAdr' C parm Row C parm Col C parm Env C parm ErrorDS C parm RtnCode C return *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
LATEST COMMENTS
MC Press Online