TechTalk: Create a hidden link to the command line through an Attn key program.

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: