× 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.



Okay, I got testreq working (I think) on my system.   I'll put a patch
at the bottom of this message that shows what I changed.

On Thu, 14 Aug 2003 Phillip.Watts@xxxxxxxxx wrote:
> Test Request aids in diagnosing 5250 sessions.
> I've used it with 5294s and other 5250 emulators though
> I don't know much about AS400 personally.
> It is defined in RFC 1205.

Aha!  That's really what I needed to know... that it's defined in RFC1205
:)

> First, without looking at source:
> 1:  Do all keypress events, unless they are grabbed as a local function,
>     result in a send to the AS400?

TN5250 has multiple terminals available to it.   One for ncurses (this is
the primary for Unix machines) one for SLang (occasionally used on Unix
machines) one for Win32, and one for GTK (not in main distro)

Each terminal has mappings from what the user presses (Ctrl-T) to a 5250
function.  In this case, Ctrl-T is mapped to K_TESTREQ (which is a macro
for the octal number 0516).  So this code 0516 is placed into the keyboard
buffer.

Then, there's a routine in display.c which reads from that keyboard
buffer.   This code is common to all versions of tn5250 and is not
terminal specific.   It reads the key from the buffer, goes through a long
switch statement which handles any AID keys.  Function keys, Enter,
Print, SysReq, Reset, etc.  (technically SysReq and TestReq aren't AID
keys, but we have pseudo-aidkey constants so that they can be treated the
same way).   If an AID key is found, it calls the appropriate routine
to send a specially formatted 5250 packet to the '400.

If no AID key is found, and the key is in the range of 32-255, it is
simply "typed" into a field on the screen.   Nothing is actually sent to
the AS/400 until and AID is pressed -- at that time the entire contents of
all fields are sent to the AS/400.

> 2.  Do they automatically go thru the asciitoebcdic translations?

For the keys that are inserted into fields, yes, TN5250 automatically
converts them to EBCDIC when it sends to the '400.

AID keys do not need to be translated, since the actual key is
transmitted, but rather a specially formatted 5250 packet.

> 3.  Is there a hook for sending a binary string?

I'm not sure that this is really applicable to the situation.  You have
to send a 5250 packet, not a binary string.  So, you call the routines
that send packets...

> Or, if I need to goto the source, could anyone give a clue where to watch
> events (strings) and take a send kind of action?

With my familiarity with TN5250, this is REALLY EASY to do once I saw the
docs in RFC1205.   The only thing I'm not clear on is the keyboard locking
state that it needs to go into.

Here's the patch I promised...   if you're interested in understanding how
the program works, understanding what this patch does will go a long way
towards that goal...

But, if nothing else, please try the patch out and tell me if it does
what you wanted it to.   This patch is against CVS HEAD (the 0.17.x
branch)

Index: ChangeLog
===================================================================
RCS file: /cvsroot/tn5250/tn5250/ChangeLog,v
retrieving revision 1.205
diff -u -r1.205 ChangeLog
--- ChangeLog   12 Aug 2003 22:57:55 -0000      1.205
+++ ChangeLog   14 Aug 2003 21:19:57 -0000
@@ -1,3 +1,8 @@
+2003-08-14 Scott Klement <klemscot@xxxxxxxxxxxx>
+- Added a pseudo-AID code for the TESTREQ function.  And added code
+   to send a packet with TRQ bit set when it's pressed.  (We had mapping
+   in the terminal for this, but no code in display.c or session.c!)
+
 2003-08-12 Scott Klement <klemscot@xxxxxxxxxxxx>
 - Fixed one place in telnetstr.c where we allocated with malloc() but
    freed with g_free().
Index: src/display.c
===================================================================
RCS file: /cvsroot/tn5250/tn5250/src/display.c,v
retrieving revision 1.52
diff -u -r1.52 display.c
--- src/display.c       23 Jul 2003 16:06:22 -0000      1.52
+++ src/display.c       14 Aug 2003 21:19:57 -0000
@@ -1098,6 +1098,10 @@
       tn5250_display_kf_field_minus (This);
       break;

+   case K_TESTREQ:
+      tn5250_display_do_aidkey (This, TN5250_SESSION_AID_TESTREQ);
+      break;
+
    case K_SYSREQ:
       tn5250_display_do_aidkey (This, TN5250_SESSION_AID_SYSREQ);
       break;
Index: src/session.c
===================================================================
RCS file: /cvsroot/tn5250/tn5250/src/session.c,v
retrieving revision 1.60
diff -u -r1.60 session.c
--- src/session.c       11 Feb 2003 16:49:26 -0000      1.60
+++ src/session.c       14 Aug 2003 21:19:58 -0000
@@ -1043,6 +1043,13 @@
            This->display->keystate = TN5250_KEYSTATE_UNLOCKED;
       break;

+   case TN5250_SESSION_AID_TESTREQ:
+      header.h5250.flowtype = TN5250_RECORD_FLOW_DISPLAY;
+      header.h5250.flags    = TN5250_RECORD_H_TRQ;
+      header.h5250.opcode   = TN5250_RECORD_OPCODE_NO_OP;
+      tn5250_stream_send_packet(This->stream, 0, header, NULL);
+      break;
+
    case TN5250_SESSION_AID_ATTN:
       header.h5250.flowtype = TN5250_RECORD_FLOW_DISPLAY;
       header.h5250.flags    = TN5250_RECORD_H_ATN;
Index: src/session.h
===================================================================
RCS file: /cvsroot/tn5250/tn5250/src/session.h,v
retrieving revision 1.20
diff -u -r1.20 session.h
--- src/session.h       20 Mar 2002 08:27:17 -0000      1.20
+++ src/session.h       14 Aug 2003 21:19:58 -0000
@@ -69,6 +69,7 @@
 /* These are pseudo-aid codes used by the display. */
 #define TN5250_SESSION_AID_SYSREQ       -1
 #define TN5250_SESSION_AID_ATTN         -2
+#define TN5250_SESSION_AID_TESTREQ      -3


 #define TN5250_SESSION_CTL_IC_ULOCK     0x40 /* ??? - Not in my (older) spec */

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.