× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




On 11/05/2010, at 8:06 AM, Dave Fiorillo wrote:

I have been "challenged" to find a way to determine from a program that
gets called to be able to figure out what the last function key was that
was pressed. I cant use the INFDS directly, because I am running in a
different program than the program where the DSPF is defined (DDS), and
the handling of the function key being pressed.

For example, Program A has the logic that when F9 is pressed - then call
program B - and I am program B. So, in Program B I want to be able to
retrieve from memory what was the last function key pressed in Program
A.

Umm ... if you're PGMB and PGMB is called when F9 is pressed then surely you can infer that F9 was pressed in the caller but really why do you care? PGMB has been invoked so it should do whatever it is that it does. Why does it matter which F-key was used to invoke it?

That's a serious question because if we know WHY you're trying to do something we may be able offer a different (better) solution.

Its ok if I have to tell Program B the name of the display file for
now, but phase 2 might be nice to be able to figure out the last display
file used.

Information about the last display file is easy. See the QWSRTVOI (Retrieve Output Operation) API.

The Work Control Block (or PCO Associated Space) of the job has some of this information at position x'451' but the API is the approved mechanism.


What I have been able to figure out so far, by using DMPJOB, is that
when I search on the DSPF name in the dump, I can consistently see a
space defined with the identifier of "19 FC" for the display file used
in program A, and at offset x'7D3' from this particular section is the
AID byte of the function key. I am assuming that this is the place in
memory of the job that stores the INFDS for program A. I tried this
with 5 different function keys and got consistent results with the AID
byte so I am very hopeful that this is the sweet spot in memory (at
least for V5R4).

I think you're finding the pointer to the ODP of the display file in the Data Management Communications Queue.

Leif's MI Book has some information on the DMCQ including how to walk the ODP chain. See:
http://www.leif.org/as400/

You can compare the layout of the data you've found with the Feedback structures described in the (I keep thinking Appendix A. of the Data Management Guide because that's where it used to be) buried in the Reference Chapter of the Database File Management manual.

My question: is there an easy way to access this information using MI?
From my research so far, I have learned that a "19 FC" is a *PTCSPC
internal object to the job, and I keep scouring the dump to try and
glean more information.

Easy is such a relative term. As far as I know there is no MI instruction to materialise the information you want, nor is there an API, so you'll have to follow the chain of WCB->DMCQ->ODP->I/O Feedback and you'll need system-state to access these objects so if you're after a commercial solution then I suspect you'll need to find another way.


Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.