Emulator ProgrammingV140
Emulator ProgrammingV140
0 IBM
Emulator Programming
SC31-8478-13
Personal Communications for Windows, Version 14.0 IBM
Emulator Programming
SC31-8478-13
Note
Before using this information and the product it supports, read the information in Appendix F, “Notices,” on page 435.
iv Emulator Programming
Structure of the Presentation Space . . . . . 237 Personal Communications Response . . . . . 273
Get Session Status . . . . . . . . . . . . 238 Stop Keystroke Intercept. . . . . . . . . . 274
Personal Communications Response . . . . . 239 Personal Communications Response . . . . . 274
Format of Status Information . . . . . . . 239 Stop Mouse Input Intercept. . . . . . . . . 274
Get System Configuration . . . . . . . . . 240 Personal Communications Response . . . . . 275
Personal Communications Response . . . . . 240 Stop Read SF . . . . . . . . . . . . . 275
Format of System Configuration Information 241 PC/3270 response . . . . . . . . . . . 275
Get System Formats . . . . . . . . . . . 241 Stop Session Advise . . . . . . . . . . . 276
Personal Communications Response . . . . . 241 Personal Communications Response . . . . . 276
Get System Status . . . . . . . . . . . . 242 Terminate Session Conversation . . . . . . . 276
Personal Communications Response . . . . . 242 Personal Communications Response . . . . . 277
Get System SysItems . . . . . . . . . . . 243 Terminate Structured Field Conversation . . . . 277
Personal Communications Response . . . . . 243 PC/3270 Response . . . . . . . . . . 277
Get System Topics . . . . . . . . . . . . 244 Terminate System Conversation . . . . . . . 277
Personal Communications Response . . . . . 244 Personal Communications Response . . . . . 277
Get Trim Rectangle . . . . . . . . . . . 244 Write SF . . . . . . . . . . . . . . . 278
Personal Communications Response . . . . . 245 PC/3270 Response . . . . . . . . . . 278
Initiate Session Conversation . . . . . . . . 245 DDE Menu Item API in a Windows 32-Bit
Personal Communications Response . . . . . 246 Environment . . . . . . . . . . . . . 278
Initiate Structured Field Conversation . . . . . 246 DDE Menu Client . . . . . . . . . . . 279
PC/3270 Response . . . . . . . . . . 246 DDE Menu Server . . . . . . . . . . . 279
Initiate System Conversation . . . . . . . . 246 DDE Menu Functions . . . . . . . . . . 281
Personal Communications Response . . . . . 247 Change Menu Item . . . . . . . . . . 281
Put Data to Presentation Space . . . . . . . 247 Create Menu Item . . . . . . . . . . . 287
Personal Communications Response . . . . . 248 Initiate Menu Conversation. . . . . . . . 288
Search for String . . . . . . . . . . . . 248 Start Menu Advise . . . . . . . . . . 289
Personal Communications Response . . . . . 249 Stop Menu Advise. . . . . . . . . . . 290
Structure of the Search Information . . . . . 249 Terminate Menu Conversation. . . . . . . 290
Send Keystrokes . . . . . . . . . . . . 249 Summary of DDE Functions in a Windows
Personal Communications Response . . . . . 250 32-Bit Environment . . . . . . . . . . 291
Session Execute Macro . . . . . . . . . . 250
Personal Communications Response . . . . . 251 Chapter 7. Using DDE Functions with
Issuing Commands with the Session Execute a DDE Client Application . . . . . . 297
Macro Function. . . . . . . . . . . . 251
Using the Personal Communications DDE Interface 297
WINDOW Command . . . . . . . . . 251
System Conversation . . . . . . . . . . 298
KEYBOARD Command . . . . . . . . . 251
Session Conversation . . . . . . . . . . 298
SEND Command . . . . . . . . . . . 252
Session Conversation (Hot Link) . . . . . . 300
RECEIVE Command . . . . . . . . . . 252
Personal Communications DDE Interface . . . . 301
SENDKEY Command . . . . . . . . . 252
DDE Functions for System Conversation . . . . 301
WAIT Command . . . . . . . . . . . 256
Get System Configuration . . . . . . . . 301
Set Cursor Position . . . . . . . . . . . 257
Get System Formats . . . . . . . . . . 302
Personal Communications Response . . . . . 258
Get System Status . . . . . . . . . . . 302
Set Mouse Intercept Condition . . . . . . . 259
Get System SysItems . . . . . . . . . . 303
Personal Communications Response . . . . . 261
Get System Topics . . . . . . . . . . . 303
Set Presentation Space Service Condition . . . . 261
Initiate System Conversation . . . . . . . 303
Personal Communications Response . . . . . 263
Terminate System Conversation . . . . . . 304
Set Session Advise Condition . . . . . . . . 263
DDE Functions for Session Conversation . . . . 304
Personal Communications Response . . . . . 264
Find Field . . . . . . . . . . . . . 304
Set Structured Field Service Condition . . . . . 264
Get Operator Information Area . . . . . . 305
PC/3270 Response . . . . . . . . . . 265
Get Partial Presentation Space . . . . . . . 306
Start Close Intercept . . . . . . . . . . . 265
Get Presentation Space . . . . . . . . . 307
Personal Communications Response . . . . . 266
Get Session Status . . . . . . . . . . . 308
Start Keystroke Intercept . . . . . . . . . 266
Get Trim Rectangle . . . . . . . . . . 308
Personal Communications Response . . . . . 267
Initiate Session Conversation . . . . . . . 310
Start Mouse Input Intercept . . . . . . . . 267
Put Data to Presentation Space . . . . . . 311
Personal Communications Response . . . . . 268
Search for String . . . . . . . . . . . 311
Start Read SF . . . . . . . . . . . . . 270
Session Execute Macro . . . . . . . . . 312
PC/3270 Response . . . . . . . . . . 271
Set Cursor Position . . . . . . . . . . 313
Start Session Advise . . . . . . . . . . . 272
Terminate Session Conversation . . . . . . 313
Personal Communications Response . . . . . 273
DDE Functions for Session Conversation (Hot
Stop Close Intercept . . . . . . . . . . . 273
Link) . . . . . . . . . . . . . . . . 313
Contents v
Initiate Session Conversation . . . . . . . 313 Return Parameters. . . . . . . . . . . 353
Start Close Intercept . . . . . . . . . . 314 EAB Option . . . . . . . . . . . . . 353
Start Keystroke Intercept . . . . . . . . 314 Copy OIA (13) . . . . . . . . . . . . . 354
Start Session Advise . . . . . . . . . . 315 Copy String to PS (15) . . . . . . . . . . 354
Stop Close Intercept . . . . . . . . . . 316 Storage Manager (17) . . . . . . . . . . . 355
Stop Keystroke Intercept. . . . . . . . . 317 Copy String to Field (33) . . . . . . . . . 355
Stop Session Advise . . . . . . . . . . 317 Get Key (51). . . . . . . . . . . . . . 355
Terminate Session Conversation . . . . . . 317 Window Status (104) . . . . . . . . . . . 355
Visual Basic Sample Program . . . . . . . . 317 Query Sessions (10) . . . . . . . . . . . 355
Connect for Structured Fields (120) . . . . . . 355
Chapter 8. Server-Requester Allocate Communications Buffer (123) . . . . . 355
Programming Interface (SRPI) Support 329 ASCII Mnemonics . . . . . . . . . . . . 356
Get Request Completion (125) . . . . . . . . 356
How to Use SRPI . . . . . . . . . . . . 329
SRPI Compatibility . . . . . . . . . . . 329
Using the Server-Requester Programming Interface 330 Appendix C. DOS-Mode EHLLAPI for
SEND_REQUEST Parameters . . . . . . . . 332 Windows . . . . . . . . . . . . . 357
Supplied Parameters . . . . . . . . . . 332 Installation . . . . . . . . . . . . . . 357
Returned Parameters . . . . . . . . . . 334
How PC/3270 Applications Use SRPI . . . . . 334 Appendix D. SRPI Return Codes . . . 359
Invoking SEND_REQUEST . . . . . . . . . 335 Error Handling . . . . . . . . . . . . . 359
Performance Considerations . . . . . . . . 335 Transport Layer Errors . . . . . . . . . 359
Handling the Interrupt (Ctrl+Break) Key . . . . 335 Application Errors. . . . . . . . . . . 359
C Requesters . . . . . . . . . . . . . 335 SEND_REQUEST Processing Errors . . . . . 359
C send_request Function . . . . . . . . 336 Types of SRPI Return Codes . . . . . . . . 359
SRPI Record Definition . . . . . . . . . 336 Type 0 Return Code Definitions . . . . . . 360
SRPI Return Codes . . . . . . . . . . 336 Type 1 Return Code Definitions . . . . . . 360
Type 2 Return Code Definitions . . . . . . 362
| Chapter 9. Troubleshooting for Type 3 Return Code Definitions . . . . . . 363
| Emulator programming . . . . . . . 337 Class Definitions for Type 2 and Type 3 . . . . 363
| Partial EHLLAPI input on Personal Exception Code Values for Type 2 and Type 3 . . 364
| Communications host screen . . . . . . . . 337 Exception Object Values for Type 2 and Type 3 . . 364
| IBM Personal Communications VBHLLAPI sample Server Return Codes . . . . . . . . . . . 365
| does not run in FDCC Windows Vista . . . . . 339
Appendix E. DDE Functions in a
Appendix A. Query Reply Data 16-Bit Environment . . . . . . . . . 367
Structures Supported by EHLLAPI . . 341 Personal Communications DDE Data Items in a
The DDM Query Reply . . . . . . . . . . 341 16-Bit Environment . . . . . . . . . . . 367
DDM Application Name Self-Defining Using System Topic Data Items . . . . . . 368
Parameter . . . . . . . . . . . . . 342 Using Session Topic Data Items . . . . . . 368
PCLK Protocol Controls Self-Defining Parameter 342 Using LU Topic Data Items (PC/3270 Only) . . 368
Base DDM Query Reply Formats . . . . . . 342 DDE Functions in a 16-Bit Environment . . . . 368
The IBM Auxiliary Device Query Reply . . . . 344 Naming Conventions for Parameters . . . . 369
Optional Parameters . . . . . . . . . . 344 Find Field . . . . . . . . . . . . . 370
Direct Access Self-Defining Parameter . . . . 345 Get Keystrokes . . . . . . . . . . . . 371
PCLK Protocol Controls Self-Defining Parameter 346 Get Mouse Input . . . . . . . . . . . 372
The OEM Auxiliary Device Query Reply . . . . 346 Get Number of Close Requests . . . . . . 375
Direct Access Self-Defining Parameter . . . . 347 Get Operator Information Area . . . . . . 376
PCLK Protocol Controls Self-Defining Parameter 347 Get Partial Presentation Space . . . . . . . 377
The Cooperative Processing Requester Query Reply 348 Get Presentation Space . . . . . . . . . 379
The Product-Defined Query Reply . . . . . . 348 Get Session Status . . . . . . . . . . . 381
Optional Parameters . . . . . . . . . . 348 Get System Configuration . . . . . . . . 382
Direct Access Self-Defining Parameter . . . . 349 Get System Formats . . . . . . . . . . 383
The Document Interchange Architecture Query Get System Status . . . . . . . . . . . 384
Reply . . . . . . . . . . . . . . . . 350 Get System SysItems . . . . . . . . . . 385
Get System Topics . . . . . . . . . . . 386
Appendix B. Differences from Get Trim Rectangle . . . . . . . . . . 387
Initiate Session Conversation . . . . . . . 387
Communication Manager/2 EHLLAPI . 353 Initiate Structured Field Conversation . . . . 388
Set Session Parameter (9) . . . . . . . . . 353 Initiate System Conversation . . . . . . . 389
Set Options . . . . . . . . . . . . . 353 Put Data to Presentation Space . . . . . . 389
vi Emulator Programming
Search for String . . . . . . . . . . . 390 Terminate System Conversation . . . . . . 417
Send Keystrokes . . . . . . . . . . . 391 Write SF . . . . . . . . . . . . . . 418
Session Execute Macro . . . . . . . . . 392 DDE Menu Item API in a 16-Bit Environment . . 419
Set Cursor Position . . . . . . . . . . 398 DDE Menu Client in a 16-Bit Environment . . 419
Set Mouse Intercept Condition . . . . . . 400 DDE Menu Server, 32-Bit . . . . . . . . 420
Set Presentation Space Service Condition . . . 402 DDE Menu Functions in a 16-Bit Environment . . 421
Set Session Advise Condition . . . . . . . 403 Change Menu Item . . . . . . . . . . 421
Set Structured Field Service Condition . . . . 404 Create Menu Item . . . . . . . . . . . 426
Start Close Intercept . . . . . . . . . . 405 Initiate Menu Conversation. . . . . . . . 427
Start Keystroke Intercept . . . . . . . . 407 Start Menu Advise . . . . . . . . . . 428
Start Mouse Input Intercept . . . . . . . 408 Stop Menu Advise. . . . . . . . . . . 429
Start Read SF . . . . . . . . . . . . 411 Terminate Menu Conversation. . . . . . . 430
Start Session Advise . . . . . . . . . . 412 Summary of DDE Functions in a 16-Bit
Stop Close Intercept . . . . . . . . . . 413 Environment . . . . . . . . . . . . . 430
Stop Keystroke Intercept. . . . . . . . . 414
Stop Mouse Input Intercept. . . . . . . . 415 Appendix F. Notices . . . . . . . . 435
Stop Read SF . . . . . . . . . . . . 415 Trademarks . . . . . . . . . . . . . . 436
Stop Session Advise . . . . . . . . . . 416
Terminate Session Conversation . . . . . . 417
Index . . . . . . . . . . . . . . . 439
Terminate Structured Field Conversation . . . 417
Contents vii
viii Emulator Programming
Figures
1. Keystroke Flow . . . . . . . . . . . 25 6. IBM Workstation Requester and IBM Host
2. Host Presentation Space Characters . . . . 51 Computer Server Relationship . . . . . . 331
3. DDE Menu Server Conversation . . . . . 279 7. Example of an SRPI Requester and Server
4. DDE Menu Client Conversation . . . . . 280 Flow . . . . . . . . . . . . . . 332
5. Example of PC/3270 SRPI Requester and 8. DDE Menu Server Conversation . . . . . 419
Server . . . . . . . . . . . . . . 330 9. DDE Menu Client Conversation . . . . . 420
| In this book, Windows refers to Windows 7, Windows 8/8.1, Windows 10, Windows
| Server 2008, and Windows Server 2012. When information is relevant only to a
| specific operating system, this will be indicated in the text.
The programmer must also be familiar with connecting to a host system from a
terminal or from a workstation with terminal emulation software.
This book assumes you are familiar with the language and the compiler that you
are using. For information on how to write, compile, or link-edit programs, refer to
Where To Find More Information for the appropriate references for the specific
language you are using.
In addition to the printed books, there are Hypertext Markup Language (HTML)
documents provided with Personal Communications:
Notation
A table at the beginning of each section explains API or DDE functions in
Chapter 3, “EHLLAPI Functions,” on page 27, Chapter 5, “PCSAPI Functions,” on
page 197, Chapter 6, “DDE Functions in a 32–bit Environment,” on page 221, and
Appendix E, “DDE Functions in a 16-Bit Environment,” on page 367. It shows
whether a function is supported for the products that provide the function
described in the section. Yes means it is supported for a host type, and No means
not supported. For example, the following table indicates that a function is
available for 3270 and VT sessions but not for 5250 sessions.
3270 5250 VT
Yes No Yes
Critical Sections
Use critical sections (EnterCriticalSection function) carefully when your program
calls emulator APIs. Do not make emulator API calls within a critical section. If
one thread of an application establishes a critical section and another thread is
within an emulator API call, the call is suspended until you exit from the critical
section.
During processing of an API call, all signals (except numeric coprocessor signals)
are delayed until the call completes or until the call needs to wait for incoming
data. Also, TerminateProcess issued from another process is held until the
application completes an API call it might be processing.
Stack Size
Emulator APIs use the calling program's stack when they are executed. The
operating system, the application, and the API all require stack space for dynamic
variables and function parameters. At least 8196 bytes (8K) of stack space should
be available at the time of an API call. It is the responsibility of the application
program to ensure sufficient stack space is available for the API.
For these platforms, Personal Communications does not install the following
libraries.
2 Emulator Programming
v DOS EHLLAPI
v 16-bit API support:
– Standard EHLLAPI 16-bit interface
– WinHLLAPI 16-bit interface
– PCSAPI 16-bit interface
– SRPI 16-bit interface
Sample Programs
Several sample programs are provided, each of which illustrates the use of one of
the Personal Communications APIs. If you choose to install the sample programs,
they will be installed in the \SAMPLES directory.
The sample program files include source and supporting files for the following
Personal Communications APIs:
v Emulator High-Level Language Programming Interface (EHLLAPI)
v Dynamic Data Exchange (DDE)
v Server-Requester Programming Interface (SRPI)
v PCSAPI Functions
4 Emulator Programming
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM
Enhanced EHLLAPI and WinHLLAPI Programming
This chapter provides information needed to incorporate IBM Standard EHLLAPI
(16- and 32-bit), WinHLLAPI (16- and 32-bit), and IBM Enhanced 32-bit EHLLAPI
(EHLAPI32) functions into applications written in a high level language. It
provides details on call format, memory allocation considerations, initializing the
interfaces, and compiling and linking applications. Also included is a short sample
EHLLAPI program and the compile/link instructions used to build it. Finally, a set
of possible uses for the EHLLAPI interface (scenarios) is described.
EHLLAPI Overviews
Following are overviews for HLLAPI programming interfaces.
The EHLLAPI interface is a single call-point interface. There is a single callable API
through which all EHLLAPI functions are requested. On each call to the interface
the application provides a function number which identifies the function
requested, a pointer to a data buffer, a pointer to the length of the data buffer, and
a pointer to a return code (see “EHLLAPI Call Format” on page 6).
WinHLLAPI
WinHLLAPI is based on the familiar EHLLAPI.API. It encompasses all of the
existing functionality and adds extensions that take advantage of the Windows
message driven environment. Users of the IBM Personal Communications
EHLLAPI interface will notice no functional difference unless they incorporate the
WinHLLAPI extensions.
The WinHLLAPI extension functions and any functions that deviate from the
EHLLAPI form are described in Chapter 4, “WinHLLAPI Extension Functions,” on
page 185. For information on common functions, refer to Chapter 3, “EHLLAPI
Functions,” on page 27.
Languages
Any programming language which can invoke an entry point in a DLL with the
"Pascal" calling convention can be used to execute EHLLAPI functions. However,
the Personal Communications EHLLAPI toolkit provides header files and function
prototypes only for the C++ languages. A clear understanding of data structure
layout and calling conventions is required to use any other language. The
EHLLAPI toolkit supports the following C/C++ compilers:
v IBM VisualAge® for C/C++
v Microsoft Visual C/C++ Version 4.0 and higher
Most other C/C++ compilers will also work with the toolkit.
Note: The data structure layout for 16- and 32-bit applications are not the same
(see “Standard and Enhanced Interface Considerations” on page 21).
Each parameter is passed by reference not by value. Thus each parameter to the
function call must be a pointer to the value, not the value itself. For example, the
following is a correct example of calling the EHLLAPI Query Session Status
function:
#include "hapi_c.h"
struct HLDQuerySessionStatus QueryData;
int Func, Len, Rc;
long Rc;
6 Emulator Programming
Len = sizeof(QueryData); // Len of buffer
Rc = 0; // Unused on input
All the parameters in the hllapi call are pointers and the return code of the
EHLLAPI function is returned in the value of the 4th parameter, not as the value
of the function. For example, the following is not correct:
if (hllapi(&Func, (char *)&QueryData, &Len, &Rc) != 0) { // WRONG!
// ...Error handling
}
Although the hllapi function is defined to return a long data type for IBM
Standard and Enhanced EHLLAPI, and void data type for WinHLLAPI, its value is
undefined and should not be used.
The second through fourth parameters of the hllapi call can return information to
the application. The description of each EHLLAPI function describes what, if any,
information is returned in these parameters.
Data Structures
Many EHLLAPI functions use a formatted data structure to pass information to or
from the application program. The description of each function shows the layout of
the data structure. The data passed to or from the EHLLAPI function must exist in
storage exactly as documented, byte for byte. Note that the structure layout is the
same for all IBM Standard and WinHLLAPI 16- and 32-bit applications. Data
structures for the IBM Enhanced 32-bit applications are packed to a 4-byte
alignment.
It is highly recommended that the supplied header file and data structure definitions
be used to ensure proper data alignment and layout. Although it is technically
possible, the following is not recommended:
char QueryData[20]; // Not recommended
...
Func = HA_QUERY_SESSION_STATUS;
hllapi(&Func, QueryData, &Len, &Rc);
if (QueryData[13] == ’F’) {
// ...this is a 5250 session
}
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 7
Memory Allocation
EHLLAPI functions do not allocate or free memory. The application program must
preallocate buffer space for EHLLAPI functions which require it before calling the
hllapi entry point. The buffer space may be pre-allocated as a dynamic variable
such as:
struct HLDQuerySessionStatus QueryBuff;
In any case, the application is responsible for allocating sufficient buffer space
before calling EHLLAPI functions and for freeing buffers when they are not
needed.
Unless indicated otherwise in the description of each function, the following table
shows the meaning of each return code value. Some functions may have a slightly
different interpretation of these return codes; refer to the individual function
descriptions for details.
Table 3. EHLLAPI Return Codes
Return Code Explanation
0 The function successfully executed, or no update since the last call was
issued.
1 An incorrect host presentation space ID was specified. The specified session
either was not connected, does not exist, or is a logical printer session.
2 A parameter error was encountered, or an incorrect function number was
specified. (Refer to the individual function for details.)
4 The execution of the function was inhibited because the target presentation
space was busy, in X CLOCK state (X []), or in X SYSTEM state.
5 The execution of the function was inhibited for some reason other than
those stated in return code 4.
6 A data error was encountered due to specification of an incorrect parameter
(for example, a length error causing truncation).
7 The specified presentation space position was not valid.
8 A functional procedure error was encountered (for example, use of
conflicting functions or missing prerequisite functions).
9 A system error was encountered.
10 This function is not available for EHLLAPI.
11 This resource is not available.
12 This session stopped.
24 The string was not found, or the presentation space is unformatted.
25 Keystrokes were not available on input queue.
8 Emulator Programming
Table 3. EHLLAPI Return Codes (continued)
Return Code Explanation
26 A host event occurred. See Query Host Update (24) for details.
27 File transfer was ended by a Ctrl+Break command.
28 Field length was 0.
31 Keystroke queue overflow. Keystrokes were lost.
32 An application has already connected to this session for communications.
33 Reserved.
34 The message sent to the host was canceled.
35 The message sent from the host was canceled.
36 Contact with the host was lost.
37 Inbound communication has been disabled.
38 The requested function has not completed its execution.
39 Another DDM session is already connected.
40 The disconnection attempt was successful, but there were asynchronous
requests that had not been completed at the time of the disconnection.
41 The buffer you requested is being used by another application.
42 There are no outstanding requests that match.
43 The API was already locked by another EHLLAPI application (on LOCK) or
API not locked (on UNLOCK).
There are two possible ways to link the application program, depending on how
the entry point is to be resolved. The simplest way is to statically link the
application with the appropriate Personal Communications library. This will
resolve the entry point at link time. The operating system will load the correct DLL
with the application when it starts. Another way to link to the entry point is to
perform dynamic linking. In this case, the application uses operating system calls
to load the correct DLL and obtain the entry point address at run time.
The following table shows which header files to use, which .LIB should be used
for static linking, and which .DLL should be used for dynamic loading.
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 9
Static Link Method
Using the static link method the application can simply call the hllapi entry point
when needed such as:
#include "hapi_c.h"
int HFunc, HLen, HRc; // Function parameters
char HBuff[1]; // Function parameters
...
HFunc = HA_RESET_SYSTEM; // Run EHLLAPI function
HLen = 0;
HRc = 0;
hllapi(&Func, HBuff, &HLen, &HRc);
if (HRc != 0) {
// ... EHLLAPI access error
}
When the operating system loads an application constructed in this way, the
Personal Communications EHLLAPI module is loaded automatically.
To use dynamic linking, the application needs to load the appropriate Personal
Communications module and locate the entry point. It is recommended that the
entry point be located by its ordinal number and not by name. The ordinal number
is defined in the header file. The following 32-bit Windows code loads the IBM
Standard 32-bit EHLLAPI module, locates the hllapi entry point, and makes an
EHLLAPI function call.
#include "hapi_c.h"
10 Emulator Programming
(*hllapi)(&Func, HBuff, &HLen, &HRc);
if (HRc != 0) {
// ... EHLLAPI access error
}
Multithreading
IBM Enhanced EHLLAPI (32-bit) and IBM Standard EHLLAPI 16-bit connect on a
per process basis. All threads access the same connected host session. The thread
that performs the connections must also perform the disconnection.
IBM Standard EHLLAPI (32-bit) and WinHLLAPI connect on a per thread basis.
Each thread must maintain its own connections. This allows a multithreaded
process to maintain connections to more than one connected host session at a time.
This eliminates the need for multi-process schemes when using a WinHLLAPI
program to coordinate data between different hosts. It also puts the burden of
connecting and disconnecting as necessary on the individual thread.
Presentation Spaces
Many EHLLAPI functions require a presentation space ID (PSID) to indicate which
host emulator session is to be used for the function. (This is also referred to as the
short session ID). A presentation space ID is a single character in the range A to Z.
There are a maximum of 26 sessions.
Func = HA_PM_WINDOW_STATUS;
HLen = sizeof(StatusData);
HRc = 0;
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 11
storage to hold (possibly) the entire presentation space. The size of the presentation
space for a given session can be obtained using the Query Session Status (22)
function.
For some functions, the PSID is contained in a preceding call to the Connect
Presentation Space (1) function. For other functions, the PSID is contained in the
calling data string parameter.
The following paragraphs describe how the PSID is handled for the various
combinations of these two factors.
12 Emulator Programming
PSID Handling for Functions Requiring Connect
Some functions interact only with the host-connected presentation space. These
functions require the Connect Presentation Space (1) function as a prerequisite
call. The PSID for these functions is determined by the Connect Presentation
Space (1) and the Disconnect Presentation Space (2) functions as follows:
v When there is no host-connected presentation space, these functions do not
interact with any presentation space. A return code of 1 is generated.
v When there is one host-connected presentation space, these functions interact
with the presentation space specified in the calling data string parameter of the
most recent call to the Connect Presentation Space (1) function.
All except the first two of these functions allow you to specify the PSID using
either:
v A letter A through Z
v A blank or a null
The first two functions require that a letter be used to specify the PSID.
When there is one host-connected presentation space, the following rules apply:
v The function can interact with any host presentation space if a letter is used to
specify the PSID.
v If a blank or a null is used to specify the PSID, the function operates in the
presentation space identified in the most recent call to the Connect Presentation
Space (1) function.
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 13
v Using a letter to specify the PSID does not change the established PSID of the
host-connected presentation space, except on a connect PS request.
The type of shared access can be defined by setting the following read and write
sharing options for each function in the Set Session Parameters (9) function call:
SUPER_WRITE
The application allows other applications that allow sharing and have write access
permissions to concurrently connect to the same presentation space. The
originating application performs supervisory-type functions but does not create
errors for other applications that share the presentation space.
WRITE_SUPER
The application requires write access and allows only supervisory applications to
concurrently connect to its presentation space. This is the default value.
WRITE_WRITE
The application requires write access and allows partner or other applications with
predictable behavior to share the presentation space.
WRITE_READ
The application requires write access and allows other applications that perform
read-only functions to share the presentation space. The application is also allowed
to copy the presentation space and perform other read-only operations as usual.
WRITE_NONE
The application has exclusive use of the presentation space. No other applications
are allowed to share the presentation space, including supervisory applications.
The application is allowed to copy the presentation space and perform read-only
operations as usual.
READ_WRITE
The application requires only read access to monitor the presentation space and
allows other applications that perform read or write, or both, functions to share the
1. This means that two EHLLAPI programs will not be vying for the same Presentation Space at the same time; or that there is logic
in those programs which will allow the program to wait until the PS is available; or that the applications never use the Session in
a way which would lock out other applications.
14 Emulator Programming
presentation space. The application is also allowed to copy the presentation space
and perform other read-only operations as usual.
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 15
Table 5. Prerequisite Functions and Associated Dependent Functions (continued)
Prerequisite Call Functions Access
Connect Presentation Copy Field to String (34) Read
Space (1) Copy OIA (13) Read
Copy Presentation Space (5) Read
Copy Presentation Space to String (8) Read
Copy Presentation Space to Clipboard (35)Read
Copy String to Field (33) Write
Copy String to Presentation Space (15) Write
Disconnect Presentation Space (2) Write
Find Field Length (32) Read
Find Field Position (31) Read
Query Cursor Location (7) Read
Query Field Attribute (14) Read
Paste Clipboard to Presentation Space (36)Write
Release (12) Write
Reserve (11) Write
Search Field (30) Read
Search Presentation Space (6) Read
Send key (3) Read
Set Cursor (40) Write
Start Playing Macro (110) Write
Wait (4) Read
Connect Structured Field (120) Disconnect Structured Field (121) N/A
Get Request Completion (125)
Read Structured Field (126)
Write Structured Field (127)
Read Structured Field (126) Get Request Completion (125) N/A
Start Close Intercept (41) Query Close Intercept (42) N/A
Stop Close Intercept (43)
Start Host Notification (23) Query Host Update (24)
Stop Host Notification (25)
Start Keystroke Intercept (50) Get Key (51) N/A
Post Intercept Status (52)
Stop Keystroke Intercept (53)
Send Key (3) if edit keystrokes are to
be sent (edit keystroked support is
available in Enhanced Mode)
Write Structured Field (127) Get Request Completion (125) N/A
If the application that locked the presentation space does not unlock it by using the
same call with an Unlock option or Reset System (21) call, the lock is removed
when the application terminates or the session stops.
16 Emulator Programming
Using mouse actions to select, copy, and paste text in the
Presentation Space
The following mouse actions can be used in the Presentation Space.
v Select a word by double-clicking the left mouse button.
v Copy a selected word by clicking the right mouse button.
v Paste a copied word by double-clicking the mouse right button.
ASCII Mnemonics
Keystrokes originating at a host keyboard might have a corresponding ASCII
value. The response of the Get Key (51) function to a keystroke depends on
whether the key is defined and also on whether the key is defined as an ASCII
value or an ASCII mnemonic.
The keyboard for one session might not be capable of producing some codes
needed by the another session. ASCII mnemonics that represent these codes can be
included in the data string parameter of the Send Key (3) function.
The capabilities of the Send Key (3) function and the Get Key (51) function allow
sessions to exchange keystrokes that might not be represented by ASCII values or
by an available key. A set of mnemonics that can be generated from a keyboard is
provided. These mnemonics let you use ASCII characters to represent the special
function keys of the workstation keyboard.
The default escape character is @. You can change the value of the escape character
to any other character with the ESC=c option of the Set Session Parameters (9)
function. The following text uses the default escape character, however.
Shift indicators that are not part of the ASCII character set are represented to the
host application by 2-byte ASCII mnemonics as follows:
Upper shift @S
Alt @A
Ctrl @r
The abbreviations used make the mnemonics for special keys easy to remember.
An alphabetic key code has been used for the most common keys. For example,
the Clear key is C; the Tab key is T, and so on. Please note that the uppercase and
lowercase alphabetic characters are mnemonic abbreviations for different keys.
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 17
General
All defined keys are represented by either:
v A 1-byte ASCII value that is part of the 256-element ASCII character set, or
v A 2-, 4-, or 6-byte ASCII mnemonic
To represent a key defined as a function, a 2-, 4-, or 6-byte ASCII mnemonic that
corresponds to that function is used. For example, to represent the backtab key, @B
is used. To represent PF1, @1 is used. To represent Erase Input, @A@F is used. See
the following lists:
18 Emulator Programming
Notes:
1. The first @ symbol in the first table represents the escape character. The first
and second @ symbol in the second table is the escape character. The @ symbol
is the default escape character. You can change the value of the escape character
using the ESC=c option of the Set Session Parameters (9) function.
If you change the escape character to #, the literal sequences used to represent
the Backtab, Home, and Erase Input keys become #B, #0, and #A#F, respectively.
Also, the literal sequence used to represent the @ symbol becomes #@.
2. If you send the mnemonic for print screen (that is, either @P or @A@T), place it at
the end of the calling data string.
3. If you send the mnemonic for device cancel (that is, @A@R), it is passed through
with no error message; however, local copy is not stopped.
If the operator types a key defined as a function, the host application receives a 2-,
4-, or 6-byte ASCII mnemonic that corresponds to that function. For example, if the
Backtab key is typed, @B is received. If PF1 is pressed, @1 is received. If Erase
Input is pressed, @A@F is received.
If the operator types a defined shift key combination, the host application receives
the ASCII character, or the 2-, 4-, or 6-byte ASCII mnemonic that corresponds to
the defined character or function.
If the operator types an individual key that is not defined, the Get Key (51)
function returns a return code of 20 and nothing is sent to the host application.
The Get Key (51) function prefixes all characters and mnemonics sent to the host
application with two ASCII characters. The first ASCII character is the PSID of the
host presentation space to which the keystrokes are sent. The other character is an
A, S, or M for ASCII, special shift, or mnemonic, respectively. See “Return
Parameters” on page 94.
To send a function key to another session, include the ASCII mnemonic for that
function in the data string parameter of the Send Key (3) function.
If the Send Key (3) function sends an unrecognized mnemonic to the host session
a return code rejecting the key might result.
Debugging
As an aid in debugging EHLLAPI applications, the Trace Facility of Personal
Communications may be used. This facility will produce a log of all EHLLAPI
calls, parameters, return values, and return codes. For more information on using
the Trace Facility, refer to Administrator's Guide and Reference.
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 19
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include "hapi_c.h"
HFunc = HA_RESET_SYSTEM;
HLen = 0;
HRc = 0;
hllapi(&HFunc, HBuff, &HLen, &HRc);
if (HRc != HARC_SUCCESS) {
printf("Unable to access EHLLAPI.\n");
return 1;
}
HFunc = HA_CONNECT_PS;
HLen = sizeof(ConnBuff);
HRc = 0;
memset(&ConnBuff, 0x00, sizeof(ConnBuff));
ConnBuff.stps_shortname = ’A’;
hllapi(&HFunc, (char *)&ConnBuff, &HLen, &HRc);
switch (HRc) {
case HARC_SUCCESS:
case HARC_BUSY:
case HARC_LOCKED: // All these are OK
break;
case HARC_INVALID_PS:
printf("Host session A does not exist.\n");
return 1;
case HARC_UNAVAILABLE:
printf("Host session A is in use by another EHLLAPI application.\n");
return 1;
case HARC_SYSTEM_ERROR:
printf("System error connecting to session A.\n");
return 1;
default:
printf("Error connecting to session A.\n");
return 1;
}
HFunc = HA_SENDKEY;
HLen = strlen(SendString);
HRc = 0;
hllapi(&HFunc, SendString, &HLen, &HRc);
switch (HRc) {
case HARC_SUCCESS:
break;
case HARC_BUSY:
case HARC_LOCKED:
printf("Send failed, host session locked or busy.\n");
break;
default:
printf("Send failed.\n");
break;
}
HFunc = HA_DISCONNECT_PS;
HLen = 0;
HRc = 0;
hllapi(&HFunc, HBuff, &HLen, &HRc);
20 Emulator Programming
printf("EHLLAPI program ended.\n");
return 0;
}
The following MAKEFILE file could be used to build this application with the IBM
VisualAge C/C++ for Windows compiler (assuming the source file is named
SAMPLE.C):
all: sample.exe
hlldir = C:\PCOMWIN\SAMPLES
hlllib = C:\PCOMWIN\SAMPLES
.SUFFIXES: .C .OBJ
.c.obj:
icc.exe /Ti /Gh /Gm /Gd /C /I $(hlldir) /Tc $*.c
sample.exe: sample.obj
ilink.exe /de /noe $(hlllib)\pcscal32.lib $**
sample.obj: sample.c
By prefilling EHLLAPI data buffers with binary zeros, and using the data
structures supplied in HAPI_C.H, an application can be compiled for standard or
enhanced operation without any source code changes. For example, the following
section of code would work for standard EHLLAPI but would fail for enhanced
EHLLAPI:
#include "hapi_c.h"
...
int Func, Len, Rc;
char Buff[18];
char SessType;
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 21
hllapi(&Func, Buff, &Len, &Rc); // Execute function
The following is the same function written to work correctly if compiled for
standard or enhanced operation. Changed lines are indicated with a >:
#include "hapi_c.h"
...
int Func, Len, Rc;
> struct HLDQuerySessionStatus Buff;
char SessType;
Your programmed operator can use a series of EHLLAPI functions to mimic these
actions. After determining the correct starting point for the host system transaction,
the programmed operator can call the Search Presentation Space (6) function to
determine which keyword messages or prompting messages are on the display
screen.
22 Emulator Programming
Next, the programmed operator can use the Send Key (3) function to type data
into a host system session and enter a host system transaction. Then the
programmed operator can:
v Use the Wait (4) function that waits for the X CLOCK, X [], or X SYSTEM
condition to end (or returns a keyboard-locked condition if the terminal has
locked up).
If the keyboard is inhibited, your EHLLAPI program can call the Copy OIA (13)
function to get more information about the error condition.
v Use the Search Presentation Space (6) function to look for an expected keyword
to validate that the proper response had been received.
v Use the Copy Presentation Space to String (8) function (or any of several data
access functions) to extract the desired data.
The Search Presentation Space (6) function is critical to simulate another task of
the terminal operator. Some host systems do not stay locked in X CLOCK, X [], or
X SYSTEM mode until they respond; instead, they quickly unlock the keyboard
and allow the operator to stack other requests. In this environment, the terminal
operator depends on some other visual prompt to know that the data has returned
(perhaps a screen title or label). The Search Presentation Space (6) function allows
your EHLLAPI program to search the presentation space while waiting. Also,
while waiting for a response, calling the Pause (18) function allows other DOS
sessions to share the central processing unit resource. The Pause (18) function has
an option that allows your EHLLAPI program to wait for a host system update
event to occur.
If no host system event occurs after a reasonable time-out period, your EHLLAPI
program could call a customized error message such as:
No Response From Host. Retry?
However, because the programmed operator is looking for a literal keyword string,
subtle changes in message syntax, even as trivial as uppercase versus lowercase,
can make the program take a preprogrammed error action.
The Tab key mnemonic (@T; see “General” on page 18 for a full list of mnemonics)
can be used to skip between fields. When sending keystrokes to a field using the
Send Key (3) function, you should be aware of the field lengths and contents. If
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 23
you fill the fields completely and the next attribute byte is autoskip, your cursor
will then be moved to the next field. If you then issued a tab, you would skip to
yet another field.
Likewise, if your keystrokes do not completely fill the field, there might be data
left from prior input. You should use the Erase End of Field (EOF) command to
clear this residual data.
This workstation application can then cooperate with a host system application in
any of the following ways:
v On a field or presentation space basis using either the copy functions that
address fields (Copy String to Field (33) function or Copy Field to String (34)
function) or the functions that let you copy from and into presentation spaces
(for example, Copy String to Presentation Space (15) function or Copy
Presentation Space to String (8) function).
v On a keystroke basis, using the Send Key (3) function.
v On a file basis, for large blocks of data. You can have your application use the
EHLLAPI file transfer capability (using Send File (90) function or Receive File
(91) function) to transfer data or functions (such as load modules) and have it
processed locally or remotely.
Scenario 5. Automation
An application can provide all the keystrokes for another application or can
intersperse keystrokes to the target destination with those from the keyboard.
Sometimes, to do this, the application must lock out other sources of keystroke
input that might be destined for a target application or presentation space (using
the Reserve (11) function) and the later unlock it (using the Release (12) function).
24 Emulator Programming
The origin of keystrokes presented to any application is determined by the design
of the application. Keystrokes can originate from:
v The keyboard
v Data integrated into the source application
v Secondary storage retrieved through the DOS interface
v The Personal Communications interface
In all cases the keystrokes that are provided to the target application are
indistinguishable from the ordinary operator input.
Figure 1 provides a simplified representation of the keystroke flow and the objects
within a keyboard enhancement environment.
Chapter 2. Introduction to IBM Standard EHLLAPI, IBM Enhanced EHLLAPI and WinHLLAPI Programming 25
1. Your EHLLAPI application program calls the Connect Presentation Space (1)
function to connect to the presentation space whose keystrokes are to be
filtered.
2. Your EHLLAPI program next calls the Start Keystroke Intercept (50) function
specifying the L option. This causes all keystrokes to be routed to the filtering
application program.
3. The filtering application program can now define a loop in which:
a. The Get Key (51) function intercepts all keystrokes being sent to the target
presentation space.
b. The filtering application examines each keystroke and performs a keyboard
macro task, such as:
v Abbreviating program commands so that three- or four-keystroke
command can be condensed into a single keystroke
v Customizing commands so that they are easier to remember or consistent
with other software packages
v Creating boiler plates for contracts or frequently used letters
v Rearranging the keyboard for concurrent applications that use the same
keys for differing functions
For example, the filtering application might convert a key combination such
as Alt+Y into a command to move the cursor to column 35 of the second
line in presentation space and write the string “XYZ Tool Corporation,
Dallas, Texas”.
c. If a keystroke is rejected, your EHLLAPI program can cause a beep to be
sounded, using the Post Intercept Status (52) function.
4. After your EHLLAPI program exits the filtering loop, Stop Keystroke Intercept
(53) function to end the filtering process.
26 Emulator Programming
Chapter 3. EHLLAPI Functions
This chapter describes each individual Personal Communications EHLLAPI
function in detail and explains how to use the EHLLAPI program sampler. The
functions are arranged alphabetically by name. The functions are explained for
both the standard and enhanced interfaces.
Note: Throughout this chapter WinHLLAPI, IBM Standard 32-bit HLLAPI and
16-bit EHLLAPI are referred to as Standard Interface, and IBM Enhanced
32-bit EHLLAPI is referred to as Enhanced Interface.
See the specific section for each function for details on Japanese code page
1390/1399 and Hindi code page 1137.
Notes:
1. The string containing the Unicode characters to be sent to the PCOMM session
should be typecast to WCHAR * for code page 1390/1399 and to char * for code
page 1137.
2. EHLLAPI 1390/1399 Unicode functionality is available only for 3270 and 5250
sessions. EHLLAPI 1137 Unicode functionality is available only for 5250
sessions.
Call Parameters
“Call Parameters” lists the parameters that must be defined in your program to
call the discussed EHLLAPI function and explains how those parameters are to be
defined. If a parameter is never used by a function, then NA (not applicable) is
listed. If a parameter can be overridden by certain values of session parameters
defined with calls to the Set Session Parameters (9) function, such session
parameters are named.
Return Parameters
“Return Parameters” lists the parameters that must be received by your program
after a call to the discussed EHLLAPI function and explains how to interpret those
parameters.
28 Emulator Programming
Table 6. EHLLAPI Functions Summary (continued)
Function 3270 5250 VT
The Allocate Communications Buffer function obtains a buffer from the operating
system. A buffer address must be passed on both the Read Structured Fields (126)
and Write Structured Fields (127) functions.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 123
Data String See the following table
Length Must be 6 Must be 8
PS Position NA
Byte Definition
Standard Enhanced
1–2 1–4 32-bit or 16-bit buffer length. (0 < size ≤ (64 KB−256
bytes)=X'FF00')
3–6 5–8 32-bit allocated buffer address (returned)
Return Parameters
Return Code Explanation
0 The Allocate Communications Buffer function was successful.
2 An error was made in specifying parameters.
9 A system error occurred.
11 Resource unavailable (memory unavailable).
The Cancel File Transfer function causes any current EHLLAPI initiated Send File
or Receive File for the specified session to immediately return.
Prerequisite Calls
Send File (90) or Receive File (91)
Call Parameters
Enhanced Interface
Function Number Must be 92
Data String 1-character short name of the host presentation space. A blank or
null indicates request for updates to the host-connected
presentation space
Length 4 is implied
PS Position NA
Byte Definition
1 A 1-character presentation space short name (PSID)
2-4 Reserved
Return Parameters
Return Code Definition
0 The function was successful
1 An incorrect PSID was specified
8 No prior call to Start Communication Notification (80) function
was called for the PSID
9 A system error was encountered
The Change PS Window Name function allows the application to specify a new
name for the presentation space window or reset the presentation space window to
the default name.
Prerequisite Calls
Connect Window Services (101)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 106
Data String See the following table
Length Must be specified (See note.) Must be 68
PS Position NA
Note: The data string length must be specified (normally 3–63 for PC/3270, 4–63
for PC400, 68 for enhanced interface).
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
2 5 A change request option value, select one of:
v X'01' for changing the presentation space window
name.
v X'02' for resetting the presentation space window
name.
3–63 6–66 An ASCII string of from 1 (for PC/3270) or 2 (for PC400)
to 61 bytes including a terminator byte. The ASCII string
must end with a NULL character. This string must
contain at least one non-NULL character followed by a
NULL character.
67–68 Reserved
Return Parameters
Return Code Explanation
0 The Change PS Window Name function was successful.
32 Emulator Programming
Return Code Explanation
1 An incorrect host presentation space short session ID was
specified, or the host presentation space was not connected.
2 An error was made in specifying parameters.
9 A system error occurred.
12 The session stopped.
If the application fails to reset the presentation space name before exiting, the exit
list processing resets the name.
The Change Switch List LT Name function allows the application to change or
reset a switch list for a selected logical terminal (LT). The application must specify
on the call the name to be inserted in the switch list.
Note: This is for compatibility with Communication Manager EHLLAPI, and has
the same result as the Change PS Window Name (106) function.
Prerequisite Calls
Connect Window Services (101)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 105
Data String See the following table
Length Normally 4–63 Must be 68
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
Return Parameters
Return Code Explanation
0 The Change Switch List LT Name function was successful.
1 An incorrect host presentation space short session ID was
specified, or the host presentation space was not connected.
2 An error was made in specifying parameters.
9 A system error occurred.
12 The session stopped.
If the application fails to reset the switch list LT name before exiting, the exit list
processing resets the name.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 120
Data String See the following table
34 Emulator Programming
Standard Interface Enhanced Interface
Length 7 or 11 Must be 16
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
2–5 5–8 Address of the Query Reply data buffer
6–7 9–10 Destination/origin unique ID. (16-bit word, returned)
11–12 Reserved
8–11 13–16 The data in these position is ignored by EHLLAPI.
However, no error is caused if the migrating program has
data in these positions. This data is accepted to provide
compatibility with migrating applications.
Return Parameters
Return Code Explanation
0 The Connect for Structured Fields function was successful.
1 A specified host presentation space short session ID was not valid,
or the host presentation space was not connected.
2 An error was made in specifying parameters.
9 A system error occurred.
10 The function is not supported by the emulation program.
32 An application has already connected to this session for
communications (successful connect).
39 One DDM session is already connected to this session.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 1
Data String 1-character short name of the host presentation space
Length 1 is implied Must be 4
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
Return Parameters
The Connect Presentation Space function sets the return code to indicate the
status of the attempt and, if successful, the status of the host presentation space.
36 Emulator Programming
Return Code Explanation
11 This resource is unavailable. The host presentation space is already
being used by another system function.
The Connect Window Services function allows the application to manage the
presentation space windows. Only one EHLLAPI application at a time can be
connected to a presentation space for window services.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 101
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
Return Parameters
Return Code Explanation
0 The Connect Window Services function was successful.
1 An incorrect host presentation space short session ID was
specified, or the Sessions Window Services manager was not
connected. This return code could also mean that the API Setting
for DDE/EHLLAPI is not set on.
9 A system error occurred.
10 The function is not supported by the emulation program.
11 This resource is unavailable. The host presentation space is already
being used by another system function.
The Convert Position or Convert RowCol function converts the host presentation
space positional value into the display row and column coordinates or converts the
display row and column coordinates into the host presentation space positional
value. This function does not change the cursor position.
38 Emulator Programming
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 99
Data String Host presentation space short name and P for the Convert
Position function (for example, AP converts the presentation
space position of session A); or Host presentation space
short name and R for the Convert RowCol function (for
example, AR converts the row and column coordinates of
session A).
Length Row, when R is specified as the second character in the data
string parameter. The lower limit for valid input is 1. The
upper limit for valid input depends on how your host
presentation space is configured. See “Notes on Using This
Function” on page 40.
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
2 5 Convert option P or R
6–8 Reserved
Return Parameters
This function returns a length and a return code.
Length:
For the Convert Position function (P as the second character in the calling
data string), a number between 1 and 43 (for PC/3270) or 27 (for PC400) is
returned. This value is the number of the row that contains the PS position
contained in the calling PS position parameter. The upper limit can be
smaller than 43 (for PC/3270) or 27 (for PC400) depending on how the
host presentation space is configured.
40 Emulator Programming
The Copy Field to String function transfers characters from a field in the
host-connected presentation space into a string.
The Copy Field to String function translates the characters in the host source
presentation space into American National Standard Code for Information
Interchange (ASCII). Attribute bytes and other characters not represented in ASCII
normally are translated into blanks.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 34
Data String Preallocated target data string. When the Set Session
Parameters (9) function with Extended Attribute Bytes
(EAB) option is issued, the length of the data string must be
at least twice the length of the field.
Return Parameters
This function returns a data string, length, and a return code.
Data String:
A string containing data from the identified field in the host presentation
space. The first byte in the returned data string is the beginning byte of the
identified field in the host presentation space. The number of bytes in the
returned data string is determined by the smaller of:
v Number of bytes specified in the calling length parameter
v Number of bytes in the identified field in the host presentation space
Length:
The length of the data returned.
Return Code:
The following codes are defined:
Note: When the field wraps at the end of the presentation space, wrapping
occurs when the end of the presentation space is reached.
4. DBCS Only: The Set Session Parameters (9) function EAD option is used with
this function to return a 2-byte EAD. If the EAD option is specified instead of
the EAB option, EAD is returned preceding each character. If both the EAB and
EAD options are specified, EAD is returned preceding the EAB.
5. An EAB can be returned when the Set Session Parameters (9) function EAB
option is used. EAB is related to each character in the presentation space and is
returned preceding each character.
6. The Copy Field to String function is affected by the ATTRB/NOATTRB/NULLATTRB,
the EAB/NOEAB, the XLATE/NOXLATE, the DISPLAY/NODISPLAY, the DISPLAY/NODISPLAY,
the EAD/NOEAD (for DBCS only), and the NOSO/SPACESO/SO (for DBCS only) session
options. Refer to items 5 on page 154; 13 and 14 on page 157; 17 on page 158;
and 20 and 21 on page 159 for more information.
As previously stated, the return of attributes by the various Copy (5, 8, and 34)
functions is affected by the Set Session Parameters (9) function. The involved
set session parameters have the following effect:
Set Session Parameter
Effect on the COPY Function
NOEAB and NOEAD
Attributes are not returned. Only text is copied from the presentation
space to the user buffer.
EAB and NOXLATE
Attributes are returned as defined in the following tables.
EAB and XLATE
The colors used for the presentation space display are returned. Colors
can be remapped; so the attribute colors are not the ones returned by
the COPY functions when XLATE and EAB are on at the same time.
EAD Double-byte character set attributes are returned as shown in the
following tables.
The returned character attributes are defined in the following tables. The
attribute bit positions are in IBM format with bit 0 the left most bit in the byte.
42 Emulator Programming
3270 character attributes are returned from the host to the emulator. The
following table applies when EAB and NOXLATE are set.
5250 character attributes are returned from the host to the emulator. The
following table applies when EAB and NOXLATE are set.
44 Emulator Programming
Bit Position Character Position Field Attribute Position
3–4 SI (Bit position 3) 5250 DBCS related field
When the value of bit
position 7 is 0:
00 = Default
01 = DBCS only
10 = Either DBCS or
SBCS
11 = Mixture of DBCS
and SBCS
When the value of bit
position 7 is 1:
00 = Reserved
01 = DBCS only
without SO/SI
10 = Reserved
11 = Reserved
5 Reserved SO/SI enable (3270 only)
6 Reserved Character attributes exist
(3270 only)
7 Reserved 5250 DBCS related extended
field
0 = Basic double-byte
field
1 = Extended double-byte
field
In a Unicode session, the characters in the host source presentation space are
translated into Unicode. Attribute bytes are normally translated into blanks.
The XLATE option (that can be specified using the Set Session Parameters
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
Return Parameters: This function returns a data string, length, and a return code.
Data String:
String containing the Unicode data is returned.
Length:
Number of Unicode characters copied into string.
Return Code:
The following codes are defined:
46 Emulator Programming
Notes on Using This Function: The following options are supported in a Unicode
session for Copy Field To String (34) and function in the same way as in DBCS:
v NOATTRB
v ATTRB
v NULLATTRB
v EAB
v NOEAB
v NOXLATE
v DISPLAY
v NODISPLAY
In a Unicode session, the characters in the host source presentation space are
translated into Unicode. Attribute bytes are normally translated into blanks.
The XLATE option (that can be specified using the Set Session Parameters
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
Return Parameters: This function returns a data string, length, and a return code.
Data String:
String containing the Unicode data is returned.
Length:
Number of Unicode characters copied into string. To get the number of
bytes, multiply by 2.
Return Code:
The following codes are defined:
Notes on Using This Function: The following options are supported in a Unicode
session for Copy Field To String and function in the same way as in SBCS:
v NOATTRB
v ATTRB
v NULLATTRB
v EAB
v NOEAB
v NOXLATE
v DISPLAY
v NODISPLAY
The Copy OIA function returns the current operator information area (OIA) data
from the host-connected presentation space.
The OIA is located under the bottom dividing line of the screen and is used to
display session status information about the connection between the workstation
and the host.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 13
Data String Preallocated target data string
Length 103 104
PS Position NA
Return Parameters
This function returns a data string and a return code.
48 Emulator Programming
Data String:
A 103-byte string for 16-bit and 104-byte string for 32-bit. See “Format of
the Returned OIA Data String” for more information.
Return Code:
The following codes are defined:
Byte Definition
Standard Enhanced
1 1 The OIA format byte. The value is 1 (PC/3270), 9
(PC400), or 5 (VT).
2–81 2–81 The OIA image in the host code points.
82–103 82–103 OIA group indicator meanings.
104 Reserved.
PC/3270 OIA Group Indicator Meanings and Its Image: The OIA image group
consists of an 80-byte ASCII character string with no attribute bytes that contains
the OIA image in host code points. Figure 2 on page 51 shows the hexadecimal
codes found in the host presentation space, and the characters they represent. The
returned data can be translated into OIA graphics characters. Refer to Quick
Beginnings for information on the OIA indicators.
To translate the returned data into OIA graphics characters, proceed as follows:
1. Print the data returned in bytes 2 through 81 to the screen or to a printer.
Note: Group 8 (byte 0) machine, communications, and program check images are
followed by a three-digit number related to the type of check.
The online and screen ownership group images are for non-SNA 3274 controller
configurations. For SNA, the CD hex value is translated by CD (see Figure 2 on
page 51). If running on a 3174 controller or SDLC connection, the hex value X'F4' is
replaced by X'B2' or X'22'. The highlight indicator is a corresponding image (in the
first 80 bytes of the data string) of the “Group 5 (offset 86: Highlight group 1”
byte. The highlight indicator is followed by either X'F9' (blink), X'FC' (underscore),
X'D2' (reverse video), or X'80' (host default).
All group images are represented by Main Frame Interactive (MFI) hex code
points.
Note: The OIA image data string position minus 1 position equals the OIA
column.
50 Emulator Programming
Figure 2. Host Presentation Space Characters
Bit Meaning
0–1 Reserved
2 SSCP-LU session owns screen
3 LU-LU session owns screen
4 Online and not owned
5 Subsystem ready
6–7 Reserved
Bit Meaning
0 Reserved
1 APL
2 Katakana (Japan only)
3 Alphanumeric
4–5 Reserved
Bit Meaning
0 Upper shift
1 Numeric
2 CAPS
3–7 Reserved
Bit Meaning
0–7 Reserved
Bit Meaning
0 Operator selectable
1 Field inherit
2–7 Reserved
Bit Meaning
0 Operator selectable
1 Field inherit
2–7 Reserved
Bit Meaning
0 Insert mode
1–7 Reserved
Bit Meaning
0 Non-resettable machine check
1 Reserved
2 Machine check
3 Communications check
4 Program check
5–7 Reserved
52 Emulator Programming
Bit Meaning
0 Device busy
1 Terminal wait
2 Minus symbol
3 Minus function
4 Too much entered
5–7 Reserved
Bit Meaning
0–2 Reserved
3 Incorrect dead key combination, limited key.
4 Wrong place
5–7 Reserved
Bit Meaning
0–1 Reserved
2 System wait
3–7 Reserved
Bit Meaning
0–7 Reserved
Bit Meaning
0–7 Reserved
Bit Meaning
0–7 Reserved
Bit Meaning
0–7 Reserved
Bit Meaning
0-6 Communications error
1–7 Reserved
Bit Meaning
0–7 Reserved
Bit Meaning
0–7 Reserved
Bit Meaning
0–7 Reserved
Bit Meaning
0–7 Reserved
PC400 OIA Group Indicator Meanings and Its Image: Details of the OIA group
are listed in the following tables.
v Group 1 (Offset 82): Online and Screen Ownership
54 Emulator Programming
Bit Meaning Beginning Position of Data String
0 Reserved
1 Keyboard shift 39
2 CAPS
3–6 Reserved
7 Double-byte
character input
available
56 Emulator Programming
Bit Meaning Beginning Position of Data String
0–7 Reserved
VT Host OIA Group Indicator Meanings and Its Image: Details of the VT Host
OIA group are listed in the following tables.
v Group 1 (Offset 82): Online and Screen Ownership
Bit Meaning
5 Subsystem ready
Bit Meaning
0 Upper shift
2 CAPS
Bit Meaning
0 Insert mode
Some columns on the OIA line display different messages for VT than those
messages displayed for 3270/5250. See the following table for specific details.
Column Symbol
1–7 VT220 7
VT220 8
VT100
VT52
VTANSI
9 - 12 LOCK
61 - 64 HOLD
The Copy Presentation Space function copies the contents of the host-connected
presentation space into a data string that you define in your EHLLAPI application
program.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 5
Data String Preallocated target string the size of your host presentation
space. This can vary depending on how your host
presentation space is configured. When the Set Session
Parameters (9) function with the EAB option is issued, the
length of the data string must be at least twice the length of
the presentation space.
Return Parameters
This function returns a data string, length, and a return code.
Data String:
Contents of the connected host presentation space.
Length:
Length of the data copied.
Return Code:
The following codes are defined:
58 Emulator Programming
2. DBCS Only: The Set Session Parameters (9) function EAD option is used with
this function to return a 2-byte EAD. If the EAD option is specified instead of
the EAB option, EAD is returned preceding each character. If both the EAB and
EAD options are specified, EAD is returned preceding the EAB.
If the start position of the copy is at the second byte in the double-byte
character, or the end position is at the first byte in the double-byte character,
the bytes are translated into blanks.
3. The Copy Presentation Space function is affected by the following session
options:
v ATTRB/NOATTRB/NULLATTRB
v EAB/NOEAB
v XLATE/NOXLATE
v BLANK/NOBLANK
v DISPLAY/NODISPLAY
v EAD/NOEAD (for DBCS only)
v NOSO/SPACESO/SO (for DBCS only)
v EXTEND_PS/NOEXTEND_PS
Refer to items 5 on page 154; 13, 14, 15 and 17 on page 158; and 20 and 21 on page
159 for more information.
If the target data string provided is not long enough to hold the requested data,
unpredictable results can occur.
As previously stated, the return of attributes by the various Copy (5, 8, and 34)
functions is affected by the Set Session Parameters (9) function. The involved set
session parameters have the following effect:
Set Session Parameter
Effect on the COPY Function
NOEAB and NOEAD
Attributes are not returned. Only text is copied from the presentation space
to the user buffer.
EAB and NOXLATE
Attributes are returned as defined in the following tables.
EAB and XLATE
The colors used for the presentation space display are returned. Colors can
be remapped; so the attribute colors are not the ones returned by the Copy
functions when XLATE and EAB are on at the same time.
EAD Double-byte character set attributes are returned as shown in the following
tables.
NOSO/SPACESO/SO
When NOSO is specified, it works as SPACESO. The size of the
presentation space is not changed.
The returned character attributes are defined in the following tables. The attribute
bit positions are in IBM format with bit 0 the left most bit in the byte.
3270 character attributes are returned from the host to the emulator. The following
table applies when EAB and NOXLATE are set.
5250 character attributes are returned from the host to the emulator. The following
table applies when EAB and NOXLATE are set.
The following table shows Personal Communications character color attributes. The
following table applies when EAB and XLATE are set.
60 Emulator Programming
Bit Position Meaning
0–3 Background character colors
0000 = Black
0001 = Blue
0010 = Green
0011 = Cyan
0100 = Red
0101 = Magenta
0110 = Brown (3270), Yellow (5250)
0111 = White
4–7 Foreground character colors
0000 = Black
0001 = Blue
0010 = Green
0011 = Cyan
0100 = Red
0101 = Magenta
0110 = Brown (3270), Yellow (5250)
0111 = White
1000 = Gray
1001 = Light blue
1010 = Light green
1011 = Light cyan
1100 = Light red
1101 = Light magenta
1110 = Yellow
1111 = White (high intensity)
If you want to copy only a portion of the host presentation space, use the Copy
Presentation Space to String (8) function.
To use this function, preallocate memory to receive the returned data string
parameter. The statements required to preallocate this memory vary depending on
the language in which your application is written. Refer to “Memory Allocation”
on page 8 for more information.
62 Emulator Programming
information to be displayed on the status bar, the status bar must be
configured. Refer to Quick Beginnings for information on configuring the
status bar. By the EXTEND_PS option, an EHLLAPI application can use the
same interface with Communication Manager EHLLAPI and valid
presentation space is extended when this condition occurs.
In a Unicode session, the characters in the host source presentation space are
translated into Unicode. Attribute bytes are normally translated into blanks.
The XLATE option (that can be specified using the Set Session Parameters (9)
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
Return Parameters: This function returns a data string and a return code.
Data String:
String containing the Unicode representation of the contents of
presentation space is returned
Return Code:
The following codes are defined:
Notes on Using This Function: The following options are supported in a Unicode
session for Copy Presentation Space (5) and function in the same way as in DBCS:
v NOATTRB
v ATTRB
In a Unicode session, the characters in the host source presentation space are
translated into Unicode. Attribute bytes are normally translated into blanks.
The XLATE option (that can be specified using the Set Session Parameters (9)
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
Return Parameters: This function returns a data string and a return code.
Data String:
String containing the Unicode representation of the contents of
presentation space is returned
Return Code:
The following codes are defined:
64 Emulator Programming
Return Code Explanation
9 A system error was encountered.
Notes on Using This Function: The following options are supported in a Unicode
session for Copy Presentation Space (5) and function in the same way as in SBCS:
v NOATTRB
v ATTRB
v NULLATTRB
v EAB
v NOEAB
v NOXLATE
v DISPLAY
v NODISPLAY
v BLANK
v NOBLANK
The Copy Presentation Space to String function is used to copy all or part of the
host-connected presentation space into a data string that you define in your
EHLLAPI application program.
The input PS position is the offset into the host presentation space. This offset is
based on a layout in which the upper-left corner (row 1/column 1) is location 1
and the bottom-right corner is 3564, which is the maximum screen size for the host
presentation space. The value of PS Position + (Length – 1) cannot exceed the
configured size of your host presentation space.
The Copy Presentation Space to String function translates the characters in the
host source presentation space into ASCII. Attribute bytes and other characters not
represented in ASCII normally are translated into blanks. If you do not want the
attribute bytes translated into blanks, you can override this translation with the
ATTRB option under the Set Session Parameters (9) function.
Prerequisite Calls
Connect Presentation Space (1).
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 8
Return Parameters
This function returns a data string and a return code.
Data String:
Contents of the host presentation space.
Return Code:
The following codes are defined:
v 5250 character attributes are returned from the host to the emulator. The
following table applies when EAB and NOXLATE are set.
v VT character attributes are returned from the host to the emulator. The
following table applies when EAB and NOXLATE are set.
68 Emulator Programming
v The following table shows Personal Communications character color
attributes. The following table applies when EAB and XLATE are set.
70 Emulator Programming
when the operator selects the SysReq key. Personal Communications
displays 25th row information on row 24, or on the status bar. For
information to be displayed on the status bar, the status bar must be
configured. Refer to Quick Beginnings for information on configuring the
status bar. By the EXTEND_PS option, an EHLLAPI application can use the
same interface with Communication Manager EHLLAPI and valid
presentation space is extended when this condition occurs.
In a Unicode session, the characters in the host source presentation space are
translated into Unicode. Attribute bytes are normally translated into blanks.
The XLATE option (that can be specified using the Set Session Parameters (9)
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
Return Parameters: This function returns a data string and a return code.
Data String:
String containing the Unicode data is returned
Return Code:
The following codes are defined:
Notes on Using This Function: The following options are supported in a Unicode
session for Copy Presentation Space to String and function in the same way as in
DBCS:
v NOATTRB
v ATTRB
v NULLATTRB
v EAB
v NOEAB
v NOXLATE
v DISPLAY
v NODISPLAY
v BLANK
v NOBLANK
In a Unicode session, the characters in the host source presentation space are
translated into Unicode. Attribute bytes are normally translated into blanks.
The XLATE option (that can be specified using the Set Session Parameters (9)
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
Return Parameters: This function returns a data string and a return code.
Data String:
Contents of the host presentation space.
72 Emulator Programming
Return Code:
The following codes are defined:
Notes on Using This Function: The following options are supported in a Unicode
session for Copy Presentation Space to String and function in the same way as in
SBCS:
v NOATTRB
v ATTRB
v NULLATTRB
v EAB
v NOEAB
v NOXLATE
v DISPLAY
v NODISPLAY
v BLANK
v NOBLANK
The Copy String to Field function transfers a string of characters into a specified
field in the host-connected presentation space. This function can be used only in a
field-formatted host presentation space.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 33
Data String String containing the data to be transferred to a target field
in the host presentation space.
Return Parameters
Return Code Explanation
0 The Copy String to Field function was successful.
1 Your program is not connected to a host session.
2 Parameter error or zero length for copy.
5 The target field was protected or inhibited, or incorrect data was
sent to the target field (such as a field attribute).
6 Copy was completed, but data is truncated.
7 The host presentation space position is not valid.
9 A system error was encountered.
24 Unformatted host presentation space.
Note: If the field at the end of the host presentation space wraps, wrapping
occurs when the end of the presentation space is reached.
3. The keyboard mnemonics (see Send Key (3) function) cannot be sent using the
Copy String to Field function.
4. The first byte of the data to be transferred is always placed at the beginning of
the field that contains the specified PS position.
5. DBCS Only: Double-byte characters can be included as a part of the string.
Note: PC400 does not add SO and SI to the string. When you write the strings,
including double-byte characters at the DBCS mixed field, generate SO
74 Emulator Programming
and SI and create the area where double-byte characters are written by
using the Send Key (3) function in advance.
If both single-byte and double-byte characters exist in a string, the data might
be truncated because the data length in EBCDIC is longer than in JISCII. In this
case, only the first byte or the second byte of the double-byte character is not
written.
If the last character in the original string is the first byte of the double-byte
character, the character is not written and not counted in the length.
A control character is converted from single-byte character to double-byte
character, or from double-byte character to single-byte character depending on
the field condition. A pair of NULL+Control Character between SO and SI is
treated as a double-byte control character. For example, the following strings
are copied into the single-byte character field or the double-byte character field:
STREOT option is not supported in a Unicode session. Please refer to “Set Session
Parameters (9)” on page 152 for details.
The XLATE option (that can be specified using the Set Session Parameters (9)
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
Return Parameters:
Notes on Using This Function: The following options are supported in a Unicode
session for Copy String to Field and function in the same way as in DBCS:
v STRLEN
v EAB
v NOEAB
v NOXLATE
v PUTEAB
v NOPUTEAB
STREOT option is not supported in a Unicode session. Please refer to “Set Session
Parameters (9)” on page 152 for details.
The XLATE option (that can be specified using the Set Session Parameters (9)
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
76 Emulator Programming
Standard Interface Enhanced Interface
Data String String containing the Unicode data to be transferred to a
target field in the host presentation space.
Length Length, in number of bytes, of the source Unicode string.
The length should be at least 2 bytes. If not, an error code
of 2 is returned.
Note: The EOT mode is not supported in a Unicode
session; therefore, length should be specified for proper
functioning of this function in a Unicode session.
PS Position Identifies the target field. This can be the PS position of any
byte within the target field. Copy always starts at the
beginning of the field.
Return Parameters:
Notes on Using This Function: The following options are supported in a Unicode
session for Copy String to Field and function in the same way as in SBCS:
v STRLEN
v EAB
v NOEAB
v NOXLATE
v PUTEAB
v NOPUTEAB
The Copy String to Presentation Space function copies an ASCII data string
directly into the host presentation space at the location specified by the PS position
calling parameter.
Prerequisite Calls
Connect Presentation Space (1)
Return Parameters
Return Code Explanation
0 The Copy String to Presentation Space function was successful.
1 Your program is not connected to a host session.
2 Parameter error or zero length for copy.
5 The target presentation space is protected or inhibited, or incorrect
data was sent to the target presentation space (such as a field
attribute byte).
6 The copy was completed, but the data was truncated.
7 The host presentation space position is not valid.
9 A system error was encountered.
78 Emulator Programming
5. The original data (the copied string) cannot exceed the size of the presentation
space.
6. DBCS Only: Double-byte characters can be included as a part of the string.
Note: PC400 does not add SO and SI to the string. When you write the strings,
including double-byte characters at the DBCS mixed field, generate SO
and SI and create the area where double-byte characters are written by
using the Send Key (3) function in advance.
If both single-byte and double-byte characters exist in a string, the data might
be truncated because the data length in EBCDIC is longer than in JISCII. If only
the first byte or the second byte of the double-byte character must be written
into the string, a blank is written.
If the last character in the original string is the first byte of the double-byte
character, the character is not written and not counted in the length.
If the character to be written into the last character of the target presentation
space is SO/SI or the first byte of the double-byte character, the character is not
written and truncated, and not counted in the length.
A control character is converted from single-byte character to double-byte
character, or from double-byte character to single-byte character depending on
the field condition. A pair of NULL+Control Character between SO and SI is
treated as a double-byte control character. For example, the following strings
are copied into the single-byte character field or the double-byte character field:
STREOT option is not supported in a Unicode session. Please refer to “Set Session
Parameters (9)” on page 152 for details.
Call Parameters:
Return Parameters:
Notes on Using This Function: The following options are supported in a Unicode
session for Copy String to Presentation Space and function in the same way as in
DBCS:
v STRLEN
v EAB
v NOEAB
v NOXLATE
v PUTEAB
v NOPUTEAB
STREOT option is not supported in a Unicode session. Please refer to “Set Session
Parameters (9)” on page 152 for details.
80 Emulator Programming
The XLATE option (that can be specified using the Set Session Parameters (9)
function) is not supported in a Unicode session. This means that even if this option
is issued, the EABs will not be translated to the PC color graphics adapter (CGA)
format.
Call Parameters:
Return Parameters:
Notes on Using This Function: The following options are supported in a Unicode
session for Copy String to Presentation Space and function in the same way as in
SBCS:
v STRLEN
v EAB
v NOEAB
v NOXLATE
v PUTEAB
v NOPUTEAB
The Copy Presentation Space to Clipboard translates the characters in the host
source presentation space into ASCII. Attribute bytes and other characters not
represented in ASCII normally are translated into blanks. If you do not want the
attribute bytes translated into blanks, you can override this translation with the
ATTRB option under the Set Sesssion Parameters (9) function.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 35.
Data String Preallocated target string the size of your host presentation
space. When the Set Session Parameters (9) function with
the EAB option is issued, the length of the data string must
be at least twice the length of the presentation space. DBCS
Only: When the EAD option is specified, the length of the
data string must be at least three times the length of the
presentation space. When both the EAB and EAD options
are specified, the length of the data string must be at least
four times the length of the presentation space.
Length Length of the target data string
PS Position Position within the host presentation space of the first byte
in your target data string.
Return Parameters
Return Code Explanation
0 The host presentation space contents were copied to the clipboard.
The target presentation space was active, and the keyboard was
unlocked.
1 Your program is not connected to a host session.
2 An error was made in specifying string length, or the sum of
(Length − 1) + PS position is greater than the size of the connected
host presentation space.
4 The host presentation space contents were copied to clipboard. The
host presentation space was waiting for host response.
5 The host presentation space was copied to clipboard. The keyboard
was locked.
7 The host presentation space position is not valid.
9 A system error was encountered.
82 Emulator Programming
Notes on Using This Function
1. An EAB can be returned when the Set Session Parameters (9) function EAB
option is used. EAB is related to each character in the presentation space and is
returned following each character.
2. DBCS Only: The Set Session Parameters (9) function EAD option is used with
this function to return a 2-byte EAD. If the EAD option is specified instead of
the EAB option, EAD is returned preceding each character. If both the EAB and
EAD options are specified, EAD is returned following the EAB. If the start
position of the copy is at the second byte in the double-byte character, or the
end position is at the first byte in the double-byte character, the bytes are
translated into blanks. If the EAD option is set to on, three bytes are returned
for each character. If both the EAB and EAD options are set to on, four bytes
are returned for each character.
3. The Copy Presentation Space to Clipboard function is affected by the
following options:
v ATTRB/NOATTRB/NULLATTRB
v EAB/NOEAB
v XLATE/NOXLATE
v BLANK/NOBLANK
v DISPLAY/NODISPLAY
v PUTEAB/NOPUTEAB
v EAD/NOEAD (for DBCS only)
v NOSO/SPACESO/SO (for DBCS only)
v EXTEND_PS/NOEXTEND_PS
4. The data string buffer is used in processing the data retrieved from
presentation space and copy to clipboard. If the data string buffer provided is
not large enough to hold the requested number of bytes, the copy ends
successfully (RC=0, 4, or 5) when the end of the data string buffer is reached.
As previously stated, the return of attributes by the various Copy (5, 8, and 34)
functions is affected by the Set Session Parameters (9) function. The involved
set session parameters have the following effect:
Set Session Parameter
Effect on the Copy Function
NOEAB and NOEAD
Attributes are not returned. Only text is copied from the presentation space to
the clipboard.
EAB and NOXLATE
Attributes are returned as defined in the following tables.
EAB and XLATE
The colors used for the presentation space display are returned. Colors can be
remapped, so the attribute colors are not the ones returned by the Copy
functions when XLATE and EAB are on at the same time.
EAD
Double-byte character set attributes are returned as shown in the following
tables. The returned character attributes are defined in the following tables. The
attribute bit positions are in IBM format with bit 0 the left most bit in the byte.
v 3270 character attributes are returned from the host to the emulator. The
following table applies when EAB and NOXLATE are set.
The Paste Clipboard to Presentation Space function pastes an ASCII data string
directly into the host presentation space at the location specified by the PS position
calling parameter.
Prerequisite Calls
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 36.
Data String String buffer that holds the data from clipboard to paste
into the host presentation space.
Length Length, in number of bytes to be pasted
PS Position Position in the host presentation space to begin the copy, a
value between 1 and the configured size of your host
presentation space.
Return Parameters
Return Code Explanation
0 The Paste Clipboard to Presentation Space function was
successful.
1 Your program is not connected to a host session.
2 Parameter error or zero length for copy
5 The target presentation space is protected or inhibited, or incorrect
data was sent to the target presentation space (such as a field
attribute byte).
6 The copy was completed, but the data was truncated.
7 The copy was completed, but the data was truncated.
9 A system error was encountered.
84 Emulator Programming
2. The string ends when an end-of-text (EOT) delimiter is encountered in the
string if EOT mode was selected using the Set Session Parameters (9) function.
(See “Set Session Parameters (9)” on page 147).
3. The original data (the copied string) cannot exceed the size of the presentation
space.
4. DBCS Only: Double-byte characters can be included as a part of the string.
Note: PC400 does not add SO and SI to the string. When you paste the strings,
including double-byte characters at the DBCS mixed field, generate SO and SI
and create the area where double-byte characters are written by using the Send
Key (3) function in advance. If both single-byte and double-byte characters
exist in a string, the data might be truncated because the data length in
EBCDIC is longer than in JISCII. If only the first byte or the second byte of the
double-byte character must be written into the string, a blank is written. If the
last character in the original string is the first byte of the double-byte character,
the character is not written and not counted in the length. If the character to be
written into the last character of the target presentation space is SO/SI or the
first byte of the double-byte character, the character is not written and
truncated, and not counted in the length. A control character is converted from
single-byte character to double-byte character, or from double-byte character to
single-byte character depending on the field condition. A pair of NULL+Control
Character between SO and SI is treated as a double-byte control character. For
example, the following strings are copied into the single-byte character field or
the double-byte character field:
The Disconnect from Structured Fields function drops the connection between the
emulation program and the EHLLAPI application. The EHLLAPI application must
disconnect from the emulation program before exiting from the system. The
EHLLAPI application should issue this function request if a previous Connect for
Structured Fields was issued.
Prerequisite Calls
Connect for Structured Fields (120)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 121
Data String See the following table
Length Must be 3 Must be 8
PS Position NA
Return Parameters
Return Code Explanation
0 The Disconnect from Structured Fields function was successful.
1 A specified host presentation space short session ID was not valid
or was not connected.
2 An error was made in specifying parameters.
9 A system error occurred.
40 Disconnected with asynchronous requests pending.
86 Emulator Programming
The Disconnect Presentation Space function drops the connection between your
EHLLAPI application program and the host presentation space. Also, if a host
presentation space is reserved using the Reserve (11) function, it is released upon
execution of the Disconnect Presentation Space function.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 2
Data String NA
Length NA
PS Position NA
Return Parameters
Return Code Explanation
0 The Disconnect Presentation Space function was successful.
1 Your program was not currently connected to the host presentation
space.
9 A system error was encountered.
Prerequisite Calls
Connect Window Services (101)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 102
Data String See the following table
Return Parameters
Return Code Explanation
0 The Disconnect Window Service function was successful.
1 Your program is not connected for Window Services.
9 A system error occurred.
Before exiting the application, you should request a Disconnect Window Service
function for all presentation spaces that have been connected for Presentation
Manager services. If the application exits with an outstanding connection for
window services, the subsystem cancels the outstanding connection.
EditKey Intercept
This feature enables you to intercept Edit keys in addition to the existing all
keystrokes and send them to a session in a Windows 32-bit environment.
Prerequisites
1. Map the Edit functions in the Customize Keyboard window (for example
Ctrl+C for edit copy function).
2. Call the Start Keystroke Intercept (50) EHLLAPI function with the call
parameter data string value set. The values are as follows:
88 Emulator Programming
Byte Position Contents
5 An option code character:
v D for AID keystrokes only
v L for all keystrokes
v E for all keystrokes and Edit keys
v M for requesting the asynchronous
message mode of the notification
(Windows only). If M is specified, a code
character D or L, or E must be placed in
position 13
6 to 8 Reserved
9 to 12 If M is specified in position 5, the window
handle of the window that receives the
message. The message is a non-zero return
value of RegisterWindowMessage (PCSHLL).
13 If M is specified in position 5, one of the
following values:
v D for AID keystrokes only
v L for all keystrokes
v E for all keystrokes and Edit keys
14 to 16 Reserved
3. To get the intercepted Edit keys, use the Get Key (51) EHLLAPI function. The
key mnemonic returned in the data string for the Edit keys will have M
(keystroke type mnemonic) at the 5th byte position. The next 4 bytes will have
one of the following Edit key mnemonics based on the Edit key intercepted:
4. To send Edit keys to the session, use the Send Key (3) EHLLAPI function. The
data string passed as the call parameter can specify the following Edit key
mnemonics:
Notes:
1. You do not have to call the Get Key (51) EHLLAPI function to use the Send
Key (3) function. For both Get Key (51) and Send Key (3) functions to handle
Edit keys, you must first call Start Keystroke Intercept (50) with the 5th byte
position set to E. If the 5th byte contains M, then position 13 must contain E.
2. The expected return values for Start Keystroke Intercept (50), Get Key (51) and
Send Key (3) functions have not changed.
3. Any prerequisites from the existing documentation should be followed as well
as the prerequisites documented here.
The Find Field Length function returns the length of a target field in the connected
presentation space. This function can be used to find either protected or
unprotected fields, but only in a field-formatted host presentation space.
This function returns the number of characters contained in the field identified
using the call PS position parameter. This includes all characters from the
beginning of the target field up to the character preceding the next attribute byte.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 32
Data String See the following table
Length NA NA
PS Position See note
Note: PS Position: Identifies the field within the host presentation space at which
to start the Find. It can be the PS position of any byte within the field in
which you desire the Find to start.
Code Explanation
�� or T� This field
P� The previous field, either protected or unprotected.
N� The next field, either protected or unprotected
NP The next protected field
90 Emulator Programming
Code Explanation
NU The next unprotected field
PP The previous protected field
PU The previous unprotected field
Return Parameters
This function returns a length and a return code.
Length:
The following lengths are valid:
Length Explanation
=0 When return code = 28, field length is 0. When return code = 24,
host presentation space is not field formatted.
>0 Required field length in the host presentation space.
Return Code:
The following codes are defined:
The Find Field Position function returns the beginning position of a target field in
the host-connected presentation space. This function can be used to find either
protected or unprotected fields but only in a field-formatted host presentation space.
Prerequisite Calls
Connect Presentation Space (1)
Note: PS Position: Identifies the field within the host presentation space at which
to start the Find. It can be the PS position of any byte within the field in
which you want the Find to start.
Code Explanation
�� or T� This field
P� The previous field, either protected or unprotected
N� The next field, either protected or unprotected
NP The next protected field
NU The next unprotected field
PP The previous protected field
PU The previous unprotected field
Return Parameters
This function returns a length and a return code.
Length:
The following lengths are valid:
Length Explanation
=0 When return code = 28, field length is 0. When return code = 24,
host presentation space is not field-formatted.
>0 Relative position of the requested field from the origin of the host
presentation space. This position is defined to be the first position
after the attribute byte.
Return Code:
The following codes are defined:
92 Emulator Programming
Return Code Explanation
24 No such field was found.
28 Field length of 0 bytes.
Prerequisite Calls
Allocate Communications Buffer (123)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 124
Data String See the following table
Length Must be 6 Must be 8
PS Position NA
Return Parameters
Return Code Explanation
0 The Free Communications Buffer function was successful.
2 An error was made in specifying parameters.
9 A system error occurred.
41 The buffer is in use.
The Get Key function lets your EHLLAPI application program retrieve a keystroke
from a session specified by the Start Keystroke Intercept (50) function and either
process, accept, or reject that keystroke. By placing this function in a loop, you can
use it to intercept a string.
Prerequisite Calls
Start Keystroke Intercept (50)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 51
Data String See the following table
Length 8 12
PS Position NA
Return Parameters
This function returns a data string and a return code.
Data String:
See the following table:
Byte Definition
Standard Enhanced
94 Emulator Programming
Byte Definition
1 1 One of the following values:
v A 1-character presentation space short name (PSID)
v A blank or null indicating a function call for the
host-connected presentation
2–4 Reserved
2 5 An option code character, one of the following characters:
v A for ASCII returned
v M for keystroke mnemonic
v S for special mnemonic
3–8 6–11 These 6 bytes of the preallocated buffer space are used
internally to enqueue and dequeue keystrokes. Possible
combinations include:
v Byte 3 contains an ASCII character and byte 4 contains
X'00'
v Bytes 3 and 4 contain a double-byte character
v Byte 3 contains the escape character (either @ or another
character specified using the ESC=c option of function 9)
and byte 4 contains a 1-byte abbreviation for a function.
(See “ASCII Mnemonics” on page 17)
v Bytes 5 through 8 might be similar to bytes 3 and 4 if
the returned ASCII mnemonic is longer than 2 bytes
(for example, if the ASCII mnemonic represents Attn
@A@Q, byte 5 contains @ and byte 6 contains Q). If not
used, bytes 5 through 8 are set to zero (X'00').
For clarification, some examples of returned data strings are provided below:
Note: The @ symbol is the default escape character. The value of the escape
character can be set to any keystroke represented in ASCII by using the
ESC=c option of the Set Session Parameters (9) function. If the escape
character has been changed to another character using this option, the @
symbol in the following examples is replaced by the other character.
16-Bit Interface
EAt E is the presentation space short name. The keystrokes are returned as
ASCII (A), and the returned key is the lowercase letter t. (Bytes 4–8 =
X'00').
EM@2 E is the presentation space short name. The keystrokes are returned as
mnemonics, and the returned key is PF2 (Bytes 5–8 = X'00').
32-Bit Interface
E���At E is the presentation space short name. The keystrokes are returned as
ASCII (A), and the returned key is the lowercase letter t. (Bytes 7–11 =
X'00').
E���M@2
E is the presentation space short name. The keystrokes are returned as
mnemonics, and the returned key is PF2 (Bytes 8–11 = X'00').
Return Code:
The following codes are valid:
96 Emulator Programming
The session option ESC is not supported in a Unicode session; using this option
you cannot set a Unicode character as an ESC character. Use the default ESC
character @ in a Unicode session. See “Set Session Parameters (9)” on page 152 for
details.
Call Parameters:
Byte Definition
Standard Enhanced
1 1 One of the following values:
v A 1-character presentation space short name (PSID)
v A blank or null indicating a function call for the
host-connected presentation
2–4 Reserved
2–8 5–11 Blanks that hold space for the symbolic representation of
the requested data
12 Reserved
Return Parameters: This function returns a data string and a return code.
Data String:
See the following table for 32–bit interface:
Byte Definition
1 One of the following values:
v A 1-character presentation space short name (PSID)
v A blank or null indicating a function call for the host-connected
presentation
2–4 Reserved
5 U is the option code character for a Unicode session.
6–11 The definition of these bytes is similar to the DBCS session; the only
difference is that the Unicode character value is stored in bytes 6 and 7
when the option code character is U. In a DBCS session, the ASCII
character value is stored in byte 3 and byte 4 contains 0X'00' when the
option code character is A.
Return Code:
The following codes are valid:
The session option ESC is not supported in a Unicode session; using this option
you cannot set a Unicode character as an ESC character. Use the default ESC
character @ in a Unicode session. See “Set Session Parameters (9)” on page 152 for
details.
Call Parameters:
Byte Definition
Standard Enhanced
1 1 One of the following values:
v A 1-character presentation space short name (PSID)
v A blank or null indicating a function call for the
host-connected presentation
2–4 Reserved
2–8 5–11 Blanks that hold space for the symbolic representation of
the requested data
12 Reserved
Return Parameters: This function returns a data string and a return code.
Data String:
See the following table for 32–bit interface:
98 Emulator Programming
Byte Definition
1 One of the following values:
v A 1-character presentation space short name (PSID)
v A blank or null indicating a function call for the host-connected
presentation
2–4 Reserved
5 U is the option code character for a Unicode session.
6–11 The definition of these bytes is similar to the SBCS session, the only
difference is that the Unicode character value is stored in bytes 6 and 7
when the option code character is U. In a DBCS session, the ASCII
character value is stored in byte 3 and byte 4 contains 0X'00' when the
option code character is A.
Return Code:
The following codes are valid:
Each asynchronous request requiring the Get Request Completion function will
return a unique ID from the asynchronous request. The application must save this
ID. This ID is the identification used by the Get Request Completion function to
identify the desired request. The user has three request options using this function:
1. The application can query or wait for a specific asynchronous function request
by supplying the request ID of that function and a nonblank session short
name.
Prerequisite Calls
Connect Structured Fields (120) and Allocate Communications Buffer (123)
and
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 125
Data String See the following table
Length Must be 14 Must be 24
PS Position NA
The Get Request Completion function behaves differently depending upon the
second character of the parameter string, which is one of the following characters:
N Nowait option: If a specific request ID was supplied and the function has
completed, control will be returned to the application with a return code of
zero and a completed data string as defined in “Return Parameters” on
page 101. If a request ID of zero was supplied and any eligible
asynchronous function has completed, control will be returned to the
application with a return code of zero and a completed data string as
defined in “Return Parameters” on page 101.
W Wait option: If a specific request ID was supplied and the function has not
completed, the call will wait until the function has completed before
returning to the application. If the supplied request ID was zero and no
eligible asynchronous function has completed, the call will wait until a
function completes before returning to the calling application. On return,
the return code value will be zero and the data string will be completed as
defined in “Return Parameters” on page 101.
The Lock Presentation Space API function allows the application to obtain or
release exclusive control of the presentation space window over other Windows
32–bit applications. While locked, no other application can connect to the
presentation space window.
Successful processing of this function with the Lock causes EHLLAPI presentation
space window functions requested from other EHLLAPI applications to be queued
until the requesting application unlocks the presentation space. Requests from the
locking application are processed normally.
Prerequisite Calls
Connect to Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 60
Data String See the following table
Length Must be 3 Must be 8
PS Position NA
Return Parameters
Return Code Explanation
0 The Lock Presentation Space API function was successful.
1 An incorrect host presentation space short session ID was specified
or was not connected.
2 An error was made in specifying parameters.
These queued requests are not serviced until the lock is removed. When the lock is
removed, the queued requests are processed in first-in-first-out (FIFO) order.
EHLLAPI functions not listed are run as if there was no lock. The requesting
application unlocks the presentation space window by one of the following
methods:
v Disconnecting from the presentation space while still owning the Lock.
v Issuing the Reset System (21) function while still owning the Lock.
v Stopping the application while still owning the Lock.
v Stopping the session.
v Successfully issuing the Lock Presentation Space API with the Unlock option.
Before exiting the application, you should unlock any presentation space windows
that have been locked with the Lock Presentation Space API function. If the
application exits with outstanding locks, or a Reset System (21), or Disconnect
Presentation Space (2) function is issued, the locks are released.
It is recommended that applications lock the presentation space only for short
periods of time and only when exclusive use of the presentation space is required.
The Lock Window Services API function allows the application to obtain or
release exclusive control of the presentation space window over other Windows
32-bit applications. While locked, no other application can connect to the
presentation space window.
Successful processing of this function with the Lock causes EHLLAPI presentation
space window functions requested from other EHLLAPI applications to be queued
until the requesting application unlocks the presentation space. Requests from the
locking application are processed normally.
Prerequisite Calls
Connect Window Services (101)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 61
Data String See the following table.
Length Must be 3 Must be 8
PS Position NA
Return Parameters
Return Code Explanation
0 The Lock Window Services API function was successful.
These queued requests are not serviced until the lock is removed. When the lock is
removed, the queued requests are processed in first-in-first-out (FIFO) order.
The requesting application unlocks the presentation space window by one of the
following methods:
v Successfully issuing the Lock Window Services API with the UNLOCK option.
v Disconnecting from the presentation space while still owning the Lock.
v Issuing the Reset System (21) function while still owning the Lock.
v Stopping the application while still owning the Lock.
v Stopping the session.
Before exiting the application, you should Unlock any presentation space windows
that have been locked with the Lock Window Services API function. If the
application exits with outstanding locks, the subsystem releases the locks.
It is recommended that applications lock the presentation space only for short
periods of time and only when exclusive use of the presentation space is required.
Pause (18)
3270 5250 VT
Yes Yes Yes
The Pause function waits for a specified amount of time. It should be used in place
of timing loops to wait for an event to occur. A Pause function can be ended by a
host event if a prior Start Host Notification (23) function has been called and the
IPAUSE option is selected.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 18
Return Parameters
Return Code Definition
0 The wait duration has expired.
9 An internal system error was encountered. The time results are
unpredictable.
26 The host session presentation space or OIA has been updated. Use
the Query Host Update (24) function to get more information.
The Post Intercept Status function informs the Personal Communications emulator
that a keystroke obtained through the Get Key (51) function was accepted or
rejected. When the application rejects a keystroke, the Post Intercept Status
function issues a beep.
Prerequisite Calls
Start Keystroke Intercept (50)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 52
Data String See the following table
Length Must be 2 Must be 8
PS Position NA
Byte Definition
Standard Enhanced
1 1 One of the following values:
v The 1-letter short name of the presentation space.
v A blank or null indicating a function call for the
host-connected presentation space.
2–4 Reserved
2 5 One of the following characters:
v A for accepted keystroke.
v R for rejected keystroke.
6–8 Reserved.
Return Parameters
Return Code Explanation
0 The Post Intercept Status function was successful.
1 An incorrect presentation space was specified.
2 An incorrect session option was specified.
8 No prior Start Keystroke Intercept (50) function was called for this
presentation space ID.
9 A system error was encountered.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 45.
Data String 8 bytes long character string.
Length 8 is implied.
PS Position Identifies the target. This can be the PS position of any byte
within the target field.
Byte Definition
1–8 Reserved
Return Parameters
This function returns a data string and a return code.
Data String:
The function returns the following data string.
Byte Definition
1–6 Reserved
7–8 Two 8–bit unsigned characters that return:
v R if field is RTL and L if field is LTR.
v U if field is upper case and L if field is a normal case
field.
Return Code:
The following return codes are defined:
The Query Close Intercept function allows the application to determine if the close
option was selected.
Prerequisite Calls
Start Close Intercept (41)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 42
Data String See the following table.
Length Must be 1 Must be 4
PS Position NA
Byte Definition
Standard Enhanced
1 1 1-character short session ID of the host presentation
space, or a blank or null indicating request for querying
the host-connected session
2–4 Reserved
Return Parameters
Return Code Explanation
0 A close intercept event did not occur.
1 The presentation source was not valid.
2 An error was made in specifying parameters.
8 No prior Start Close Intercept (41) function was called for this host
presentation space.
9 A system error occurred.
12 The session stopped.
26 A close intercept occurred since the last query close intercept call.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 122
Data String See the following table
Length Must be 9 Must be 20
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
2–3 5–8 16- or 32-bit field for the optimum supported inbound
buffer size (Returned value)
4–5 9–12 16- or 32-bit field for the maximum supported inbound
buffer size (Returned value)
6–7 13–16 16- or 32-bit field for the optimum supported outbound
buffer size (Returned value)
8–9 17–20 16- or 32-bit field for the maximum supported outbound
buffer size (Returned value)
Return Parameters
Return Code Explanation
0 The Query Communications Buffer Size function was successful.
1 A specified host presentation space short session ID was not valid
or was not connected.
2 An error was made in specifying parameters.
9 A system error occurred.
10 The function was not supported by the emulation program.
The Query Communication Event function lets the EHLLAPI program determine
whether any communication events have occurred.
Prerequisite Calls
Start Communication Notification (80)
Call Parameters
Enhanced Interface
Function Number Must be 81
Data String 1-character short name of the host presentation space or a blank or
null indicating request for updates to the host-connected
presentation space
Length 4 is implied
PS Position NA
Byte Definition
1 A 1-character presentation space short name (PSID)
2-4 Reserved
Return Parameters
Return Code Definition
0 The function was successful
1 An incorrect PSID was specified
The Query Cursor Location function indicates the position of the cursor in the
host-connected presentation space by returning the cursor position.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 7
Data String NA
Length NA
PS Position NA
Return Parameters
This function returns a length and a return code.
Length:
Host presentation space position of the cursor.
Return Code:
The following codes are defined:
The Query Field Attribute function returns the attribute byte of the field
containing the input host presentation space position. This information is returned
in the returned length parameter.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 14.
Data String NA.
Length NA.
PS Position Identifies the target. This can be the PS position of any byte
within the target field.
Return Parameters
This function returns a length and a return code.
Length:
The attribute value if the screen is formatted, or 0 if the screen is
unformatted.
Return Code:
The following codes are defined:
The Query Host Update function lets the programmed operator determine if the
host has updated the host presentation space or OIA because:
v The Start Host Notification (23) function was called (on first call to the Query
Host Update function only)
v The previous call to the Query Host Update function (for all calls to the Query
Host Update function except the first).
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 24
Data String 1-character short name of the host presentation space, or a
blank or null indicating request for updates to
host-connected presentation space
Length 1 is implied 4 is implied
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
Return Parameters
Return Code Definition
0 No updates have been made since the last call.
1 An incorrect host presentation space was specified.
8 No prior Start Host Notification (23) function was called for the
host presentation space ID.
9 A system error was encountered.
21 The OIA was updated.
22 The presentation space was updated.
23 Both the OIA and the host presentation space were updated.
44 Printing has completed in the printer session.
Prerequisite Calls
There are no prerequisite calls for this function.
Return Parameters
This function returns a data string and a return code.
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
2–9 5–12 Session long name (same as profile name; or, if profile
not set, same as short name)
10 13
Session Type
D 3270 display
E 3270 printer
F 5250 display
G 5250 printer
H ASCII VT
11 14 Session characteristics expressed by a binary number
including the following session-characteristics bits
Bit 0 EAB 0: Session has the basic attribute. 1:
Session has the extended attribute
Bit 1 PSS 0: Session does not support the
programmed symbols 1: Session supports the
programmed symbols
Bits 2–7
Reserved
12–13 15–16 Number of rows in the host presentation space,
expressed as a binary number
14–15 17–18 Number of columns in the host presentation space,
expressed as a binary number
16–17 19–20 Host code page expressed as a binary number
18 Reserved
Return Code:
The following codes are defined:
The Query Sessions function returns a 16-byte (12-byte for standard interface) data
string describing each host session.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Function Description
Standard Interface Enhanced Interface
Function Number Must be 10
Data String Preallocated string of 16n bytes long (12n for 16-bit) (n
=number of sessions) or more
Length 12n bytes 16n bytes
PS Position NA
Note: When the length is not matched to the number of sessions, the return code
is 2.
Return Parameters
This function returns a data string, a length, and a return code.
Data String:
The returned data string is 16n bytes long (12n for standard interface),
where n is the number of host sessions. The descriptors are concatenated
into the data string and each session type, and presentation space size of a
host session.
The format of each 16-byte (12-byte for standard interface) session
descriptor is as follows:
Byte Definition
Standard Enhanced
Length:
The number of host sessions started.
Return Code:
The following codes are defined:
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 20
Data String Preallocated string of 35 36 bytes
bytes
Length Must be 35 Must be 36
PS Position NA
Return Parameters
This function returns a data string and a return code.
Data String:
A data string of 35 bytes (for 16–bit) or 36 bytes (for 32–bit) is returned.
The bytes are defined as follows:
Byte Definition
Standard Enhanced
1 1 EHLLAPI version number
2–3 2–3 EHLLAPI level number
4–9 4–9 Reserved
10–12 10–12 Reserved
13 13 Hardware base, U=Unable to determine
14 14 Program type, where P=IBM Personal Communications
15–16 15–16 Reserved
17–18 17–18 Personal Communications version/level as a 2-byte
ASCII value
19 19 Reserved
20–23 20–23 Reserved
24–27 24–27 Reserved
28–29 28–29 Reserved
30 Reserved
30–31 31–32 NLS type expressed as a 2-byte binary number
33–35 34–36 Reserved
Return Code
The following codes are defined:
The Query Window Coordinates function requests the coordinates for the window
of a presentation space. The window coordinates are returned in pels.
Prerequisite Calls
Connect Window Services (101)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 103
Data String 1-character short session ID of the host presentation space
Length 17 is implied 20 is implied
PS Position NA
Byte Definition
Standard Enhanced
1 1 One of the following values:
v A 1-character presentation space short name (PSID)
v A blank or null indicating a function call for the
current connection presentation space
2–4 Reserved
2-17 5–20 Reserved
Return Parameters
This function returns a data string and a return code.
Byte Definition
Standard Enhanced
Return Code:
The following codes are defined:
The Read Structured Fields function allows an application to read structured field
data from the host application. If the call specifies S (for Synchronous), the
application does not receive control until the Read Structured Fields is completed.
If the call specifies A (for Asynchronous), the application receives control
immediately after the call. If the call specifies M (for Asynchronous, message
mode), the application receives control immediately after the call. The application
can wait for the message. In any case (S, A, or M), the application provides the
buffer address in which the data from the host is to be placed.
The return code field in the parameter list might not contain the results of the
requested I/O. If the return code is not 0, the request failed. The application must
take the appropriate action based on the return code.
If the return code for this request is 0, the application must use the request ID
returned with this function call to issue the Get Request Completion function call
Prerequisite Calls
Connect for Structured Fields (120) and Allocate Communication Buffer (123)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 126
Data String See the following table
Length 8, 10 or 14 20
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID).
2–4 Reserved.
2 5 S or A or M
S= Synchronous. Control is not returned to the
application until the read is satisfied.
A= Asynchronous. Control is returned immediately
to the application, can wait for the event object.
M= Asynchronous. Control is returned immediately
to the application, can wait for the message.
6 Reserved.
3–4 7–8 2-byte destination/origin ID.
5–8 9–12 4-byte address of the buffer into which the data is to be
read. The buffer must be obtained using the Allocate
Communications Buffer (123) function.
9–10 13–16 Reserved.
11–12 17–20 When M is specified in position 2 the window handle of
the window that receives the message should be set. The
message is a return value of RegisterWindowMessage
(“PCSHLL”)(not equal 0).
13–14 The data in these positions is ignored by EHLLAPI.
However, no error is caused if the migrating program
has data in these positions. This data is accepted to
provide compatibility with migrating applications.
Return Parameters
This function returns a data string and a return code.
Byte Definition
Standard Enhanced
9–10 13–14 2-byte function request ID. It is used by the Get Request
Completion (125) function to determine the completion
of this function call.
15–16 Reserved.
17–20 4-byte value in which the event object address is
returned by EHLLAPI. The application can wait for this
event object. When the event object is cleared, the
application must issue the Get Request Completion
(125) function call (32-bit only).
Note: A event object address is returned for each successful asynchronous request.
The event object should not be used again. A new event object is returned
for each request and is valid for only the duration of that request.
Data String:
If “M” (asynchronous message mode) is specified in position 5 (2 for 16-bit
applications) and the function is completed successfully, the following data
string is returned:
Byte Definition
9–10 13–14 A 2-byte function request ID. It is used by the Get Request
Completion (125) function to determine the completion of
this function call.
15–16 Reserved.
11–12 17–18 Task ID of asynchronous message mode.
19–20 Reserved.
The structured field data contains the application structured fields received from
the host. Structured field headers are removed by the EHLLAPI before the
structured field data reaches the application.
Bytes 0 through 7 are the buffer header. These first 8 bytes are used by the
emulation program. The user section of the buffer begins with offset 8. Bytes 8 and
9 contain the number of bytes in the first structured field (a structured field
message can contain multiple structured fields), including 2 bytes for bytes 8 and
9. Bytes 8 through m+7 are used for the structured field message received from the
host (which could contain multiple structured fields).
These are used to complete the asynchronous Read Structured Fields call.
These are used to complete the asynchronous Read Structured Fields call.
The Receive File function is used to transfer a file from the host session to the
workstation session. It is used the same way as the RECEIVE command is used in
the PC/3270. The Receive File function can be called by an EHLLAPI application
program.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 91.
Data String Refer to the examples.
Length Length, in number of bytes, of the data string. Overridden if
in EOT mode.
Following are examples of the data strings for a single-byte character set (SBSC):
3270 Session
v To receive the file from the VM/CMS host system:
pc_filename [id:]fn ft [fm] [(option]
v To receive the file from the MVS™/TSO host system:
pc_filename[id:]dataset[(member)] [/password] [option]
v To receive the file from the CICS® host system:
pc_filename [id:]host_filename [(option]
5250 Session
v To receive the file from the iSeries, eServer i5, or System i5 host system:
pc_filename [id:]library file member [option]
Following are examples of the data strings for a double-byte character set (DBCS):
3270 Session
v To receive the file from the VM/CMS host system:
pc_filename [id:]fn ft [fm] [(option]
v To receive the file from the MVS/TSO host system:
pc_filename [id:]dataset[(member)] [/password]
[(option]
v To receive the file from the CICS host system:
pc_filename [id:]host_filename [(option]
Note: Parameters within [ ] are optional. Available options are listed below.
Other options specified will be passed to the host transfer program. The file transfer
program on the host side either uses them, ignores them, or returns an error. Consult the
host transfer program documentation to see a complete list of the options supported.
Return Parameters
Return Code Explanation
2 Parameter error or you have specified a length that is too long
(more than 255 bytes) for the EHLLAPI buffer. The file transfer
was unsuccessful.
3 File transfer complete.
4 File transfer complete with segmented records.
9 A system error was encountered.
27 File transfer terminated because of either a Cancel button or the
timeout set by the Set Session Parameter (9) function.
101 File transfer was successful (transfer to/from CICS).
If you receive return code 2 or 9, there is a problem with the system or with the
way you specified your data string.
Other return codes can also be received, which relate to message numbers
generated by the host transfer program. For transfers to a CICS host transfer
program, subtract 100 from the return code to give you the numeric portion of the
message. For example, a return code of 101 would mean that the message number
INW0001 was issued by the host. For other host transfer programs, just use the
return code as the numerical part of the message. For example, a return of 34
would mean that message TRANS34 was issued by the host transfer program. The
documentation for your host transfer program should give more information about
the meanings of the specific messages.
Operating system error codes reported by EHLLAPI are greater than 300. To
determine the error code, subtract 300 and refer to the operating system
documentation for return codes.
Release (12)
3270 5250 VT
Yes Yes Yes
The Release function unlocks the keyboard that is associated with the host
presentation space reserved using the Reserve (11) function.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 12
Data String NA
Length NA
PS Position NA
Return Parameters
Return Code Explanation
0 The Release function was successful.
1 Your program is not connected to a host session.
9 A system error was encountered.
Reserve (11)
3270 5250 VT
Yes Yes Yes
The Reserve function locks the keyboard that is associated with the host-connected
presentation space to block input from the terminal operator.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 11
Data String NA
Length NA
PS Position NA
Return Parameters
Return Code Explanation
0 The Reserve function was successful.
1 Your program is not connected to a host session.
5 Presentation space cannot be used.
9 A system error was encountered.
The Reset System function reinitializes EHLLAPI to its starting state. The session
parameter options are reset to their defaults. Event notification is stopped. The
reserved host session is released. The host presentation space is disconnected.
Keystroke intercept is disabled.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 21
Data String NA
Length NA
PS Position NA
Return Parameters
Return Code Definition
0 The Reset System function was successful.
1 EHLLAPI is not loaded.
9 A system error was encountered.
The Search Field function examines a field within the connected host presentation
space for the occurrence of a specified string. If the target string is found, this
function returns the decimal position of the string numbered from the beginning of
the host presentation space. (For example, in a 24-row by 80-column presentation
space, the row 1, column 1 position is numbered 1 and the row 5, column 1
position is numbered 321.)
This function can be used to search either protected or unprotected fields, but only
in a field-formatted host presentation space.
Note: If the field at the end of the host presentation space wraps, wrapping occurs
when the end of the presentation space is reached.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 30.
Return Parameters
This function returns a length and a return code.
Length:
The following codes are defined:
Length Explanation
=0 The string was not found.
>0 The string was found at the indicated host presentation space
position.
Return Code:
The following codes are defined:
STREOT option is not supported in a Unicode session. Please see “Set Session
Parameters (9)” on page 152 for details.
Call Parameters:
Length Explanation
=0 The string was not found.
>0 The string was found at the indicated host presentation space
position.
Notes on Using This Function: The following options are supported in a Unicode
session for Search Field and function in the same way as in DBCS:
v STRLEN
v SRCHALL
v SRCHFROM
v SRCHFRWD
v SRCHBKWD
STREOT option is not supported in a Unicode session. Please see “Set Session
Parameters (9)” on page 152 for details.
Call Parameters:
Return Code:
The following codes are defined:
Notes on Using This Function: The following options are supported in a Unicode
session for Search Field and function in the same way as in SBCS:
v STRLEN
v SRCHALL
v SRCHFROM
v SRCHFRWD
v SRCHBKWD
The Search Presentation Space function lets your EHLLAPI program examine the
host presentation space for the occurrence of a specified string.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 6.
Data String Target string for search.
Length Length of the target data string. Overridden in EOT mode.
PS Position Position within the host presentation space where the search
is to begin (SRCHFRWD option) or to end (SRCHBKWD
option). Overridden in SRCHALL (default) mode.
Length Explanation
=0 The string was not found.
>0 The string was found at the indicated host presentation space
position.
Return Code:
The following codes are defined:
STREOT option is not supported in a Unicode session. Please refer to “Set Session
Parameters (9)” on page 152 for details.
Call Parameters:
Length Explanation
=0 The string was not found.
>0 The string was found at the indicated host presentation space
position.
Return Code:
The following codes are defined:
Notes on Using This Function: The following options are supported in a Unicode
session for Search Presentation Space (6) and function in the same way as in
DBCS:
v STRLEN
v SRCHALL
v SRCHFROM
v SRCHFRWD
v SRCHBKWD
STREOT option is not supported in a Unicode session. Please refer to “Set Session
Parameters (9)” on page 152 for details.
Call Parameters:
Length Explanation
=0 The string was not found.
>0 The string was found at the indicated host presentation space
position.
Return Code:
The following codes are defined:
Notes on Using This Function: The following options are supported in a Unicode
session for Search Presentation Space (6) and function in the same way as in
SBCS:
v STRLEN
v SRCHALL
v SRCHFROM
v SRCHFRWD
v SRCHBKWD
The Send File function is used to transfer a file from the workstation session
where EHLLAPI is running to a host session.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 90.
Data String Refer to the examples.
Length Length of the target data string. Overridden in EOT mode.
PS Position Must be 0.
3270 Session
v To send the file to the VM/CMS host system:
pc_filename [id:]fn ft [fm] [(option]
v To send the file to the MVS/TSO host system:
pc_filename [id:]dataset[(member)] [/password] [option]
v To send the file to the CICS host system:
pc_filename [id:]host_filename [(option]
5250 Session
3270 Session
v To send the file to the VM/CMS host system:
pc_filename [id:]fn ft [fm] [(option]
v To send the file to the MVS/TSO host system:
pc_filename [id:]dataset[(member)] [/password]
[(option]
v To send the file to the CICS host system:
pc_filename [id:]host_filename [(option]
5250 Session
v To send the file to the iSeries, eServer i5, or System i5 host system:
pc_filename [id:]library file member [option]
Note: Parameters within [ ] are optional. Available options are listed below. For
more information about the options, refer to Administrator's Guide and
Reference.
JISCII is valid in a DBCS session for Japan only and ASCII is valid for all other SBCS and
DBCS sessions.
Note: Time, if specified, overrides the value in Set Session parameters.
Note:
Other options specified will be passed to the host transfer program. The file transfer
program on the host side either uses them, ignores them, or returns an error. Consult the
host transfer program documentation to see a complete list of the options supported.
Return Parameters
Return Code Explanation
2 Parameter error or you have specified a length that is too long
(more than 255 bytes) for the EHLLAPI buffer. The file transfer
was unsuccessful.
3 File transfer complete.
4 File transfer complete with segmented records.
If you receive return code 2 or 9, there is a problem with the system or with the
way you specified your data string.
Other return codes can also be received which relate to message numbers
generated by the host transfer program. For transfers to a CICS host transfer
program, subtract 100 from the return code to give you the numeric portion of the
message. For example, a return code of 101 would mean that the message number
INW0001 was issued by the host. For other host transfer programs, just use the
return code as the numerical part of the message. For example, a return of 34
would mean that message TRANS34 was issued by the host transfer program. The
documentation for your host transfer program should give more information about
the meanings of the specific messages.
Operating system error codes reported by EHLLAPI are greater than 300. To
determine the error code, subtract 300 and refer to the operating system
documentation for return codes.
The Send Key function is used to send either a keystroke or a string of keystrokes
to the host presentation space.
You define the string of keystrokes to be sent with the calling data string
parameter. The keystrokes appear to the target session as though they were entered
by the terminal operator. You can also send all attention identifier (AID) keys such
as Enter and so on. All host fields that are input protected or are numeric only
must be treated accordingly.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 3.
Return Parameters
Return Code Explanation
0 The keystrokes were sent; status is normal.
1 Your program is not connected to a host session.
2 An incorrect parameter was passed to EHLLAPI.
4 The host session was busy; all of the keystrokes could not be sent.
5 Input to the target session was inhibited or rejected; all of the
keystrokes could not be sent.
9 A system error was encountered.
Keyboard Mnemonics
The keyboard mnemonics provide the ASCII characters representing the special
function keys of the keyboard in the workstation. The abbreviation codes make the
mnemonics for special keys easy to remember. An alphabetic key code is used for
the most common keys. For example, the Clear key is C, and the Tab key is T.
Table 10 shows the mnemonics using the combination @A and @number or @A and
@alphabetic lowercase (a–z) key.
Table 10. Mnemonics with @A and @ Lowercase Alphabetic Characters
Mnemonic Meaning 3270 5250 VT
@A@9 Reverse Video Yes Yes No
@A@b Underscore Yes No No
@A@c Reset Reverse Yes No No
Video
@A@d Red Yes No No
@A@e Pink Yes No No
@A@f Green Yes No No
@A@g Yellow Yes No No
@A@h Blue Yes No No
@A@i Turquoise Yes No No
@A@j White Yes No No
@A@l Reset Host Yes No No
Colors
@A@t Print (Personal Yes Yes No
Computer)
@A@y Forward Word Yes Yes No
Tab
@A@z Backward Word Yes Yes No
Tab
Table 12 shows the mnemonics using the combination @S , @W, and @alphabetic
lowercase.
Table 12. Mnemonics with @S (Shift), @W (Edit) and @ Alphabetic Characters
Mnemonic Meaning 3270 5250 VT
@S@E Print No Yes No
Presentation
Space on Host
@S@x Dup Yes Yes No
@S@y Field Mark Yes Yes No
@W@C Edit Copy Yes Yes Yes
@W@D Edit Clear Yes Yes Yes
@W@E Edit Copy Yes Yes Yes
Append
@W@L Edit Copy Link Yes Yes Yes
@W@N Edit Paste Next Yes Yes Yes
@W@V Edit Paste Yes Yes Yes
@W@X Edit Cut Yes Yes Yes
@W@Z Edit Undo Yes Yes Yes
DBCS Only: Table 13 shows the mnemonics using the combination @X and
@number or @alphabetic lowercase (a–z).
Table 13. Mnemonics Using @X and @Alphabetic Lowercase (For DBCS Only)
Mnemonic Meaning 3270 5250 VT
@X@1 Display SO/SI Yes Yes No
@X@5 Generate SO/SI No Yes No
@X@6 Display No Yes No
Attribute
@X@7 Forward No Yes No
Character
@X@c Split Vertical Bar No Yes No
VT Only: Table 14 on page 146 shows the mnemonics using the combination @M
and @number or @alphabetic lowercase (a-z)
STREOT option is not supported in a Unicode session. Please see “Set Session
Parameters (9)” on page 152 for details.
The session option ESC is not supported in a Unicode session; using this option,
you cannot set a Unicode character as an ESC character. Use the default ESC
character @ in a Unicode session. Please see “Set Session Parameters (9)” on page
152 for details.
Call Parameters:
Return Parameters:
The string length should indicate the number of Unicode characters and not the
number of ANSI characters to be sent.
STREOT option is not supported in a Unicode session. Please see “Set Session
Parameters (9)” on page 152 for details.
The session option ESC is not supported in a Unicode session; using this option,
you cannot set a Unicode character as an ESC character. Use the default ESC
character @ in a Unicode session. Please see “Set Session Parameters (9)” on page
152 for details.
Call Parameters:
Return Parameters:
The string length should indicate the number bytes and not the number of
Unicode characters to be sent. Therefore the length should be a multiple of 2. If
not, a parameter error will be returned by the function.
The Set Cursor function is used to set the position of the cursor within the host
presentation space. Before using the Set Cursor function, a workstation application
must be connected to the host presentation space.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 40
Data String NA
Return Parameters
Return Code Explanation
0 Cursor was successfully located at the specified position.
1 Your program is not connected to a host session.
4 The session is busy.
7 A cursor location less than 1 or greater than the size of the
connected host presentation space was specified.
9 A system error occurred.
The Set Session Parameters function lets you change certain default session
options in EHLLAPI for all sessions. When EHLLAPI is loaded, the default settings
for session options are as indicated by the underscored entries in the tables that
appear in “Session Options” on page 153. Any, some, or all of these settings can be
changed by including the desired option in the calling data string as explained
below. Specified settings remain in effect until:
v Changed by a subsequent Set Session Parameters (9) function that specifies a
new value.
v The Reset System (21) function is executed.
v The EHLLAPI application program is terminated.
The following table lists those EHLLAPI functions that are affected by session
options. Functions not listed in the table are not affected by any of the session
options. Session options that affect each function are indicated by corresponding
entries in the “See Items” column. These entries are indexed to the list that follows
“Call Parameters” on page 153.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 9.
Data String String containing the desired values of those session options
that are to be changed. The data string can contain any of
the values in the tables of “Session Options.” The values
should be placed on the data string line, separated by
commas or blanks. The sets of parameters are explained in
terms of the functions they affect.
Length Explicit length of the source data string (the STREOT option
is not allowed).
PS Position NA.
Session Options
The following tables show the session options. The default is underlined.
1. The values in the following table determine how the data string length is
defined for functions Send Key (3), Search Presentation Space (6), Copy
String to Presentation Space (15), Search Field (30), Copy String to Field
(33), Send File (90), and Receive File (91).
2. The statement in the following table is used to specify the character that is
used as the end-of-text (EOT) delimiter in the calling (source) data string for
EHLLAPI functions Send Key (3), Search Presentation Space (6), Copy String
to Presentation Space (15), Search Field (30), Copy String to Field (33), Send
File (90), and Receive File (91).
Value Explanation
EOT=c Allows you to specify the EOT character for string terminators (in
STREOT mode). Binary zero is the default. Do not leave a blank
after the equal sign.
Value Explanation
SRCHALL The Search Presentation Space (6) function and Search Field (30)
function scan the entire host presentation space or field.
SRCHFROM The Search Presentation Space (6) function and Search Field (30)
function start from a specified PS position (for SRCHFRWD) or end at
a specified PS position (for SRCHBKWD).
4. The values in the following table affect the Search Presentation Space (6) and
Search Field (30) search functions. They determine the direction for the
search.
Value Explanation
SRCHFRWD The Search Presentation Space (6) function and Search Field (30)
function perform in an ascending direction.
SRCHBKWD The Search Presentation Space (6) function and Search Field (30)
function perform in a descending direction. A search is satisfied if
the first character of the requested string starts within the bounds
specified for the search.
5. The values in the following table determine how attribute bytes are treated for
functions Copy Presentation Space (5), Copy Presentation Space to String
(8), and Copy Field to String (34).
Value Explanation
NOATTRB Convert all unknown values to blanks.
ATTRB Pass back all codes that do not have an ASCII equivalent as their
original values.
NULLATTRB Convert all field attributes to null characters.
6. The values in the following table affect the Pause (18) function.
Value Explanation
NOQUIET SEND and RECEIVE messages are displayed.
QUIET SEND and RECEIVE messages are not displayed.
Value Explanation
TIMEOUT=0 A Cancel is automatically issued following a 20-second
(approximate) delay.
TIMEOUT=c A Cancel is automatically issued following a specified delay. A
1-character indicator from the table below tells Personal
Communications how many 30-second cycles it should accept
before issuing a Cancel itself.
Character Value (in minutes)
1 0.5
2 1.0
3 1.5
4 2.0
5 2.5
6 3.0
7 3.5
8 4.0
9 4.5
J 5.0
K 5.5
L 6.0
M 6.5
N 7.0
9. The statement in the following table is used to define the escape character for
keystroke mnemonics. This session option affects functions Send Key (3) and
Get Key (51). The value of c must be entered as a 1-byte literal character
string with no preceding blanks.
10. The values in the following table determine whether EHLLAPI automatically
precedes strings sent using the Send Key (3) function with a reset.
Value Explanation
AUTORESET EHLLAPI attempts to reset all inhibited conditions by prefixing all
strings of keys sent using the Send Key (3) function with a reset.
NORESET Do not AUTORESET.
11. The values in the following table affect the manner in which the Connect
Presentation Space (1) command function.
Value Explanation
CONLOG Establishes a logical connection between the workstation session
and a host session. During Connect, does not jump to the
requested presentation space.
CONPHYS Establishes a physical connection between the workstation session
and a host session. During Connect, jumps to the requested
presentation space.
12. The values in the following table affect the Wait (4) function and Get Key (51)
function. For each value, there are two different effects, one for each function.
Value Explanation
TWAIT For the Wait (4) function, waits up to a minute before timing out
on XCLOCK (X []) or XSYSTEM.
For the Get Key (51) function, does not return control to your
EHLLAPI application program until it has intercepted a key
(normal or AID key based on the option specified under the Start
Keystroke Intercept (50) function).
LWAIT For the Wait (4) function, waits until XCLOCK (X [])/XSYSTEM
clears. This option is not recommended, because control does not
return to your application until the host is available.
For the Get Key (51) function, does not return control to your
EHLLAPI application program until it has intercepted a key
(normal or AID key based on the option specified under the Start
Keystroke Intercept (50) function).
NWAIT For the Wait (4) function, checks status and returns immediately
(no wait).
For the Get Key (51) function, returns return code 25 (keystrokes
not available) in the fourth parameter if nothing is queued
matching the option specified under the Start Keystroke Intercept
(50) function.
Value Explanation
NOEAB Pass data only, no EABs.
EAB Pass the presentation space data with extended attribute bytes. For
each character that appears on the screen, 2 bytes of data are
passed. Therefore, a buffer twice the size of the presentation space
must be preallocated; for example 2 x 1920 = 3840 for a 24-row by
80-column presentation space.
Note: When using EHLLAPI Copy PS to String, text is copied which should
be invisible to the operator. Use the EHLLAPI Set Session Parameters
function to set the NODISPLAY option to determine if there is hidden
data. This causes EHLLAPI to return nondisplay fields as nulls.
Another common procedure for hiding data is to set the foreground
and background colors the same (BLACK, for instance) so the text is
displayed, but not visible to the human operator. The only way for
your application to detect this is to use the EAB and XLATE session
parameters and then copying the PS. The foreground/background color
of each position is returned and you can determine which characters
are invisible.
14. The values in the following table affect Copy Presentation Space (5), Copy
Presentation Space to String (8), Copy String to Presentation Space (15),
Copy String to Field (33), and Copy Field to String (34).
Value Explanation
NOXLATE EABs are not translated.
XLATE EABs are translated to the PC color graphics adapter (CGA) format.
15. The values in the following table affect Copy Presentation Space (5), Copy
Presentation Space to String (8) and Copy Presentation Space to Clipboard
(35) if NOATTRB and NOEAB are specified.
Value Explanation
BLANK Convert all unknown values to X'20'.
NOBLANK Convert all unknown values to X'00'.
The default value is BLANK. If you want to change the default value to
NOBLANK, add the following statement in the PCSWIN.INI file located in the
Personal Communications user-class application data directory:
[API]
NullToBlank=NO
16. The values in the following table affect the presentation space size that is
returned by the Query Sessions (10).
17. The values in the following table affect Copy Presentation Space (5), Copy
Presentation Space to String (8), Copy Field to String (34) and Copy
Presentation Space to Clipboard (35).
Value Explanation
DISPLAY Copy nondisplay fields in the presentation space to the target
buffer area in the same manner as display fields. Current
applications function normally.
NODISPLAY Do not copy nondisplay fields in the presentation space to the
target buffer area. Copy the nondisplay fields to the target buffer as
a string of null characters. This allows applications to display the
copied buffers in the presentation widow without displaying
confidential information, such as passwords.
18. The values in the following table affect Copy String to Presentation Space
(15), Copy String to Field (33) and Paste Clipboard to Presentation Space
(36).
Value Explanation
NOPUTEAB EAB (or EAD for DBCS) is not contained in the data string of Copy
String to Presentation Space or Copy String to Field.
PUTEAB EAB is contained with character data in the data string of Copy
String to Presentation Space or Copy String to Field.
This option is used for the compatibility with Communication Manager/2. For
Communication Manager/2, the data string, which is specified in Copy String
to Presentation Space or Copy String to Field, must be contain EAB (or EAD)
with character data when EAB (or EAD) is valid in Set Session Parameters.
Whereas, for the previous Personal Communications, the data string specified
in these functions must consist of character data only even if EAB (or EAD) is
valid. But Personal Communications allows that the data string contains EAB
(or EAD) by setting PUTEAB to provide the compatibility with
Communication Manager/2.
19. The values in the following table affect the Send Key (3) function. Keystrokes
are not processed if the keyboard is blocked or in use. The options determine
whether the function tries to resend the keystrokes until a 4-minute timeout
occurs or if the function returns immediately after determining the keyboard
is blocked or in use.
Value Explanation
RETRY Continues to attempt to send keystrokes until they are sent or until
a 4-minute timeout occurs.
NORETRY Returns immediately after determining the keyboard is blocked or
in use.
20. DBCS Only: The values in the following table affect Copy Presentation Space
(5), Copy Presentation Space to String (8), Copy String to Presentation Space
(15), Copy String to Field (33), Copy Field to String (34), Copy Presentation
Space to Clipboard (35) and Paste Clipboard to Presentation Space (36).
21. DBCS Only: The values in the following table affect Copy Presentation Space
(5), Copy Presentation Space to String (8), Copy String to Presentation Space
(15), Copy String to Field (33), Copy Field to String (34), Copy Presentation
Space to Clipboard (35) and Paste Clipboard to Presentation Space (36).
Value Explanation
NOSO Pass the presentation space data except Shift-in (SI) and Shift-out
(SO) control characters.
SO Pass the presentation space data including translated SI control
character to X'0E' and SO control character to X'0F'. The allocated
buffer size depends on the length of the stored data.
SPACESO Pass the presentation space data including translated SI and SO
control characters to X'20' (blank). The allocated buffer size
depends on the length of the stored data.
22. The values in the following table affect Copy Presentation Space (5), Copy
Presentation Space to String (8), Copy String to Presentation Space (15),
Copy String to Field (33), Copy Field to String (34) Search Field (30), Query
Sessions. (10), Copy Presentation Space to Clipboard (35) and Paste
Clipboard to Presentation Space (36).
Value Explanation
EXTEND_PS 5250 emulation supports a presentation space of 24 rows by 80
columns. In some instances, Communication Manager 5250
emulation displays a 25th row. This occurs when either an error
message from the host is displayed or when the operator selects
the SysReq key. Personal Communications displays 25th row
information on row 24, but EHLLAPI normally sees the real 24th
row. By EXTEND_PS option, an EHLLAPI application can use the
same interface with Communication Manager EHLLAPI and valid
presentation space is extended when this condition occurs.
NOEXTEND_PS The presentation space is not extended when the above condition
occurs. This is the default value.
23. The values in the following table affect the Connect Presentation Space (1)
and Connect Window Services (101) functions. The options specify whether
an application can or will share the presentation space to which it is
connected with another application. Only one of the following values can be
specified with each Set Session Parameter call.
Value Explanation
SUPER_WRITE The application allows other applications that allow sharing and
have write access permissions to concurrently connect to the same
presentation space. The originating application performs
supervisory-type functions but does not create errors for other
applications that share the presentation space.
24. The values in the following table allow applications that have presentation
space sharing requirements to limit the sharing to a partner application (an
application that was developed to work with it).
Value Explanation
NOKEY Allows the application to be compatible with existing applications
that do not specify the KEY parameter.
KEY$nnnnnnnn Uses a keyword to restrict sharing access to the presentation space
that it supports. The keyword must be exactly 8 bytes in length.
Return Parameters
This function returns a length and a return code.
Length:
Number of valid session parameters that are set.
Return Code:
The following codes are defined:
The following session option differences must be noted for 1390/1399 and 1137
code page support in a Unicode session:
Note: If you use the session option STREOT, then the results may not be as
expected. You can use a single-byte delimiter with the Unicode strings
if you are certain that the single-byte delimiter will not be a part of the
Unicode values that you are passing in the buffer.
v The session option ESC is not supported in a Unicode session for the same
reason as listed for “STREOT” on page 160.
v The session option XLATE is not supported in Unicode. Even if this option is
set, it will be ignored.
The Start Close Intercept function allows the application to intercept close requests
generated when a user selects the close option from the emulator session window.
This function intercepts the close request and discards it until a Stop Close
Intercept (43) function is requested.
After using this function, your application program can use the Query Close
Intercept (42) function to determine when a close request has occurred.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Byte Definition
Standard Interface Enhanced Interface
Function Number Must be 41
Data String See the following table
Length 5 or 6 Must be 12
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID).
2–4 Reserved.
4–5 The data in these positions is ignored by EHLLAPI.
However, no error is caused if the migrating program has
data in these positions. This data is accepted to provide
compatibility with migrating applications.
6 5 Specify M to request asynchronous message mode
(Windows only).
6–8 Reserved.
2–3 9–12 When M is specified in position 5 (6 for 16-bit), the
window handle of the window that receives the message
should be set. The message is a return value of
RegisterWindowMessage (PCSHLL) (not equal 0).
Return Parameters
This function returns a data string and a return code.
Data String:
If asynchronous message mode is not specified in position 5 (6 for
standard interface) and the function is completed successfully, the
following data string is returned.
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID).
2–8 Reserved.
9–12 4 byte value in which the event object address is returned
by EHLLAPI. The application can wait for this event
object. (32-bit only).
Data String:
If M (asynchronous message mode) is specified in position 5 (6 for
standard interface) and the function is completed successfully, the
following data string is returned.
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–8 Reserved
2–3 9–10 Task ID of asynchronous message mode
Note: If a user selects the close option, an application window receives a message.
The message is a return value of RegisterWindowMessage (PCSHLL). The
wParam parameter will contain the Task ID returned by this function call.
The HIWORD of the lParam parameter will contain the Return Code 26,
The Start Communication Notification function begins the process by which your
EHLLAPI application can determine whether the specified session is connected to
a host.
After using this function, the application can use Query Communication Event
(81) to determine whether the session is connected or disconnected.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Enhanced Interface
Function Number Must be 80
Data String Preallocated structure; see the following table
Length 16
PSPosition NA
Byte Definition
1 A 1-character presentation space short name (PSID).
2-4 Reserved
5 One of the following values:
v The character C asks for notification when the session either
disconnects or connects to the host.
v The character A requests the asynchronous mode of notification.
When A is specified, position 9-12 returns the address of an
event object (Windows). The character C must be placed in
position 13.
v The character M requests the asynchronous message mode of
the notification. When M is specified, the event selection
character C must be placed in position 13.
6-8 Reserved
9-12 When M is specified in position 5, the window handle of the
window that receives the message should be set. The message is a
return value of RegisterWindowMessage (PCSHLL)—(not zero).
13 This should contain the character C if position 5 is A or M.
14-16 Reserved
Data String
If A (asynchronous mode) is specified in position 5 of the calling data structure
and the function is completed successfully, the following data string is returned:
Byte Definition
1 A 1-character presentation space short-name (PSID)
2-8 Reserved
9-12 4-byte binary value in which the event object handle is returned by
EHLLAPI. The application can wait for this event object.
Byte Definition
1 A 1-character presentation space short-name (PSID)
2-8 Reserved
9-10 Task ID of asynchronous message mode
The Start Host Notification function begins the process by which your EHLLAPI
application program determines if the host presentation space or OIA have been
updated.
After using this function, your application program can use the Query Host
Update (24) function to determine when a host event has occurred.
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 23
Data String Preallocated string; see the following table
Length 6 or 7 implied 16
PS Position NA
Return Parameters
This function returns a data string and a return code.
Data String:
If A (asynchronous mode of notification) is specified in position 5 and the
function is completed successfully, the following data string is returned:
Byte Definition
Standard Enhanced
Data String:
If M (asynchronous message mode) is specified in position 5 (2 for
standard interface) and the function is completed successfully, the
following data string is returned:
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–8 Reserved
3–4 9–10 Task ID of asynchronous message mode
Prerequisite Calls
There are no prerequisite calls for this function.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 50
Data String See the following table
Length Keystroke buffer size EHLLAPI allocates 32 bytes minimum
for this buffer.
PS Position NA
Byte Definition
Standard Enhanced
1 1 One of the following values:
v A specific host presentation space short name (PSID)
v A blank or null indicating a request for the
host-connected host presentation space
2–4 Reserved.
Data String:
If M (asynchronous message mode) is specified in position 5 (2 for
standard interface) and the function is completed successfully, the
following data string is returned:
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–8 Reserved
3–4 9–10 Task ID of asynchronous message mode
Return Parameters
Return Code Explanation
0 The Start Keystroke Intercept function was successful.
1 An incorrect presentation space was specified.
The Start Playing Macro function invokes a macro. The macro will be executed in
the connected session.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface
Function Number Must be 110
Data String See the following table
Length Length of macro name, plus 3
PS Position NA
Return Parameters
Return Code Explanation
0 The Start Playing Macro function was successful.
1 The programs is not connected to a host session.
2 An error was made in specifying parameters.
9 A system error was encountered.
The Stop Close Intercept function allows the application to turn off the Start
Close Intercept (41) function. After the application has issued the Stop Close
Intercept function, subsequent close requests result in a normal stop sent to the
logical terminal session.
Prerequisite Calls
Start Close Intercept (41)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 43
Data String 1-character short session ID of the host presentation space
Length 1 Must be 4
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
Return Parameters
Return Code Explanation
0 The Stop Close Intercept function was successful.
1 An incorrect host presentation space was specified.
Prerequisite Calls
Start Communication Notification (80)
Call Parameters
Enhanced Interface
Function Number Must be 82
Data String 1-character short name of the host
presentation space, or a blank or null
indicating request for updates to the
host-connected presentation space
Length 4 is implied
PSPosition NA
Byte Definition
1 A 1-character presentation space short name (PSID)
2-4 Reserved
Return Parameters
Return Code Definition
0 The function was successful
1 An incorrect PSID was specified
8 No prior call to Start Communication Notification (80) function
was called for the PSID
9 A system error was encountered
The Stop Host Notification function disables the capability of the Query Host
Update (24) function to determine if the host presentation space or OIA has been
updated. This function also stops host events from affecting the Pause (18)
function.
Prerequisite Calls
Start Host Notification (23)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 121
Data String See the following note
Length 1 is implied Must be 4
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
Note: 1-character short name of the target presentation space ID, or a blank or a
null to indicate a request for the host-connected presentation space.
Return Parameters
Return Code Definition
0 The Stop Host Notification function was successful.
1 An incorrect host presentation space was specified.
8 No previous Start Host Notification (23) function was issued.
9 A system error was encountered.
The Stop Keystroke Intercept function ends your application program's ability to
intercept keystrokes.
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 53
Data String Short name of the target presentation space (PSID)
Length 1 is implied Must be 4
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
Return Parameters
Return Code Explanation
0 The Stop Keystroke Intercept function was successful.
1 An incorrect presentation space was specified.
8 No prior Start Keystroke Intercept (50) function was called for this
presentation space.
9 A system error was encountered.
Wait (4)
3270 5250 VT
Yes Yes Yes
The Wait function checks the status of the host-connected presentation space. If the
session is waiting for a host response (indicated by XCLOCK (X []) or XSYSTEM),
the Wait function causes EHLLAPI to wait up to 1 minute to see if the condition
clears.
Prerequisite Calls
Connect Presentation Space (1)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 4
Data String NA
Length NA
PS Position NA
The Window Status function allows the application to query or change a window's
presentation space size, location, or visible state.
Prerequisite Calls
Connect Window Services (101)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 104
Data String See the following table
Length 16 or 20 24 or 28
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID)
2–4 Reserved
Byte Definition
Standard Enhanced
3–4 7–8 A 16- or 32-bit word containing the status set bits if the
request option is 1 (set status). The following codes are
valid return values if the request option is set status:
X'0001' Change the window size. (Not valid with
minimize, maximize, restore, or move.)
X'0002' Move the window. (Not valid with minimize,
maximize, size, or restore.)
X'0004' ZORDER window replacement.
X'0008' Set the window to visible.
X'0010' Set the window to invisible.
X'0080' Activate the window. (Sets focus to window and
places it in the foreground unless ZORDER is
specified. In this case, the ZORDER placement is
used.)
X'0100' Deactivate the window. (Deactivates the window
and makes the window the bottom window
unless ZORDER is also specified. In this case,
the ZORDER placement is used.)
X'0400' Set the window to minimized. (Not valid with
maximize, restore, size, or move.)
X'0800' Set the window to maximized. (Not valid with
minimize, restore, size, or move.)
X'1000' Restore the window. (Not valid with minimize,
maximize, size, or move.)
5–6 9–12 A 16- or 32-bit word containing the X window position
coordinate. (Ignored if the move option is not set.)
7–8 13–16 A 16- or 32-bit word containing the Y window position
coordinate. (Ignored if the move option is not set.)
9–10 17–20 A 16- or 32-bit word containing the X window size in
device units. (Ignored if the size option is not set.)
11–12 21–24 A 16- or 32-bit word containing the Y window size in
device units. (Ignored if the size option is not set.)
Byte Definition
Standard Enhanced
3–4 7–8 A 16- or 32-bit word containing X'0000' if the request
option is 2 (query for status). The following codes are
possible return values if the request option is query for
status. More than one state is possible.
X'0008' The window is visible.
X'0010' The window is invisible.
X'0080' The window is activated.
X'0100' The window is deactivated.
X'0400' The window is minimized.
X'0800' The window is maximized.
5–6 9–12 A 16- or 32-bit word containing the X window position
coordinate. (Ignored if the move option is not set.)
7–8 13–16 A 16- or 32-bit word containing the Y window position
coordinate. (Ignored if the move option is not set.)
9–10 17–20 A 16- or 32-bit word containing the X window size in
device units. (Ignored if the size option is not set.)
11–12 21–24 A 16- or 32-bit word containing the Y window size in
device units. (Ignored if the size option is not set.)
13–16 25–28 A 16- or 32-bit word containing a window handle for
relative window placement. These two words are only for
the set option. (Ignored if the ZORDER option is not set.)
Valid values are as follows:
Byte Definition
Standard Enhanced
Return Parameters
Return Code Explanation
0 The Window Status function was successful.
1 The presentation space was not valid or not connected.
2 An incorrect option was specified.
9 A system error occurred.
12 The session stopped.
The return code field in the parameter list might not contain the results of the
requested I/O. If the return code is not 0, then the request failed. The application
must take the appropriate action based on the return code.
If the return code for this request is 0, the application must use the request ID
returned with this function call to issue the Get Request Completion function call
to determine the completion results of the function associated with the request ID.
The Get Request Completion function call returns the following information:
1. Function request ID
2. Address of the data string from the asynchronous request
3. Length of the data string
4. Return code of the completed function
Prerequisite Calls
Connect for Structured Fields (120) Allocate Communication Buffer (123)
Call Parameters
Standard Interface Enhanced Interface
Function Number Must be 127
Data String See the following table
Length 8, 10, or 14 Must be 20
PS Position NA
Byte Definition
Standard Enhanced
1 1 A 1-character presentation space short name (PSID).
2–4 Reserved.
2 5 S or A or M
S= Synchronous. Control is not returned to the
application until the read is satisfied.
A= Asynchronous. Control is returned immediately
to the application, can wait for the event object.
M= Asynchronous. Control is returned immediately
to the application, can wait for the message.
6 Reserved.
Return Parameters
This function returns a data string and a return code.
Data String:
If A (asynchronous) is specified in position 5 (2 for standard interface) and
the function is completed successfully, the following data string is
returned:
Byte Definition
9–10 13–14 2-byte Function Request ID. It is used by the Get Request
Completion (125) function to determine the completion of this
function call.
15–16 Reserved.
17–20 4-byte value in which the event object address is returned by
EHLLAPI. The application can wait for this event object. When
the event object is cleared, the application must issue the Get
Request Completion (125) function call to get results of the Write
Structured Fields request. (32-bit only).
Note: An event object is returned for each successful asynchronous request. The
event object should not be used again. A new event object is returned for
each request and is valid for only the duration of that request.
Data String:
If M (asynchronous message mode) is specified in position 5 (2 for
standard interface) and the function is completed successfully, the
following data string is returned:
Byte Definition
9–10 13–14 2-byte Function Request ID. It is used by the Get Request
Completion (125) function to determine the completion of this
function call.
15–16 Reserved.
11–12 17–18 Task ID of asynchronous message mode.
19–20 Reserved.
Bytes 0 through 7 are the buffer header. These first 8 bytes are used by the
emulation program. The user section of the buffer begins with offset 8. Bytes 8 and
9 contain the number of bytes in the first structured field (a structured field
message can contain multiple structured fields) including 2 bytes for bytes 8 and 9.
Bytes 8 through m+7 are used for the structured field message sent to the host.
These are used to complete the asynchronous Write Structured Fields call.
These are used to complete the asynchronous Write Structured Fields call.
WinHLLAPIAsync
This entry point is used for six WinHLLAPI functions that often take a long time
to complete. With WinHLLAPIAsync, the function will be launched
asynchronously and will not interfere with the continued progression of the calling
application. These functions are: Wait (04), Start Host Notify (23), Start Close
Intercept (41), Start Keystroke Intercept (50), Send File (90), and Receive File (91),
and are described in Chapter 4, “WinHLLAPI Extension Functions.”
The parameter list is the same as WinHLLAPI except a window handle is required
before the function number. Since the function operates asynchronously, its
completion is signaled by a registered message. The window handle is required as
the target of the message.
There are two messages that must be registered by the WinHLLAPI application
through calls to RegisterWindowsMessage() with the strings
WinHLLAPIAsync(for all functions except 90 and 91) and
WinHLLAPIAsyncFileTransfer (for functions 90 and 91). The standard format is as
follows:
WPARAM
contains the Task Handle returned by the original function call.
LPARAM
the high word contains the error code and the low word contains the
original function number.
Wait (4)
This function determines whether the Host session is in an inhibited state. If, for
some reason, the session is in an inhibited state, this function will signal your
Call Parameters:
Parameter Description
Data String NA
Data Length NA
PS Position NA
Return Codes:
Code Description
WHLLOK The PS is uninhibited and ready for input.
WHLLNOTCONNECTED Your WinHLLAPI application is not connected to
a valid host session.
WHLLPSBUSY Function timed out while still inhibited.
WHLLNHIBITED The PS is inhibited.
SHLLSYSERROR The function failed due to a system error.
WHLLCANCEL The asynchronous function was cancelled.
Remarks: Asynchronous Wait is used to notify the calling application when the
inhibited state of the PS is expired. When inhibited state has expired, this version
of Wait will post a WinHLLAPIAsync message to the window specified by the
hWnd. The session options TWAIT, LWAIT, and NWAITaffect the length of time
that this function will wait. See “Set Session Parameters (9)” on page 152 for
details on these session options.
Note: If NWAIT is specified in the session parameters and the application registers
using revision 1.1 of the WinHLLAPI implementation, the
WINHLLAPIAsync call will work the same as the WinHLLAPI call and not
send a message. If revision 1.0 is being used then Wait will return a message
immediately with the inhibited status of the PS.
Parameter Description
Data String A 7-byte string in the following format:
Byte 1 Short name session ID of the desired Host
session, or space or null for the current Host
session.
Byte 2 Notification mode. "P" for presentation space
update only, "O" for OIA update only, "B" for
both presentation space and OIA updates.
When calling WinHLLAPIAsync, this
position can be "A".
Byte 3-6
Not used. Provided for compatibility with
older applications.
Byte 7 Reserved or replaced with one of the
following if using WinHLLAPIAsync and A
in byte 2: P for presentation space update
only, O for OIA update only; and B for both
presentation space and OIA updates.
Data Length Length of Host event buffer (256 recommended).
PS Position NA
Return Parameters:
Parameter Description
Data String Same as Data String on the call.
Return Codes:
Code Description
WHLLOK Host notification enabled.
WHLLNOTCONNECTED The specified Host session is invalid.
WHLLPARAMETERERROR One of more parameters are invalid.
WHLLSYSERROR The function failed due to a system error.
WHLLCANCEL The asynchronous function was cancelled.
Remarks: Once enabled, Host notification is enabled until you call Stop Host
Notification (25) or WinHLLAPICancelAsyncRequest(). The function initiates host
notification and immediately returns control to your Windows HLLAPI
application. This frees your application to perform other tasks while waiting for
host updates. When an update occurs, the function will notify the window
specified by hWnd with the registered message WinHLLAPIAsync.
Parameter Description
Data String A 5-byte string for returned semaphore address. The
first byte is the session short name of the session to
query, or space or null for the current session.
Data Length Must be specified.
PS Position NA
Return Parameters:
Parameter Description
Data String A 5-byte string with the following format:
Byte 1 Session short name, or space or null for the
current session
Bytes 2-5
Semaphore address.
Return Code:
Code Description
WHLLOK The function was successful.
WHLLNOTCONNECTED An invalid presentation space was specified.
WHLLPARAMETERERROR An invalid option was specified.
WHLLSYSERROR The function failed due to a system error.
WHLLCANCEL The asynchronous function was cancelled.
Remarks: Once enabled, Host notification remains enabled until you call Stop
Close Intercept (43) or WinHLLAPICancelAsyncRequest (). Initially, the
semaphore is set. After using this function, close requests from the user are
discarded and the semaphore is cleared.
The function initiates close intercept and immediately returns control to your
Windows HLLAPI application. This frees your application to perform other tasks
while waiting for close requests. When a close request occurs, the function will
notify the window specified by hWnd with the registered message
WinHLLAPIAsync.
Parameter Description
Data String A 6-byte string in the following format:
Byte 1 Session short name, or space or null for the
current Host session.
Byte 2 Keystroke intercept code. "D" causes only
AID keystrokes to be intercepted; "L" causes
all keystrokes to be intercepted.
Bytes 3-6
Reserved
Data Length Variable (256 is recommended)
PS Position NA
Return Code:
Code Description
WHLLOK Keystroke intercept has been initiated.
WHLLNOTCONNECTED The Host session presentation space is invalid.
WHLLPARAMETERERROR One or more parameters are invalid.
WHLLPSBUSY Session is busy.
WHLLSYSERROR Function failed due to a system error.
WHLLCANCEL Asynchronous function was cancelled.
Call Parameters:
Parameter Description
Data String SEND command parameters.
Data Length Length of Data String. NA if session option EOT is
specified.
PS Position NA
Code Description
WHLLOK File transfer started successfully.
WHLLPARAMETERERROR Parameter error or Data Length is zero
or greater than 255.
WHLLFTXCOMPLETE File transfer complete.
WHLLFTXSEGMENTED Transfer is complete with segmented
records.
WHLLSYSERROR The function failed due to a system
error.
WHLLTRANSABORTED File transfer aborted, either due to the
user clicking the cancel button or
because the timeout period has
elapsed.
WHLLFILENOTFOUND PC file not found.
WHLLFTXCOMPLETECICS File transfer was successful (transfer to
CICS).
WHLLACCESSDENIED Access denied to PC file.
WHLLMEMORY Insufficient memory.
WHLLINVALIDENVIRONMENT Invalid environment.
Remarks: Only one file transfer operation is supported per connected Host
session.
The function initiates the file transfer and immediately returns control to your
Windows HLLAPI application. This frees your application to perform other tasks
while the file transfer is occurring. Once initiated the function will regularly post
WinHLLAPIAsyncFileTransfer messages to the window specified by hWnd. These
messages will notify the WinHLLAPI application of the status of the transfer and
send a final message when the transfer is complete.
wParm
Is the status indicator: the high byte contains the Session ID, the low byte
contains the status. If the low byte is zero, the file transfer is still in
progress. If the low byte is one, the file transfer has completed.
lParm If the low byte of wParm is zero (in progress), lParm is the number of bytes
transferred. If the low byte wParm is one (completed), lParm is the
completion code.
Call Parameters:
Parameter Description
Data String RECEIVE command parameters.
Return Codes:
Code Description
WHLLOK File transfer started successfully.
WHLLPARAMETERERROR Parameter error or Data Length is zero
or greater than 255.
WHLLFTXCOMPLETE File transfer complete.
WHLLFTXSEGMENTED Transfer is complete with segmented
records.
WHLLSYSERROR The function failed due to a system
error.
WHLLTRANSABORTED File transfer aborted, either due to the
user clicking the cancel button or
because the timeout period has
elapsed.
WHLLFILENOTFOUND PC file not found.
WHLLFTXCOMPLETECICS File transfer was successful (transfer to
CICS).
WHLLACCESSDENIED Access denied to PC file.
WHLLMEMORY Insufficient memory.
WHLLINVALIDENVIRONMENT Invalid environment.
Remarks: Only one file transfer operation is supported per connected Host
session.
The function initiates the file transfer and immediately returns control to your
Windows HLLAPI application. This frees your application to perform other tasks
while the file transfer is occurring. Once initiated the function will regularly post
WinHLLAPIAsyncFileTransfer messages to the window specified by hWnd. These
messages will notify the WinHLLAPI application of the status of the transfer and
send a final message when the transfer is complete.
wParm
Is the status indicator: the high byte contains the Session ID, the low byte
contains the status. If the low byte is zero, the file transfer is still in
progress. If the low byte is one, the file transfer has completed.
lParm If the low byte of wParm is zero (in progress), lParm is the number of bytes
transferred. If the low byte wParm is one (completed), lParm is the
completion code.
WinHLLAPICancelAsyncRequest
This function cancels an outstanding asynchronous function launched by a call to
WinHLLAPIAsync().
Parameters
hAsyncTask
The handle returned by WinHLLAPIAsync() when the function was
initiated.
wFunction
The function number of the asynchronous task to cancel. Because this
parameter is required for revision 1.1 but not in 1.0, it is optional.
Returns
The return value indicates if the specified function was, in fact, canceled. If the
function was canceled then the return value is WHLLOK (0). If the outstanding
asynchronous function was not cancelled, one of the following codes will be
returned.
WHLLINVALID
hAsyncTask is not a valid task handle.
WHLLALREADY
The asynchronous task specified by hAsyncTask has already completed.
WinHLLAPI Startup
This function is used to register the application with the WinHLLAPI
implementation and should be called before any other call to the WinHLLAPI
implementation. This implementation supports Versions 1.0 and 1.1 of the
WinHLLAPI specification. The WinHLLAPI application should negotiate version
compatibility with this function.
Syntax
int WinHLLAPIStartup(WORD wVersionRequired, LPWHLLAPIDATA lpData)
Parameters
wVersionRequired
This is the version required by the WinHLLAPI application. The low byte
contains the major version number and the high byte contains the minor
version (or revision) number.
lpData
This is a pointer to a WHLLAPIDATA structure which will receive the
implementations version number and a string describing the WinHLLAPI
implementation provider. The WHLLAPIDATA structure is defined as:
#define WHLLDESCRIPTION_LEN 127
typedef struct tagWHLLAPIDATA
{
WORD wVersion;
Char szDescription[WHLLDESCRIPTION_LEN + 1];
}WHLLAPIDATA, * PWHLLAPIDATA, FAR *LPWHLLAPIDATA;
WinHLLAPI Cleanup
The WinHLLAPI specification recommends that this function be used by the
WinHLLAPI application to de-register from the WinHLLAPI implementation.
Syntax
BOOL WinHLLAPICleanup()
Returns
Returns TRUE if the unregistration was successful. Otherwise, it returns FALSE.
Blocking Routines
The following sections describe the blocking routines supported by WinHLLAPI
programming.
Note: Although blocking routines are supported for WinHLLAPI compliance, use
of them is not recommended. Use of the WinHLLAPIAsync functions are the
recommended method for asynchronous processing.
WinHLLAPIIsBlocking
This function tells the calling WinHLLAPI application thread whether it is in the
process of executing a blocking call. A blocking call is any synchronous function
that takes a long time to execute and does not return until complete. There are five
blocking calls in this implementation of WinHLLAPI. The blocking calls are: Get
Key (51), Wait (4), Pause (18), Send File (90), and Receive File (91).
Syntax
BOOL WinHLLAPIIsBlocking()
Returns
If the WinHLLAPI application thread is in the middle of a blocking call, the
function returns TRUE, otherwise, it returns FALSE.
Remarks
Because the default blocking-hook allows messages to be processed during
blocking calls, it is possible to call the blocking call again.
WinHLLAPISetBlockingHook
This function sets an application-defined procedure to be executed while waiting
for the completion of a blocking call. A blocking call is any synchronous function
that takes a long time to execute and does not return until complete. There are five
blocking calls in this implementation of WinHLLAPI. The blocking calls are: Get
Key (51), Wait (4), Pause (18), Send File (90), and Receive File (91).
Parameters
lpfnBlockingHook
This is a pointer to the new blocking procedure.
Description
The WinHLLAPI implementation has a default blocking procedure that consists of
nothing more than a message handler. This default mechanism is shown in the
following example:
BOOL DefaultBlockingHook
{
MSG msg;
Returns
This function returns a pointer to the blocking function being replaced.
WinHLLAPIUnhookBlockingHook
This function restores the default blocking-hook for the calling thread.
Syntax
BOOL WinHLLAPIUnhookBlockingHook()
Returns
This function returns TRUE if the default blocking mechanism was successfully
restored, otherwise it returns FALSE.
WinHLLAPICancelBlockingCall
This function cancels an executing blocking call in the current thread. A blocking
call is any synchronous function that takes a long time to execute and does not
return until complete. There are five blocking calls in this implementation of
WinHLLAPI. The blocking calls are Get Key (51), Wait (4), Pause (18), Send File
(90), and Receive File (91). If one of these is blocking calls are cancelled, the
cancelled function will return WHLLCANCEL.
Returns
The return value indicates if the specified function was, in fact, canceled. If the
function was canceled, then the return value is WHLLOK (0). If there are no
outstanding blocking functions, then the following return code will be returned:
WHLLINVALID
Indicates that there is no blocking call currently executing.
Function Type
“Function Type” shows the type of the function in the following format:
Return Code
“Return Code” lists the codes that must be received by your program after a call to
the PCSAPI function.
pcsConnectSession
3270 5250 VT
Yes Yes Yes
Function Type
BOOL WINAPI pcsConnectSession(char cShortSessionID)
Return Code
Return Code Meaning
TRUE Function ended successfully.
FALSE It means one of the following things:
v The session has not started.
v An incorrect session ID was specified.
v Call failed.
pcsDisconnectSession
3270 5250 VT
Yes Yes Yes
Function Type
BOOL WINAPI pcsDisconnectSession(char cShortSessionID)
Return Code
Return Code Meaning
TRUE Function ended successfully.
FALSE It means one of the following things:
v The session has not started.
v An incorrect session ID was specified.
v Call failed.
Function Type
BOOL WINAPI pcsQueryConnectionInfo(char cShortSessionID,
CONNECTIONINFO *ConnectionInfo)
Return Code
Return Code Meaning
TRUE Function ended successfully.
FALSE It means one of the following things:
v The session has not started.
v An incorrect session ID was specified.
v The session specified was not a supported connection
type for this API (not Telnet).
ConnectionInfo
The CONNECTIONINFO structure will be filled with the information about the
host connection, consisting of the following information:
Structure Information
Host name States the name of the currently connected Telnet host.
LU name States the LU name currently assigned.
Port number States the host port number being used for the connection.
SSL indicator Indicates a Secure Connection (1 = secure; 0 = not secure).
Note: This API is valid only with the 32-bit version of PCSAPI, and only works for
Telnet connections.
Example
typedef struct_CONNECTIONINFO
{ //Description of a connection @WD06A
char hostName[63]; //telnet host name @WD06A
char reserved[1]; //reserved @wD06A
pcsQueryEmulatorStatus
3270 5250 VT
Yes Yes Yes
Function Type
ULONG WINAPI pcsQueryEmulatorStatus(char cShortSessionID)
Return Code
The return code value should be processed bit-significantly, that is, by either one of
the following values or an ORed value out of the following values:
pcsQuerySessionList
3270 5250 VT
Yes Yes Yes
If the array has fewer elements than there are host sessions, then only the supplied
elements of the array are filled in. The function always returns the actual number
of sessions, even if the array is too small.
An application can call this function with zero array elements to determine how
many sessions exist. A second call can then be made to obtain the session
information.
Function Type
ULONG WINAPI pcsQuerySessionList(ULONG Count, SESSINFO *SessionList)
Return Parameters
Return Code
Total number of Personal Communications sessions. This may be greater
than or less than the Count parameter.
SessionList
The array of SESSINFO structures is filled with information about the host
sessions. Sessions may be placed in the list in any order. Each SESSINFO
structure contains the following fields (defined in PCSAPI32.H)
Name A union of char and ULONG which contains the session ID (A–Z).
In the current implementation of Personal Communications, only
the lower byte (char) is used, the other bytes are returned as zero.
Status A combination of bit flags which indicate the current status of the
session. The flags (PCS_SESSION_*) are defined in the following
table.
The status value should be processed bit-significantly, that is, by either one of the
following values or an ORed value out of the following values:
exit;
pcsQueryWorkstationProfile
3270 5250 VT
Yes Yes Yes
Function Type
BOOL WINAPI pcsQueryWorkstationProfile(char cShortSessionID, PSZ lpBuffer)
Return Code
Return Code Meaning
TRUE Function ended successfully.
FALSE It means one of the following things:
v The session has not started.
v An incorrect session ID was specified.
The pcsSetLinkTimeout function sets the idle timeout of a Telnet link which is
SSCP owned. This function has no effect on non-TN connections or connections
which are not in SSCP owned state. If the timeout value is set to zero the link will
not time out. Otherwise the link will time out (disconnect) after being idle in
SSCP-owned state for the number of minutes specified.
Function Prototype
ULONG WINAPI pcsSetLinkTimeout(char cShortSessionID, USHORT Timeout)
Return Code
Return Code Meaning
PCS_SUCCESSFUL The function ended successfully.
PCS_SYSTEM_ERROR A system error occurred.
pcsStartSession
3270 5250 VT
Yes Yes Yes
Function Type
ULONG WINAPI pcsStartSession(PSZ lpProfile, char cShortSessionID, USHORT
fuCmdShow)
Return Code
Return Code Value Meaning
PCS_SUCCESSFUL 0 The function ended successfully.
PCS_INVALID_ID 1 An incorrect session ID was specified.
PCS_USED_ID 2 The specified short session ID is already used.
PCS_INVALID_PROFILE 3 An error was made in specifying the workstation
profile, or the window parameter was not valid.
PCS_SYSTEM_ERROR 9 A system error occurred.
pcsStopSession
3270 5250 VT
Yes Yes Yes
The pcsStopSession function stops a host session specified by the short session ID.
Function Type
BOOL WINAPI pcsStopSession(char cShortSessionID, USHORT fuSaveProfile)
Return Code
Return Code Meaning
TRUE The function ended successfully.
Restrictions
If the following restrictions are not satisfied, the API will fail. The return code
indicates the reason for the failure.
v The host session specified in the argument cShortSessionID should not be in
PDT mode.
v The host session should not be printing when the API is invoked.
v The File → Page Setup dialog should not be in use.
Some members in the PAGEINFO structure might be valid or supported only for
specific session types. If a restriction is not specified, then that member is valid or
supported for the following session types:
v 3270 display
v 3270 printer
v 5250 display
v ASCII VT
5250 printer sessions are not supported.
Note: These functions are not currently supported for DBCS and bidirectional
sessions.
pcsGetPageSettings
3270 5250 VT
Yes Yes Yes
The pcsGetPageSettings function retrieves the host session page settings values
(similar to the File → Page Setup dialog settings). Only the settings in the Text tab
of the dialog are supported.
Function Type
ULONG WINAPI pcsGetPageSettings(char cShortSessionID, PAGEINFO * const
pPageInfo, ULONG * const pErrorInfo)
Return Code
Return Code Value Meaning
PCS_SUCCESSFUL 0 Function ended successfully.
PCS_INVALID_ID 1 Incorrect session ID was specified.
PCS_INVALID_SESS_TYPE 2 Not supported for the host session type.
PCS_DIALOG_IN_USE 3 Failed because the host session Page Setup or
Printer Setup dialog was in use.
PCS_PRINTING 4 Page settings cannot be obtained because host
session was printing.
Example
{
ULONG Rc = 0;
PAGEINFO *PageInfo;
if (Rc == PCS_SUCCESSFUL) {
printf("CPI = %d,
LPI = %d,
FaceName = %s,
MPL = %d,
MPP = %d\n",
LOWORD(PageInfo->nCPI),
LOWORD(PageInfo->nLPI),
PageInfo->szFaceName,
PageInfo->nMPL,
PageInfo->nMPP);
if (HIWORD(PageInfo->nCPI))
printf("FontCPI\n");
else
printf("No FontCPI\n");
if (HIWORD(PageInfo->nLPI))
printf("FontLPI\n");
else
printf("No FontLPI\n");
} else
printf("Failure. Return code = %d\n", Rc);
free(PageInfo);
}
pcsRestorePageDefaults
3270 5250 VT
Yes Yes Yes
Function Type
ULONG WINAPI pcsRestorePageDefaults(char cShortSessionID, ULONG nFlags)
Return Code
Return Code Value Meaning
PCS_SUCCESSFUL 0 Function ended successfully.
PCS_INVALID_ID 1 Incorrect session ID was specified.
PCS_INVALID_SESS_TYPE 2 The nFlags parameter has one or more options
that are not valid for the host session type. No
settings were restored.
PCS_DIALOG_IN_USE 3 Failed because the host session Page Setup or
Printer Setup dialog was in use.
PCS_PRINTING 4 Page settings cannot be changed because host
session was printing.
PCS_PDT_MODE 5 Page settings cannot be changed because host
session is in PDT mode.
PCS_SYSTEM_ERROR 9 A system error occurred.
Example
{
ULONG Rc = 0;
Rc = pcsRestorePageDefaults(’A’, PCS_PAGE_TEXT);
if (Rc != PCS_SUCCESSFUL)
printf("Failure. Return code = %d\n", Rc);
}
pcsSetPageSettings
3270 5250 VT
Yes Yes Yes
The pcsSetPageSettings function sets the host session page settings. This is similar
to configuring the File → Page Setup dialog settings. Only the settings in the Text
tab are supported.
Notes:
1. CPI, LPI, and FontSize are dependent on the FaceName configured in the host
session. If this API is used to set CPI, LPI, FontSize, and FaceName together,
FaceName is set first, then the dependent properties.
Function Type
ULONG WINAPI pcsSetPageSettings(char cShortSessionID, const PAGEINFO * const
pPageInfo, ULONG * const pErrorInfo)
Return Code
Return Code Value Meaning
PCS_SUCCESSFUL 0 Function ended successfully.
PCS_INVALID_ID 1 Incorrect session ID was specified.
PCS_INVALID_SESS_TYPE 2 Not supported for the host session type.
PCS_DIALOG_IN_USE 3 Failed because the host session Page Setup or
Printer Setup dialog was in use.
PCS_PRINTING 4 Page settings cannot be changed because host
session was printing.
PCS_PDT_MODE 5 Page settings cannot be changed because host
session is in PDT mode.
PCS_FAILURE 6 Host session page settings are not fully
applied. This could be because invalid data
was given for some or all fields in the
PAGEINFO structure.
Example
{
ULONG Rc = 0, Error = 0;
PAGEINFO *PageInfo;
if (Rc != PCS_SUCCESSFUL) {
printf("Failure. Return code = %d\n", Rc);
printf("Following members could not be set : ");
if (Rc == PCS_FAILURE) {
if (Error & PCS_PAGE_CPI) printf(" nCPI");
if (Error & PCS_PAGE_LPI) printf(" nLPI");
if (Error & PCS_PAGE_FACE_NAME) printf(" szFaceName");
if (Error & PCS_PAGE_MPL) printf(" nMPL");
if (Error & PCS_PAGE_MPP) printf(" nMPP");
printf("\n");
}
}
free(PageInfo);
}
Restrictions
If the following restrictions are not met, the API will fail. The return code indicates
the reason for the failure.
v The host session should not be printing when the API is invoked.
v The File → Printer Setup dialog should not be in use.
Note: These functions are not currently supported for DBCS and bidirectional
sessions.
pcsGetPrinterSettings
3270 5250 VT
Yes Yes Yes
Function Type
ULONG WINAPI pcsGetPrinterSettings(char cShortSessionID, PRINTINFO * const
pPrintInfo, ULONG * const pErrorInfo)
For example:
v IBM InfoPrint 40 PS on Network Port
v HP LaserJet 4050 Series PCL 6 on LPT1
ULONG * const pErrorInfo
This is filled with the extended error info when the API fails with the
return code of PCS_FAILURE. pErrorInfo must be set to NULL by the
caller, if the details of errors are not needed.
The following section describes the flags that are defined in PCSAPI32.H.
Return Code
Return Code Value Meaning
PCS_SUCCESSFUL 0 The function ended successfully.
PCS_INVALID_ID 1 An incorrect session ID was specified.
PCS_DIALOG_IN_USE Failed because the host session Page Setup or
3
Printer Setup dialog was in use.
PCS_PRINTING The printer settings could not be changed
4 because the host session was printing. The
application must retry later
Example
{
ULONG Rc = 0, Error=0, Size;
PRINTINFO *PrintInfo;
PrintInfo->nBufSize = 0;
if (Rc != PCS_SUCCESSFUL)
printf("Failure. Return code = %d, Extended Error = 0x%08x\n", Rc, Error);
else {
if (PrintInfo->bPromptDialog)
printf("PromptDialog\n");
else
printf("No PromptDialog\n");
if (PrintInfo->bPDTMode)
printf("PDT Mode\n");
else
printf("Not PDT Mode\n");
switch(PrintInfo->nPrtMode) {
case PrtToDskAppend:
printf("Print to Disk-Append Mode\n");
break;
case PrtToDskSeparate:
printf("Print to Disk-Separate Mode\n");
break;
case SpecificPrinter:
printf("Specific Printer Mode\n");
break;
case WinDefaultPrinter:
printf("Windows Default Printer Mode\n");
break;
}
if (PrintInfo->lpPDTFile[0] == ’\0’)
printf("No PDT File configured\n");
else
printf("PDT File = %s\n", PrintInfo->lpPDTFile);
if (PrintInfo->lpPrtToDskAppFile[0] == ’\0’)
printf("No Disk Append File configured\n");
else
printf("DiskAppend File=%s\n", PrintInfo->lpPrtToDskAppFile);
pcsSetPrinterSettings
3270 5250 VT
Yes Yes Yes
Function Type
ULONG WINAPI pcsSetPrinterSettings(char cShortSessionID, const PRINTINFO *
const pPrintInfo, ULONG * const pErrorInfo)
For example:
v IBM InfoPrint 40 PS on Network Port
v HP LaserJet 4050 Series PCL 6 on LPT1
ULONG * const pErrorInfo
This is filled with the extended error info when the API fails with the
return code of PCS_FAILURE. pErrorInfo must be set to NULL by the
caller, if the details of errors are not needed.
The following section describes the flags that are defined in PCSAPI32.H.
Return Code
Return Code Value Meaning
PCS_SUCCESSFUL 0 The function ended successfully.
PCS_INVALID_ID 1 An incorrect session ID was specified.
PCS_DIALOG_IN_USE Failed because the host session Page Setup or
3
Printer Setup dialog was in use.
PCS_PRINTING The printer settings could not be changed
4 because the host session was printing. The
application must retry later.
PCS_FAILURE No host session printer settings were applied.
This might occur because invalid data was
6 given for some or all of the fields in the
PRINTINFO structure. pErrorInfo contains
details about the errors.
PCS_SYSTEM_ERROR 9 A system error occurred.
Example
{
ULONG Rc = 0, Error=0;
PRINTINFO *PrintInfo;
char PDTFile[] = "epson.pdt";
char SepFile[] = "DiskSep";
Note: If you use DDE functions with Visual Basic, see Chapter 7, “Using DDE
Functions with a DDE Client Application,” on page 297.
In DDE, atoms identify application names, topic names, and data items. Atoms
represent a character string that is reduced to a unique integer value. The character
string is added to an atom table, which can be referred to for the value of the
string associated with an atom. Atoms are created with the GlobalAddAtom
Item Function
Formats Returns the list of clipboard formats (numbers) that Personal
Communications is capable of rendering.
Status Returns information about the status of each Personal Communications
session.
SysCon Returns the level of Personal Communications support and other system
related values.
SysItems Returns the list of data items that are available when connected to the
Personal Communications system topic.
Topics Returns the list of Personal Communications topics that are available.
Item Function
CLOSE Retrieves the window close requests.
CONV Requests Code Conversion from ASCII to EBCDIC and EBCDIC to
ASCII.
EPS Retrieves the session presentation space with additional data.
EPSCOND Retrieves the presentation space service condition.
FIELD Retrieves the field in the presentation space of the session.
KEYS Retrieves the keystrokes.
MOUSE Retrieves the mouse input.
OIA Retrieves the operator information area status line.
PS Retrieves the session presentation space.
PSCOND Retrieves the session advise condition.
SSTAT Retrieves the session status.
STRING Retrieves the ASCII string data.
TRIMRECT Retrieves the session presentation space within the current trim
rectangle.
Item Function
SF Retrieves the destination/origin structured field data.
SFCOND Retrieves the query reply data.
Code Conversion
3270 5250 VT
Yes Yes Yes
where:
hDATA
typedef struct tagWCDDE_CONV
{
BYTE ddepoke[(sizeof(DDEPOKE)-1)];
char szSourceName[256]; // name of memory-mapped file
char szTargetName[256]; // name of memory-mapped file
BYTE ConvType; // Conversion method
WORD uSourceLength; // Length of source buffer
WORD uTargetLength; // Length of target buffer
}WCDDE_CONV;
Conversion Types
ConvType = 0x01 ASCII to EBCDIC
ConvType = 0x02 EBCDIC to ASCII
If (hMapFile == NULL)
{
MessageBox ("Could not create file-mapping Source object.");
return;
}
// Now treat buffer like local memory
strcpy((LPSTR)lpMapAddress, szConcersionString);
CloseHandle(hMapSFile);
// CODE ENDS
The Find Field function returns information about the specified field to the client.
It can be used in two ways.
where:
cfFormat
Identifies the format for the field information. This value can be
CF_DSPTEXT or CF_TEXT.
aFIELD
Is the atom that specifies the Find Field function. The string identified by
the atom can have different values depending on the value of cfFormat.
CF_DSPTEXT
If CF_DSPTEXT is specified for cfFormat then aFIELD must be an atom that
represents the string, FIELD. The PS position must be specified in a previous call to
the Set Presentation Space Service Condition function. This version will return
information only about the field which contains that position. The information will
be returned in a WM_DDE_DATA(hData, aFIELD) message where:
hData Represents
typedef struct tagFINDFIELD
{
unsigned char
data[sizeof(DDEDATA)-1];
unsigned short uFieldStart; //Field start position
unsigned short uFieldLength; //Field Length
unsigned char cAttribute; //Attribute character value
unsigned char ubReserved; //reserved, no information for client
} FINDFIELD;
CF_TEXT
If CF_TEXT is specified for cfFormat then aFIELD must be an atom that represents
the string, FIELD (pos, "XX") where:
pos Is the PS position
XX Is a code representing which field relative to pos for which information
will be returned. These codes are described below:
These codes must appear in quotes as demonstrated above. The information will
be returned in a WM_DDE_DATA(hData, aFIELD) message where:
hData Represents
typedef struct tagFINDFIELD_CF_TEXT
{
uchar data[sizeof(DDEDATA)-1];
uchar Fielddata[80];
} FINDFIELD_CF_TEXT;
For 3270:
For 5250:
"Formatted\t%01d\t%01d\t%01d\t%01d\t%01d\t%01d\t%04d\t%04d"
Get Keystrokes
3270 5250 VT
Yes Yes Yes
The Get Keystrokes function returns to the client the keystrokes that are
intercepted by the Start Keystroke Intercept function. The client sends the
following message to receive the keystroke information.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aKEYS) );
where:
The format for the keystrokes parameters is the same as for the Session Execute
Macro function SENDKEY command.
The Get Mouse Input function returns the latest mouse input intercepted by the
Start Mouse Input Intercept function to the client.
The client sends the following command to receive the mouse input information.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aMOUSE) );
where:
cfFormat
Identifies the format for the presentation space. Valid values are CF_TEXT
or CF_DSPTEXT. The structure of the mouse input data, in these two
formats, is shown below.
aMOUSE
Identifies the mouse input as the item.
If Personal Communications cannot return the mouse input information, one of the
following status codes is returned in the low-order byte of the wStatus word:
The Get Number of Close Requests function returns to the client the number of
the close requests that are intercepted by the Start Close Intercept function. The
client sends the following message to receive the number of the close requests.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aCLOSE) );
where:
cfFormat
Identifies the format for the close intercept information. This must be
CF_DSPTEXT.
aCLOSE
Identifies a close intercept data item.
The Get Operator Information Area (OIA) function returns a copy of the OIA to
the client. The client sends the following message to request the OIA.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aOIA) );
where:
cfFormat
Identifies the format for the OIA. For the OIA, this format must be
CF_DSPTEXT.
aOIA Identifies the operator information area as the item.
If Personal Communications cannot return the OIA, one of the following status
codes is returned in the low-order byte of the wStatus word:
The Get Partial Presentation Space function returns all or part of the session
presentation space to the client.
Note: The client must set the start PS position and either the PS length or End of
Field (EOF) flag by using the Set Presentation Space Service Condition
function before using this function. If the EOF flag is set to PCS_EFFECTEOF,
the function will return the entire field specified by the start PS position
The client sends the following command to get the presentation space.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aEPS) );
where:
cfFormat
Identifies the format for the presentation space. Valid values are CF_TEXT
or CF_DSPTEXT. The structure of the presentation space, in these two
formats, is shown below.
aEPS Identifies the session presentation space as the item.
Note: The following examples show how to obtain long pointers to the PS and the
PSFIELDS array.
lpDDE = (lpDDE_EPS_CF_DSPTEXT)GlobalLock(hData);
lpps = lpDDE->DDEeps.PSData + lpDDE->DDEeps.uPSOffset;
lppsfields = lpDDE->DDEeps.PSData + lpDDE->DDEeps.uFieldOffset;
Following the PS in the buffer is the following additional structure of fields that
compose the field list.
typedef struct tagFL_CF_TEXT
{
unsigned char Tab5[1]; /* Tab character
unsigned char PSFldCount[4]; /* Number of fields in the PS
unsigned char Tab6[1]; /* Tab character
PS_FIELD Field[1]; /* Field List Array
} FL_CF_TEXT, *lpFL_CF_TEXT;
Note: The following examples show how to obtain long pointers to the PS and the
PS_FIELD array.
lpDDE = (lpDDE_EPS_CF_TEXT)GlobalLock(hData);
lpps = lpDDE->DDEeps.PS;
lpps_field = lpDDE->DDEeps.PS
+ atoi(lpDDE->DDEeps.PSLENGTH)
+ ((atoi(lpDDE->DDEeps.PSROWS) -1) * 2) // CR/LF
+ 1 + 1 + 4 + 1; // Tabs + size of field count
The Get Presentation Space function returns the session presentation space to the
client. The client sends the following command to get the presentation space.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aPS) );
where:
cfFormat
Identifies the format for the presentation space. Valid values are CF_TEXT
or CF_DSPTEXT. The structure of the presentation space, in these two
formats, is shown below.
aPS Identifies the session presentation space as the item.
Note: The following examples show how to obtain long pointers to the PS and the
PSFIELDS array.
lpDDE = (lpDDE_PS_CF_DSPTEXT)GlobalLock(hData);
lpps = lpDDE->DDEps.PSData + lpDDE->DDEps.uPSOffset;
lppsfields = lpDDE->DDEps.PSData + lpDDE->DDEps.uFieldOffset;
Following the PS in the buffer is the following additional structure of fields that
compose the field list.
typedef struct tagPS_FIELD
{
unsigned char FieldStart[4];
unsigned char TabF1[1];
unsigned char FieldLength[4];
unsigned char TabF2[1];
unsigned char Attribute;
unsigned char TabF3[1];
} PS_FIELD, *lpPS_FIELD;
Note: The following example shows how to obtain long pointers to the PS and the
PS_FIELD array.
lpDDE = (lpDDE_PS_CF_TEXT)GlobalLock(hData);
lpps = lpDDE->DDEps.PS;
lpps_field = lpDDE->DDEps.PS
+ atoi(lpDDE->DDEps.PSSIZE)
+ ((atoi(lpDDE->DDEps.PSROWS) -1) * 2) // CR/LF
+ 1 + 1 + 4 + 1; // Tabs + size of field count
The Get Session Status function returns the status of the connected session. The
client sends the following message to request session status:
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aSSTAT) );
where:
cfFormat
Identifies the DDE format for the status information. The value used is
CF_TEXT.
aSSTAT
Identifies session status as the data item requested.
If Personal Communications cannot return the session status, one of the following
status codes is returned in the low-order byte of the wStatus word:
Note:
v The status of each field is updated each time the status is requested.
v A new field might be added in a future version of Personal Communications.
where:
cfFormat
Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aSYSCON
Identifies system configuration as the data item requested.
The Get System Formats function returns the list of Windows clipboard formats
supported by Personal Communications. The client application sends the following
message to retrieve the format list supported by Personal Communications:
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aFORMATS) );
where:
cfFormat
Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aFORMATS
Identifies formats as the data item requested.
The Get System Status function returns the status of each 3270 or 5250 session that
is available with the current Personal Communications configuration. The client
application sends the following message to retrieve the status data item:
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aSTATUS) );
where:
cfFormat
Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aSTATUS
Identifies status as the data item requested.
If Personal Communications cannot return the status data item, a DDE ACK
message is returned with an error code in the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aSTATUS)
The Get System SysItems function returns the list of data items available in the
Personal Communications system topic. The client application sends the following
message to get the system topic data items:
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aSYSITEMS) );
where:
cfFormat
Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aSYSITEMS
Identifies SysItems as the data item requested.
If Personal Communications cannot return the system data items, a DDE ACK
message is returned with an error code in the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aSYSITEMS)
The Get System Topics function returns the list of active DDE topics currently
supported by Personal Communications. The client application sends the following
message to the system topic to retrieve the list of topics that are currently active:
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aTOPICS) );
where:
cfFormat
Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aTOPICS
Identifies topics as the data item requested.
Note: The actual number of session topics supported depends on the number of
sessions currently opened. The client program should always query the
topics data item of the system topic to obtain the list of sessions currently
opened.
If Personal Communications cannot return the list of topics, a DDE ACK message
will be returned with an error code in the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aTOPICS)
where:
cfFormat
Identifies the format for the trim rectangle. This is CF_TEXT.
aTRIMRECT
Identifies trim rectangle as the data item requested.
If Personal Communications cannot return the trim rectangle, one of the following
status codes is returned in the low-order byte of the wStatus word:
The client application sends the following message to initiate a DDE conversation
with a session:
SendMessage( -1,
WM_DDE_INITIATE,
hClientWnd,
MAKELPARAM(aIBM327032, aSessionN) );
where:
aIBM327032
Identifies the application atom. The string used to create atom aIBM327032
is IBM327032. In the PC400, the application atom is aIBM525032 and the
string IBM525032 is used to create it.
The client application selects the conversation it wishes to communicate with from
the returned list of topics and terminates all other unwanted conversations.
The client sends the following command to initiate a structured field conversation:
SendMessage( -1,
WM_DDE_INITIATE,
hClientWnd,
MAKELPARAM(aIBM327032, aLUN_xxxx) );
Where:
aIBM327032
Identifies the application atom.
aLUN_xxxx
Identifies the topic atom. The string used to create atom aLUN_xxxx is LU
appended with the session ID A, B, ..., Z, appended with an underscore (_),
and appended with the user-defined string of any length.
PC/3270 Response
If PC/3270 can support a structured field conversation with the client application,
it returns an acknowledgment message with the following parameter:
WM_DDE_ACK(aIBM327032, aLUN_xxxx)
where:
aIBM327032
Identifies the application atom.
aSystem
Identifies the topic atom.
The Put Data to Presentation Space function sends an ASCIIZ data string to be
written into the host presentation space at the location specified by the calling
parameter. The client sends the following message to the session to send the string.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
PackDDElParam(WM_DDE_POKE,
hdata, aEPS) );
where:
hData Identifies a handle to a Windows global memory object that contains the
string to be sent to the session. The global memory object contains the
following structure:
typedef struct tagPutString
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
unsigned short uPSStart; /* PS Position
unsigned short uEOFflag; /* EOF effective switch
unsigned char szStringData[1]; /* String Data
} PUTSTRING;
If the presentation space does not accept the string data, Personal Communications
returns a negative ACK message containing one of the following status codes in
the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aEPS)
This function allows a client application to examine the presentation space for a
specified string in a specified area.
Note: The client must set the start PS position, string to be searched for, and either
the PS Length and Search Direction or End of Field (EOF) flag by using the
Set Presentation Space Service Condition function before using this
function. If the EOF flag is set to PCS_EFFECTEOF, the function will search the
entire field specified by the Start PS Position parameter.
The client sends the following message to search for the string.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELPARAM(cfFormat, aSTRING) );
where:
cfFormat
Identifies the format for the search information. This must be
CF_DSPTEXT.
aSTRING
Identifies the search data item.
If Personal Communications cannot return the start position of the string, one of
the following status codes is returned in the low-order byte of the wStatus word:
Send Keystrokes
3270 5250 VT
Yes Yes Yes
The Send Keystrokes function sends keystrokes to the connected session. The
client sends the following message to the session to send keystrokes.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
PackDDElParam(WM_DDE_POKE,
hData, aKEYS) );
where:
hData Identifies a handle to a Windows global memory object that contains the
keystrokes to be sent to the session. The global memory object contains the
following structure:
typedef struct tagKeystrokes
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
unsigned short uTextType; /* Type of keystrokes
unsigned short uRetryCount; /* Retry count 1 .. 16
unsigned char szKeyData[1]; /* Keystrokes
Note: If the keystrokes are pure text, then specifying PCS_PURETEXT will
transfer the keystrokes to the host in the fastest possible manner. If
PCS_HLLAPITEXT is specified, then the keystroke data can contain
HLLAPI commands interspersed with the text.
aKEYS
Identifies keystrokes as the item.
You can issue commands and macros with the DDE_EXECUTE function. The
DDE_EXECUTE function passes command strings to Personal Communications.
The command strings must conform to DDE specifications. Refer to Microsoft
Windows Software Development Kit Guide to Programming for more information about
the DDE command syntax.
Note:
v Enclose values that contain nonalphanumeric characters or blanks in double
quotation marks ("value value").
v To include a double quotation mark within a string, type it twice (for example,
"This is a double quotation mark:""").
v The maximum length for any command is 255 characters.
WINDOW Command
[WINDOW(action[, "name"])]
KEYBOARD Command
[KEYBOARD(action)]
SEND Command
[SEND("pcfilename","hostfilename","options")]
Any combination of the following file transfer options can be included in options:
MVS, VM, CICS, QUIET, OS/400, and emulation-specific transfer options,
separated by spaces.
Refer to Administrator's Guide and Reference for more information about the transfer
options.
RECEIVE Command
[RECEIVE("pcfilename","hostfilename","options")]
Any combination of the following file transfer options can be included in options:
MVS, VM, CICS, QUIET, OS/400, and emulation-specific transfer options,
separated by spaces.
Refer to Administrator's Guide and Reference for more information about the transfer
options.
SENDKEY Command
[SENDKEY(token,token)]
Examples:
1. To logon
[SENDKEY("Logon")]
2. To get reader list
[SENDKEY("RDRL", enter)]
WAIT Command
[WAIT("[time out][wait condition]")]
where:
hData
Identifies a handle to a Windows global memory object that contains the
cursor positioning information in the following structure:
typedef struct tagSETCURSOR
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
unsigned short uSetCursorType; /* Cursor Set Type
unsigned short uSetCursor1; /* Cursor Row or PS Offset
unsigned short uSetCursor2; /* Cursor Col
} SETCURSOR;
This function specifies the mouse input to be intercepted. The client sends the
following command to set the mouse event to be intercepted.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
PackDDElParam(WM_DDE_POKE,
hData, aMOUSE) );
where:
hData Identifies a handle to a Windows global memory object that specifies the
condition of intercepting the mouse input.
If the format is CF_TEXT, the client program sends the condition in the
following structure:
typedef struct tagSETMOUSE_CF_TEXT
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
unsigned char zMouseCondition[1];
} SETMOUSE_CF_TEXT;
If the format is CF_DSPTEXT, the client program sends the condition in the
following structure:
typedef struct tagSETMOUSE_CF_DSPTEXT
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
BOOL bLeftButton; /* Enable intercepting left button
BOOL bRightButton; /* Enable intercepting right button
BOOL bMiddleButton; /* Enable intercepting middle button
BOOL bSingleClick; /* Enable intercepting single click
BOOL bDoubleClick; /* Enable intercepting double click
BOOL bRetrieveString; /* Enable intercepting retrieve string
} SETMOUSE_CF_DSPTEXT;
aMOUSE
Identifies the mouse as the item.
The client must specify the Set Presentation Space Service Condition function
before invoking the functions listed above. The conditions set by this function
remain in effect until the next Set Presentation Space Service Condition function
is called. The client sends the following message to set the condition:
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
PackDDELParam(WM_DDE_POKE,
(hData, aEPSCOND) );
where:
hData
Identifies a handle to a Windows global memory object containing:
typedef struct tagPSSERVCOND
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
unsigned short uPSStart; /* PS Position
unsigned short uPSLength; /* Length of String or PS
unsigned short uSearchDir; /* Direction for search
unsigned short uEOFflag; /* EOF effective switch
unsigned char szTargetString[1]; /* Target String
} PSSERVCOND;
This function sets the condition for the DDE_ADVISE of the Start Session Advise
function. The client can specify a search string and a region of the screen. When
the advise condition is met, the server notifies the client of the condition according
to the options specified by the Start Session Advise function.
Note: The client must specify the Set Session Advise Condition function before
invoking Start Session Advise. If the advise condition is set after the Start
Session Advise function is started, the advise condition will be ignored and
the client will receive a negative ACK message. See “Start Session Advise”
on page 272 for more information about starting the advise.
The client sends the following message to set the advise condition.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
PackDDElParam(WM_DDE_POKE,
(hData, aPSCOND) );
where:
hData Identifies a handle to a Windows global memory object containing:
typedef struct tagSEARCHDATA
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
unsigned short uPSStart; /* PS Position of string
unsigned short uPSLength; /* Length of String
BOOL bCaseSensitive; /* Case Sensitive TRUE=YES
unsigned char SearchString[1]; /* Search String
} SEARCHDATA;
The Set Structured Field Service Condition function passes the Query Reply data
provided by the client application.
Note: The client must call the Set Structured Field Service Condition function
before invoking the Start Read SF function or the Write SF function.
where:
hData Identifies a handle to a Windows global memory object containing:
typedef struct tagSFSERVCOND
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
unsigned short uBufferLength; /* Buffer size of Read_SF
unsigned short uQRLength; /* Length of Query Reply dat
unsigned char szQueryReply[1]; /* Query Reply data
} SFSERVCOND;
PC/3270 Response
PC/3270 checks the Query Reply ID and Type (not DOID) and the length. If they
are valid, then PC/3270 returns an ACK message:
WM_DDE_ACK(wStatus, aSFCOND)
If PC/3270 cannot perform the Set Structured Field Service Condition function,
then PC/3270 returns a negative ACK message containing one of the following
return codes in the low-order byte of wStatus:
The Start Close Intercept function allows a client application to intercept close
requests generated when a user selects the close option from the emulator session
window. This function intercepts the close request and discards it until the Stop
Close Intercept function is requested. After using this function, the client receives
DATA messages notifying it that close requests occurred (CLOSE).
where:
hOptions
Is a handle to a Windows global memory object DDEADVISE structure.
If the value of fDeferUpd is 1, DDE Data messages will be sent to the
client application with the hData set to NULL. The client must then issue a
DDE REQUEST to request the data item.
Once the intercept starts, the client receives DATA messages notifying it that the
close request is intercepted:
WM_DDE_DATA(hData, aCLOSE)
where:
hData Identifies a handle to a Windows global memory object containing:
typedef struct tagCLOSEREQ
{
unsigned char data[(sizeof(DDEDATA)-1)];
unsigned short uCloseReqCount; /* Number of the close requests.
} CLOSEREQ;
The DATA messages continue until a Stop Close Intercept message is sent to
Personal Communications.
The Start Keystroke Intercept function allows a client application to filter any
keystrokes sent to a session by a terminal operator. After a call to this function,
keystrokes are intercepted, and the client receives them (KEYS).
where:
hOptions
Is a handle to a Windows global memory object DDEADVISE structure.
If the value of fDeferUpd is 1, DDE Data messages are sent to the client
application with the hData set to NULL. The client then issues a DDE
REQUEST to request the data item.
If the value of fAckReq is 1, the server does not notify the client of further
keystrokes until the server receives an ACK message from the client in
response to any previous keystrokes notification.
The cfFormat field specifies the format to send the keystrokes when the
keystroke is sent by a terminal operator. (Must be CF_DSPTEXT.)
aKEYS
Identifies keystrokes as the item.
Once the intercept has started, the client receives DATA messages notifying it that
the keystroke is intercepted:
WM_DDE_DATA(hData, aKEYS)
The DATA messages continue until a Stop Keystroke Intercept message is sent to
Personal Communications. The format of the data item is the same format as if the
client requested the data item via a DDE_REQUEST.
The Start Mouse Input Intercept function allows a client application to intercept
mouse input when a terminal operator presses the mouse button on an emulator
session window. After calling this function, the client receives DATA messages that
include the PS position where mouse input occurred.
where:
hOptions
Is a handle to a Windows global memory object DDEADVISE structure.
If the value of fDeferUpd is 1, DDE Data messages will be sent to the
client application with the hData set to NULL. The client must then issue a
DDE REQUEST to request the data item.
If the value of fAckReq is 1, the server does not notify the client of further
structured field data until the server receives an ACK message from the
client in response to any previous notification.
The cfFormat field specifies the format to send the data item has been
updated.
aMOUSE
Identifies the mouse as the item.
Once the Mouse Input Intercept starts, the client receives DATA messages of the
structured field:
WM_DDE_DATA(hData, aMOUSE)
where:
hData
If the format is CF_TEXT, Personal Communications returns the mouse
input information in the following format:
typedef struct tagMOUSE_CF_TEXT
{
unsigned char data[(sizeof(DDEDATA)-1)];
unsigned char PSPos[4]; /* PS Offset - Mouse position
unsigned char Tab1[1]; /* Tab character
unsigned char PSRowPos[4]; /* ROW number of Mouse position
unsigned char Tab2[1]; /* Tab character
unsigned char PSColPos[4]; /* Col number of Mouse position
unsigned char Tab3[1]; /* Tab character
unsigned char PSSize[4]; /* Size of Presentation Space
The DATA messages continue until a Stop Mouse Input Intercept message is sent
to Personal Communications.
Start Read SF
3270 5250 VT
Yes No No
The Start Read SF function allows a client application to read structured field data
from the host application. After using this function, the client receives DATA
messages notifying it that close requests occurred.
Note: Before using this function, the client must call the Set Structured Field
Service Condition function to pass the Query Reply data to the server.
PC/3270 Response
PC/3270 receives the Start Read SF and returns an ACK message if it can start the
Read SF. Otherwise a negative ACK message is returned to the client with one of
the following return codes in the low-order byte of the wStatus field:
WM_DDE_ACK(wStatus, aSF)
Once the Read SF has started, the client receives DATA messages of the structured
field:
WM_DDE_DATA(hData, aSF)
where:
hData Identifies a handle to a Windows global memory object containing:
typedef struct tagMOUSE_CF_DSPTEXT
{
unsigned char data[(sizeof(DDEDATA)-1)];
unsigned short uPSPos; /* PS Offset - Mouse position
unsigned short uPSRowPos; /* ROW number - Mouse position
unsigned short uPSColPos; /* Col number - Mouse position
unsigned short uPSSize; /* Size of Presentation Space
unsigned short uPSRows; /* Row number of PS
unsigned short uPSCols; /* Column number of PS
unsigned short uButtonType; /* Type of clicked mouse button
unsigned short uClickType; /* Type of clicking
unsigned char zClickString[1]; /* Retrieved string
} MOUSE_CF_DSPTEXT;
The DATA messages continue until a Stop Read SF message is sent to PC/3270.
The Start Session Advise function establishes a link between the Personal
Communications session and the client. This lets the client receive updates of the
presentation space (PS), the operator information area (OIA), or the trim rectangle
(TRIMRECT) when the data item is updated.
Note: If the client application needs conditional notification when the presentation
space is updated, set an advise condition prior to invoking the advise
function for the presentation space. See “Set Session Advise Condition” on
page 263.
where:
hOptions
Is a handle to a Windows global memory object DDEADVISE structure.
This is the structure:
typedef struct tagDDEADVISE
{
unsigned reserved:14; // Reserved
unsigned fDeferUpd:1; // Send notification only
unsigned fAckReq:1; // Client will ACK all notices
WORD cfFormat; // Clipboard format to use
} DDEADVISE, *lpDDEADVISE;
If the value of fDeferUpd is 1, DDE Data messages are sent to the client
application with the hData set to NULL. The client must then issue a DDE
REQUEST to request the data item.
If the value of fAckReq is 1, the server does not notify the client of further
changes to the data item until the server receives an ACK message from
the client in response to any previous update notification.
The cfFormat field specifies the format to send the data item when the
item has been updated.
Once the advise has started, the client receives DATA messages notifying it that the
data item (PS, OIA, or TRIMRECT) has changed:
WM_DDE_DATA(hData, aItem)
The DATA messages continue until a Stop Session Advise message is sent to
Personal Communications. The format of the data item is the same as if the client
requested the data item via a DDE_REQUEST.
The Stop Close Intercept function ends a client application's ability to intercept
close requests. The client sends the following command to perform the Stop Close
Intercept function.
PostMessage( hServerWnd,
WM_DDE_UNADVISE,
hClientWnd,
MAKELPARAM(NULL, aCLOSE) );
where:
aCLOSE
Identifies close intercept as the item.
where:
aKEYS
Identifies keystrokes as the item.
The Stop Mouse Input Intercept function ends a client application's ability to
intercept mouse input.
The client sends the following command to perform the Stop Mouse Input
Intercept function.
PostMessage( hServerWnd,
WM_DDE_UNADVISE,
hClientWnd,
MAKELPARAM(NULL, aMOUSE) );
Stop Read SF
3270 5250 VT
Yes No No
The Stop Read SF function ends a client application's ability to read structured
field data.
The client sends the following command to perform the Stop Read SF function.
PostMessage( hServerWnd,
WM_DDE_UNADVISE,
hClientWnd,
MAKELPARAM(NULL, aSF) );
where:
aSF Identified structured field as the item.
PC/3270 response
If PC/3270 can perform the DDE_UNADVISE, PC/3270 returns an ACK message
containing positive status information to the client:
WM_DDE_ACK(wStatus, aSF)
where:
aItem Specifies the item of information being requested; in this case, the value
can be PS, OIA, TRIMRECT, or NULL.
If the value of aItem is NULL, then the client has requested termination of all
active notifications for the conversation.
The Terminate Session Conversation function disconnects the client from the
Personal Communications session the client has previously started a conversation
with.
The Terminate Structured Field Conversation function disconnects the client from
a structured field conversation.
PC/3270 Response
PC/3270 acknowledges the terminate command with a terminate message:
WM_DDE_TERMINATE
When the user closes a Personal Communications session, any global memory
blocks that were allocated by Personal Communications will be freed by Windows.
This can cause problems for the client if the client retains any of these global
memory objects for long periods of time. If the client application needs to keep the
information in a global memory item for a long time, it is suggested that the client
make a copy of global memory item into a global memory item the client
application owns.
The Write SF function allows a client application to write structured field data to
the host application.
Note: The client must call the Set Structured Field Service Condition function
before invoking the Write SF function.
The client sends the following message to write structured field data.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
PackDDELParam(WM_DDE_POKE,
hData, aSF) );
where:
hData Identifies a handle to a Windows global memory object containing:
typedef struct tagWRITESF
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
unsigned short uSFLength; /* Length of SF data
unsigned char Work[8]; /* Work area
unsigned char szSFData[1]; /* SF data
} WRITESF;
PC/3270 Response
PC/3270 receives structured field data and sends it to the host application. If the
data transmission completes successfully, then PC/3270 returns an ACK message:
WM_DDE_ACK(wStatus, aSF)
The following data hierarchy details the menu map Personal Communications
expects when adding a dynamic menu item and submenu to a session menu bar:
POPUP "MyMenu"
BEGIN
MENUITEM "Send Files to Host", SEND
MENUITEM "Receive Files from Host", RECEIVE
MENUITEM SEPARATOR
MENUITEM "Convert Files", CONVERT
END
When the user selects a menu item from the new menu, Personal Communications
will send a DDE Initiate with 3270MenuN or 5250MenuN as the application and
itemN token as the topic. If an ACK is received from the DDE application,
Personal Communications will inhibit the session from accepting user input. The
menu client application can then display a dialog, and so on. When the menu
server application has completed processing of the menu item, it will send a DDE
Terminate to signal Personal Communications the process is complete. Personal
Communications will then reenable the window for the user.
When the user selects a menu item from the new menu, Personal Communications
will send a DDE DATA with aSELECTMENU as the item. When Personal
Communications sends DDE DATA to the client application, Personal
Communications will inhibit the session from accepting user input. The menu
client application can then display a dialog, and so on. When the menu client
application has completed processing of the menu item, it will send a DDE ACK to
signal Personal Communications the process is complete. Personal
Communications will then reenable the window for the user.
The Change Menu Item function appends, deletes, inserts, modifies, and removes
menu items. The client sends the following message to the session to change a
menu.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
PackDDElParam(WM_DDE_POKE,
hData,aCHANGEMENU));
where:
hData
Identifies a handle to a Windows global memory object that contains the
requests for changing a menu. The global memory object contains the
following structure:
typedef struct tagChangeMenu
{
unsigned char poke[(sizeof(DDEPOKE)-1)];
HWND hMenu; /* Window handle of menu item
unsigned long wIDNew; /* Menu ID of new menu item
unsigned short wPosition; /* The position of menu item
unsigned short wOperation; /* Specifies the operation
unsigned short wFlags; /* Specifies the options
unsigned char szItemName[1]; /* String of the item
} CHANGEMENU;
The Create Menu Item function requests Personal Communications to add a menu
item to the menu bar. A pop-up menu will be created at the same time, but it is
initially empty and can be filled with menu items by using this function. The
string of the new menu item that will be added to a top-level menu bar, is also
specified by using the Change Menu Item function.
where:
cfFormat
Identifies the format for the ID of the new menu item. The valid value is
CF_DSPTEXT.
aCREATEMENU
Identifies the create menu item.
where:
hData
Identifies a handle to a windows global memory object that contains the
handle of the menu item. The global memory object contains the following
structure:
typedef struct tagCreateMenu
{
unsigned char data[(sizeof(DDEDATA)-1)];
or
WM_DDE_ACK(wStatus,aCREATEMENU)
If Personal Communications cannot create a menu item, one of the following status
codes is returned in the low-order byte of the wStatus word:
The client application sends the following message to initiate a DDE conversation
with a menu:
SendMessage( -1,
WM_DDE_INITIATE,
hClientWnd,
MAKELPARAM(aIBM327032,SN));
where:
aIBM327032
Identifies the application atom. The string used to create atom aIBM327032
is IBM327032. In the PC400, the application atom is aIBM525032 and the
string IBM525032 is used to create it.
SN
Identifies the topic atom. The string used to create atom a3270MenuSN is
3270MenuS appended with the session ID A, B, ..., Z. In the PC400, the
topic atom is a5250MenuSN and the string 5250MenuS appended with the
session ID A, B, ..., Z. is used to create it.
The Start Menu Advise function allows a client application to process a user
defined routine when the menu item that is added by the client application, is
selected. After using this function, the client receives DATA messages indicating
which menu item is selected.
where:
hOptions
Is a handle to a Windows global memory object with the following
structure:
typedef struct tagOPTIONS
{
unsigned reserved:14; // Reserved
unsigned fDeferUpd:1; // Send notification only
// (Must be 0)
unsigned fAckReq:1; // Client will ACK all notices
// (Must be 1)
WORD cfFormat; // Always CF_DSPTEXT
} OPTIONS,FAR *lpOPTIONS;
aSELECTMENU
Identifies a menu advise as the item.
WM_DDE_ACK(wStatus,aSELECTMENU)
Once the menu item (added to the client application) is selected, the client receives
DATA messages notifying it which menu item is selected:
WM_DDE_DATA(hData,aSELECTMENU)
where:
hData
The DATA messages continue until a Stop Menu Advise message is sent to
Personal Communications.
The Stop Menu Advise function ends a client application's ability to process a
user-defined routine when the menu item added by the client application is
selected. The client sends the following command to perform the Stop Menu
Advise function.
PostMessage( hServerWnd,
WM_DDE_UNADVISE,
hClientWnd,
MAKELPARAM(NULL,aSELECTMENU));
where:
aSELECTMENU
Identifies a menu advise as the item.
The client application needs three names (application program name, topic name,
and item name) that are recognized by the server application to start the
conversation to exchange data. The client application starts a DDE conversation
with the server application by specifying the application program and topic names,
and defines the exchange data by specifying the item name.
Personal Communications has a function as a DDE server, and can establish DDE
conversations with other Windows application programs (Microsoft Visual Basic,
Microsoft Excel, Microsoft Word) that have DDE client functions.
Application
As a Windows DDE server, Personal Communications supports application
name IBM327032 or IBM525032 for 32-bit applications, IBM3270 or
IBM5250 for 16-bit applications.
Topic Topic specifies the corresponding topic in the application. The following
table shows the topics available to the users:
Table 22. Topics for Personal Communications
Topic Conversation Name Conversation Type
System System conversation Cold link
SessionA, SessionB, ..., SessionZ Session conversation Cold link and hot link
Item The client application programs can exchange data and information with
Personal Communications. Types of data and information are specified by
item name.
Explanations for topic conversation procedures and data items to be used follow.
System Conversation
To use the Personal Communications system DDE interface, do as follows:
1. Start the system conversation.
2. Request system information.
3. Terminate the system conversation.
Session Conversation
To use the Personal Communications session DDE interface, do as follows:
1. Start the session conversation.
2. Use DDE functions (Request, Poke, Execute).
Requesting Data
After starting the DDE conversation, the client application can request data using
the DDE function. Session information can be requested by specifying the
following item names in the DDE function (Request) in the client application:
Executing Commands
After starting a DDE conversation, the client application can send commands to
the Personal Communications session window using the DDE functions. Specify
the command in the DDE function (Execute) of the client application. See “Session
Execute Macro” on page 250 for details.
Returned Information: See “Get System Configuration” on page 240 for details.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the item name
(Formats).
If Personal Communications do not return the format data item, it may be because:
v An incorrect item name was specified.
v A system error has occurred.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the item name
(SysCon).
Returned Information: See “Get System Status” on page 242 for details.
If Personal Communications do not return the status data item, it may be because:
v An incorrect item name was specified.
v A system error has occurred.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the item name
(SysItems).
If Personal Communications do not return the system data item, it may be because:
v An incorrect item name was specified.
v A system error has occurred.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the item name
(Topics).
If Personal Communications do not return the system data item, it may be because:
v An incorrect item name was specified.
v A system error has occurred.
Find Field
The Find Field function passes the field information to the client application.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the foregoing
item name.
Returned
Field Information Explanation
Formatted/Unformatted Formatted, Whether the presentation space is formatted
Unformatted or unformatted. If Unformatted is specified,
no other field information will be returned.
Unprotected/Protected N 0 = Unprotected data field. 1 = Protected
data field.
A/N N 0 = Alphanumeric. 1 = Numeric.
The following table shows the field information that PC400 returns:
Returned
Field Information Explanation
Formatted/Unformatted Formatted, Whether the presentation space is formatted
Unformatted or unformatted. If Unformatted is specified,
no other field information will be returned.
Field attribute N 0 = Not field attribute byte. 1 = Field
attribute byte.
Visibility N 0 = Nondisplay. 1 = Display.
Unprotected/Protected N 0 = Unprotected data field. 1 = Protected
data field.
Intensity N 0 = Normal. 1 = High.
Field Type N 0 = Alphanumeric: all characters allowed. 1
= Alphabet only: uppercase and lowercase
letters, comma, period, hyphen, blank, and
Dup key allowed. 2 = Numeric shift:
automatic shift for numerics. 3 = Numeric
only: numbers 0–9, comma, period, plus,
minus, blank, and Dup key allowed. 5 =
Digits only: numbers 0–9 and Dup key
allowed. 6 = Magnetic stripe reader data
only. 7 = Sighed numeric: numbers 0–9,
plus, minus, and Dup key allowed.
MDT N 0 = Field is not changed. 1 = Field is
changed.
Field start offset NNNN Field starts this field position.
Field length NNNN Field length.
Note: An item in the IBM Personal Communications Version 3.1 format is also
supported.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the foregoing
item names.
Returned
Field Information Explanation
PS start position NNNN Specified by pos parameter
PS length NNNN Specified by len parameter
PS rows NNNN Specified by the number of rows
PS columns NNNN Specified by the number of columns
PS NNNN PS data starts from this position
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the item name
(PS).
Returned
Field Information Explanation
PS size NNNN Size of presentation space
PS rows NNNN Number of rows
PS columns NNNN Number of columns
PS NNNN PS data starts from this position
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the item name
(SSTAT).
Note: An item in the IBM Personal Communications Version 3.1 format is also
supported.
The current specified PS trim rectangle is used unless the client application
specifies the PS trim rectangle in the parameter.
These functions are available only for single-byte languages. They are not available
for Thai, Hindi, double-byte languages, or bidirectional sessions.
You can enable the Trim Rectangle Word by Word functions by adding the
following keyword to the PCSWIN.INI file:
[Edit]
TrimRectJumpToWord=Y
When the feature is enabled, Mark Word Left can be invoked with the key
combination Ctrl+Shift+LeftArrow. Mark Word Right can be invoked with the
Ctrl+Shift+Right Arrow key combination.
The Mark Word Left and Mark Word Right functions can also be added to the
popup keypad, a macro or script, or to a mouse button.
Table 23. Mark Word Left
Token name mark word left
Face name MrkWd<
Context Available
Keyboard Yes
Popup keypad Yes
Mouse Yes
Macro Yes
Keyboard/macro function Yes
3270 SBCS Yes
3270 DBCS No
3270 AEA (SBCS) Yes
5250 SBCS Yes
5250 DBCS No
VT SBCS Yes
Context Available
Keyboard Yes
Autocopy
This feature enables you to automatically copy the trim rectangle text to the
clipboard.
After you mark an area on the screen with a trim rectangle, the text inside the
Trim Rectangle is automatically copied to the clipboard. When an existing trim
rectangle is moved to another screen area, the text inside the new trim rectangle is
automatically copied to the clipboard.
Enable the feature by adding the following keywords to the .WS profile. Both
keywords must be enabled in order for Autocopy to work correctly.
[Edit]
AutoCopy=Y
TrimRectRemainAfterEdit=Y
Returned
Field Information Explanation
PS PS data starts from this position.
The client application should start the DDE conversation by specifying the DDE
function (Initiate) of the client application with the topic name (SessionA, SessionB,
..., SessionZ).
Note: An item in the IBM Personal Communications Version 3.1 format is also
supported.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Poke) of the client application with the foregoing
item name.
Note: An item in the IBM Personal Communications Version 3.1 format is also
supported.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Request) of the client application with the foregoing
item names.
Returned
Field Information Explanation
String start offset NNNN, None "None" is returned if the string is not
found.
Refer to “Session Execute Macro” on page 392 for details of commands and macro
strings.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Execute) of the client application.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Poke) of the client application with the foregoing
item names.
Use the DDE function (Terminate) of the client application to terminate the DDE
conversation.
Specify the Personal Communications application name and the foregoing topic
name in the DDE function (Initiate) of the client application to start a DDE
conversation.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Advise) of the client application with the foregoing
item name.
Returned
Field Information Explanation
Number of PS close request NNNN When a Close request is generated, the
client application receives "0001".
The client application can use the Personal Communications DDE function by
specifying the DDE function (Advise) of the client application with the foregoing
item name.
Returned
Field Information Explanation
Keys Refer to Table 19 on page 253.
Note: An item in the IBM Personal Communications Version 3.1 format is also
supported.
Note: An item in the IBM Personal Communications Version 3.1 format is also
supported.
The current specified presentation space trim rectangle is used unless the
client application specifies the presentation space trim rectangle in the item
name parameter. This parameter value can be used when TRIMRECT is
specified as the item name.
The client application can use the Personal Communications DDE function by
specifying the DDE function (Advise) of the client application with the foregoing
item name.
The client application can use the Personal Communications DDE function by
specifying the DDE function, Unadvise, of the client application with the foregoing
item name.
The client application can use the Personal Communications DDE function by
specifying the DDE function, Unadvise, of the client application with the foregoing
item name.
The item name must be the same item name that was used when Start Session
Advise was called.
The client application can use the Personal Communications DDE function by
specifying the DDE function, Unadvise, of the client application with the foregoing
item name.
Use the DDE function (Terminate) of the client application to terminate the DDE
conversation.
’***************************************************
’*** ***
’*** Initiate System Conversation ***
’*** ***
’***************************************************
’
’ Start DDE Conversation with system
’
Sub Command1_Click ()
On Error GoTo ErrHandlerInit
Dim COLD As Integer
COLD = 2
FunctionComp& = True
DoEvents
Text1.LinkTopic = "|System"
Text1.LinkMode = COLD
ErrHandlerInit:
FunctionComp& = False
Resume Next
End Sub
Text1.LinkItem = "Formats"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
’***************************************************
’*** ***
’*** Get System Status ***
’*** ***
’***************************************************
’
’ Requests each Personal Communications’ Session Status
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkItem = "Status"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Get System Configuration ***
’*** ***
’***************************************************
’
’ Requests Personal Communications’ System Configuration Values
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkItem = "SysCon"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Get System SysItems ***
’*** ***
’***************************************************
’
’ Requests a list of Data Items for
’ Personal Communications System Conversation
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkItem = "SysItems"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Get System Topics ***
’*** ***
’***************************************************
’
’ Requests a list of Personal Communications’ Topics
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkItem = "Topics"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Terminate System Conversation ***
’*** ***
’***************************************************
’
’ Terminates DDE Conversation with system
’
Sub Command3_Click ()
On Error GoTo ErrHandler
Dim NONE As IntegerTerm
NONE = 0
FunctionComp& = True
Text1.LinkMode = NONE
ErrHandlerTerm:
FunctionComp& = False
Resume Next
End Sub
’/*************************************************/
’/* */
’/* Session conversation */
’/* */
’/*************************************************/
DoEvents
Text1.LinkTopic = "|SessionA"
Text1.LinkMode = COLD
ErrHandlerInit:
FunctionComp& = False
Resume Next
End Sub
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Get Operator Information Area ***
’*** ***
’***************************************************
’
Text1.LinkItem = "OIA"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Get Partial Presentation Space ***
’*** ***
’***************************************************
’
’ Requests PS Data Bytes from PS Position from 100 to 1000
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkItem = "EPS(100,1000,1)"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Get Presentation Space ***
’*** ***
’***************************************************
’
’ Requests PS Data
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkItem = "PS"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
Text1.LinkItem = "SSTAT"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Get Trim Rectangle ***
’*** ***
’***************************************************
’
’ Requests PS Data in Current Specified Trim Rectangle
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkItem = "TRIMRECT"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Put Data to Presentation Space ***
’*** ***
’***************************************************
’
’ Writes string "Hello, World!" from PS Position 200
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Search for String ***
’*** ***
’***************************************************
’
’ Search forward for string "Hello!" from PS Position 1
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkItem = "STRING(1,1,""Hello!"")"
Text1.LinkRequest
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Session Execute Macro ***
’*** ***
’***************************************************
’
’ Maximize the Session
’
Sub Command2_Click ()
On Error GoTo ErrHandler
FunctionComp& = True
Text1.LinkExecute "[WINDOW(MAXIMIZE)]"
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Set Cursor Position ***
’*** ***
’***************************************************
’
’ Set Cursor Position (Row,Column) = (1,1)
’
Text1.Text = "R1C1"
Text1.LinkItem = "SETCURSOR"
Text1.LinkPoke
ErrHandler:
FunctionComp& = False
Resume Next
End Sub
’***************************************************
’*** ***
’*** Terminate Session Conversation ***
’*** ***
’***************************************************
’
’ Terminate DDE Conversation with session
’
Sub Command3_Click ()
On Error GoTo ErrHandlerTerm
Dim NONE As Integer
NONE = 0
FunctionComp& = True
Text1.LinkMode = NONE
ErrHandlerTerm:
FunctionComp& = False
Resume Next
End Sub
’/*************************************************/
’/* */
’/* Session conversation(Hot Link) */
’/* */
’/*************************************************/
’***************************************************
’*** ***
’*** Start Close Intercept ***
’*** ***
’***************************************************
’
’ Start Intercepting Close request
’
Sub Command1_Click ()
On Error GoTo ErrHandlerInit
Dim HOT As Integer
HOT = 1
FunctionComp& = True
DoEvents
Text1.LinkTopic = "|SessionA"
Text1.LinkItem = "CLOSE"
ErrHandlerInit:
FunctionComp& = False
Resume Next
End Sub
DoEvents
Text1.LinkTopic = "|SessionA"
Text1.LinkItem = "KEYS"
Text1.LinkMode = HOT
ErrHandlerInit:
FunctionComp& = False
Resume Next
End Sub
DoEvents
Text1.LinkTopic = "|SessA_PS"
Text1.LinkItem = "PS(1,6,1,""Hello!"")"
Text1.LinkMode = HOT
Exit Sub
ErrHandlerInit:
FunctionComp& = False
Resume Next
End Sub
DoEvents
Text1.LinkTopic = "|SessA_TRIMRECT"
Text1.LinkItem = "TRIMRECT(1,1,20,40)"
Text1.LinkMode = HOT
ErrHandlerInit:
FunctionComp& = False
Resume Next
End Sub
DoEvents
Text1.LinkTopic = "|SessA_OIA"
Text1.LinkItem = "OIA"
Text1.LinkMode = HOT
ErrHandlerInit:
FunctionComp& = False
Resume Next
End Sub
Text1.LinkMode = NONE
ErrHandlerTerm:
FunctionComp& = False
Resume Next
End Sub
Note: SRPI is not available on Personal Communications for iSeries and will not
work when connected to an iSeries, eServer i5, or System i5 host.
You must also link it with the SRPI import library, PCSCAL32.LIB for 32-bit and
PCSCALLS.LIB for 16-bit.
SRPI Compatibility
PC/3270 supports the SRPI function with:
v SRPI interface is the same as Personal Communications Version 3.1.
v The SRPI interface is usable via a host connect of the emulator in all modes
(except asynchronous and Control Unit Terminal connection) when the physical
connection to the host is through a token ring or a coaxial cable, or through
SNA or non-SNA protocols.
v If a call is made to the SRPI interface but there is no response from the host due
to a communication failure, an associated error is returned to the caller.
v SRPI and EHLLAPI are capable of concurrent operations.
v SRPI is supported only for C requester.
v Server Alias is not supported.
v The 3270 screen update notify is not supported.
Note: For information about a corresponding interface for servers on the IBM host
computer, see one of the following publications:
v TSO/E Version 2 Guide to the Server-Requester Programming Interface
v IBM Programmer's Guide to the Server-Requester Programming Interface for
VM/System Product
See Figure 6 for an illustration of the workstation and host computer relationship.
When a workstation SRPI requester issues the SEND_REQUEST verb using SRPI:
1. The SRPI router converts the request into a structure that the host computer
router recognizes.
2. The SRPI router passes the request to the host computer router, using the
appropriate 3270 terminal emulation session.
3. The host computer router passes the request to the appropriate host computer
server.
4. The host computer server processes the request and passes a reply back to the
host computer router.
5. The host computer router passes the reply back to the SRPI router.
6. The SRPI router converts and returns the reply to the originating SRPI
requester application. for See Figure 7 for an illustration of the requester and
server flow.
SEND_REQUEST Parameters
The SRPI router sends the request to the host computer using the communication
facilities provided by 3270 terminal emulation. SRPI returns control to the SRPI
requester with an appropriate return code, optional parameters, and optional data.
The parameters and data associated with the SEND_REQUEST function are
described in Table 25 on page 332 and in Table 26 on page 334.
Supplied Parameters
Table 25. Parameters Supplied by the SRPI Requester
Required/
Name of Parameter Optional Default Value Description
Function ID Optional 0 A 2-byte unsigned binary
number that specifies the server
function being requested. Values
of 0 through 65535 are valid for
specification by an SRPI
requester.
Returned Parameters
Table 26. Parameters Returned to the SRPI Requester
Name of Parameter Description
SRPI return code A 4-byte value that specifies the results of the
SEND_REQUEST execution. See Appendix D, for a
complete description of SRPI return codes.
Server return code A 4-byte value returned by the server. The contents and
meaning of the return status are defined by the requester or
the server, but the length of the field is always 32 bits.
Replied parameter length A 2-byte unsigned binary storage location that specifies the
number, in bytes, of parameters returned by the server.
Values of 0 through 32763 are valid. A value of 0 indicates
that no reply parameters were received from the server.
Replied data length A 2-byte unsigned binary storage location that specifies the
length in bytes of the data returned by the server. Values of
0 through 65535 are valid. A value of 0 indicates that no
reply data was received from the server.
Notes:
1. You can set the default values by using the appropriate request record
initialization function.
2. The server name is used to route the SEND_REQUEST to a 3270 session and
to invoke the host server.
3. SRPI requesters and servers determine the contents and meaning of the
application data and parameters pointed to by the addresses in the connectivity
programming request block (CPRB).
Invoking SEND_REQUEST
When an application invokes SEND_REQUEST, it appears to the program that the
main routine (the local application) calls a subroutine (the remote application). The
programmer who writes the requester application must perform the following
tasks:
1. Obtain storage for the connectivity programming request block (CPRB).
2. Initialize the CPRB. This involves setting the default values and completing the
application parameters.
PC/3270 provides initialization routines and macros for each supported
language. These initialization facilities insulate the application from the CPRB
mapping and call mechanisms.
3. Call the SRPI dynamic link library (DLL) by issuing SEND_REQUEST.
4. Validate the SRPI return code received in the CPRB.
Performance Considerations
The size of the data transfer buffers used by the SRPI router to exchange data with
the host computer is calculated automatically by PC/3270. If your SRPI requester
produces requests that transfer large blocks of data to and from the server,
performance might be improved by overriding the data transfer buffer size
calculated by PC/3270. This is accomplished by changing the definition of the
logical 3270 display terminals used for SRPI.
C Requesters
This section is for programmers who want to write a requester in the C language.
It describes:
v C send_request function
v SRPI record definition
v Send_request function definition
C send_request Function
The send_request parameters are grouped into a single C structure of type
UERCPRB. The init_send_req_parms function is provided to initialize all
send_request parameters in the UERCPRB structure to their defaults. This allows
the default values to be set once for parameters not used by a requester. The
send_request function is provided to make synchronous calls to the server
program.
The send_request function copies the contents of the UERCPRB structure into a
connectivity programming request block (CPRB) and calls the PCSSRP32.DLL.
After the server has completed its processing, the send_request procedure copies
the returned parameters from the CPRB into the UERCPRB structure and returns
control to the C application.
If the request parameters or data consist of several structures, the application must
convert the data or parameters into a single flat structure that consists of a
contiguous sequence of bytes that are stored in a buffer. The requesting program
must package the request parameters and data in a format recognizable by the
server.
UERCPRB is a packed structure. That is, each structure member after the first
member is stored at the first available byte.
The memory used for the request parameters can also be used for the reply
parameters; the memory used for the request data can also be used for the reply
data. The application program must ensure that the reply data and parameters are
written into the request data and parameters buffer only when the request data
and parameters are no longer needed.
VERS The value given in VERS is used to indicate the versions of PCLK
installed in the terminal at the time the query reply is returned. For
example, X'0001' indicates PCLK Version 1.1.
Refer to IBM 3270 Information Display System Data Stream Programmer's Reference for
the field definitions for this query reply.
The self-defining parameters begin at offsets 12 and (14 + n) where n is the length
of the application name supplied at offset 14.
Refer to IBM 3270 Information Display System Data Stream Programmer's Reference for
the field definitions for this query reply.
Table 31. Base DDM Query Reply Format with Direct Access and Name Self-Defining
Parameters
Offset Length Content Meaning
0 1 word Length Length of structure
(includes
self-defining
parameters)
2 1 byte X'81' Query reply ID
3 1 byte X'95' Query reply type
4–5 2 bytes FLAGS Reserved
Refer to IBM 3270 Information Display System Data Stream Programmer's Reference for
the field definitions for this query reply.
When the function is supported, the query reply is transmitted inbound in reply to
a Read Partition structured field specifying Query or Query List (QCODE List =
X'9E', Equivalent, or All).
When a workstation supports multiple auxiliary devices, the IBM auxiliary devices
query reply must be sent for each device.
Optional Parameters
All parameters shown in the base part of the query reply must be present.
Parameters not used are set to X'00'.
QUERY This bit must be set to B'1' for all IBM auxiliary devices to indicate that it
supports receiving a Read Partition (Query, Query List). The host applications
can then use a Read Partition directed to the auxiliary device to determine its
characteristics. The destination/origin structured field is used to direct the
Read Partition structured field to the auxiliary device.
The minimum support level for the IBM auxiliary device is to return the Null
query reply in response to the Read Partition.
LIMIN States the maximum number of bytes that can be sent in an inbound
transmission. A LIMIN value of X'0000' indicates no implementation limit on
the number of bytes transmitted inbound.
LIMOUT States the maximum number of bytes that can be sent to an IBM auxiliary
device in an outbound transmission. A LIMOUT value of X'0000' indicates no
implementation limit on the number of bytes transmitted outbound.
TYPE Identifies the auxiliary device being supported. Two values are valid. One
identifies an auxiliary display and the other identifies an auxiliary printer. All
other values are reserved.
The IBM auxiliary device processor supports two self-defining parameters, 01 and
03. These are defined in Table 33 on page 346.
VERS The value given in VERS is used to indicate the versions of PCLK
installed in the terminal at the time the query reply is returned. For
example, X'0001' indicates PCLK version 1.1.
Refer to IBM 3270 Information Display System Data Stream Programmer's Reference for
the field definitions for this query reply.
Refer to IBM 3270 Information Display System Data Stream Programmer's Reference for
the field definitions for this query reply.
The OEM auxiliary device processor supports two self-defining parameters, 01 and
03. These are defined in Table 36.
VERS The value given in VERS is used to indicate the versions of PCLK
installed in the terminal at the time the query reply is returned. For
example, X'0001' indicates PCLK version 1.1.
Refer to IBM 3270 Information Display System Data Stream Programmer's Reference for
the field definitions for this query reply.
When an auxiliary device supports an IBM product-defined data stream, this query
reply is transmitted inbound in reply to a Query List (QCODE List = X'9C' or All).
Optional Parameters
All parameters shown in the base part of the query reply and the direct access
self-defining parameter must be present.
Valid values for REFID (offset 6) and SSID (offset 7) of the Product-Defined query
reply are as follows:
Table 40. Valid REFID and SSID Values for the IBM Product-Defined Query Reply
REFID SSID Product and Data Stream Documentation
X'01' 5080 Graphics System:
The IBM product-defined processor supports only the direct access self-defining
parameter. It is defined in Table 41 on page 350.
The DIA auxiliary device processor supports only the direct access self-defining
parameter. It is defined in Table 43 on page 351.
Refer to IBM 3270 Information Display System Data Stream Programmer's Reference for
the field definitions for this query reply.
The following EHLLAPI functions are different from those with the same names in
Communication Manager/2. You need to understand the differences when you use
these functions:
v Set Session Parameter (9)
v Copy OIA (13)
v Copy String to PS (15)
v Storage Manager (17)
v Copy String to Field (33)
v Get Key (51)
v Window Status (104)
v Query Sessions (10)
v Connect for Structured Field (120)
v Allocate Communications Buffer (123)
v ASCII mnemonics
Set Options
Personal Communications does not provide the following set options provided by
Communication Manager:
OLDOIA, NEWOIA
COMPCASE, COMPICASE
OLD5250OIA, NEW5250OIA
Return Parameters
When the Set Session Parameter (9) function is terminated, Communication
Manager returns a length of the valid data string as the third parameter, the data
string length. However, Personal Communications returns a number of the valid
set options as the data string length.
EAB Option
In Communication Manager/2, a color remap affects the value of the character
color in the EAB attribute copied by Copy PS (5) or Copy PS to String (8) function
when the EAB option is specified in the Set Session Parameter (9) function.
In Personal Communications, however, the value of the character color in the EAB
attribute depends on the contents of the presentation space regardless of a color
remap, and it is not affected by a color remap.
In Personal Communications, however, the EAB option does not affect the data
contents of the Copy String to Field (33) function. The data to be passed is not the
attribute data, but only the text data. If you want to use the same interface with
Communication Manager/2, use the PUTEAB option of Set Session Parameter (9).
Mnemonics Meaning
@A@N Get Cursor
@A@O Locate Cursor
@A@X Hexadecimal
@A@Y Cmd (Function) Key
@A@a Destructive Backspace
@S@A Erase EOL
@S@B Field Advance
@S@C Field Backspace
@S@D Valid Character Backspace
@S@P POR (For sending only)
@S@T Jump to Task Manager
@/ Overrun of queue (Only in the Get Key function)
Installation
To install DOS EHLLAPI support for Personal Communications do the following:
1. Select the Emulator Utilities folder from the Utilities folder in the IBM Personal
Communications folder.
2. Select DOS EHLLAPI application from the Emulator Utilities folder.
3. Select the check box of the DOS MODE EHLLAPI to enable DOS EHLLAPI
support.
4. Enter the major DOS version for which your DOS EHLLAPI applications are
written. (For example, 2 for DOS Emulator Version 2.x).
5. Select OK to enable changes.
6. Shut down the workstation and restart it again.
Error Handling
An unsuccessful service request in the SRPI environment can result from problems
at any of the different layers. SRPI shields applications from transport layer errors
as much as possible. Errors within server processing are handled by the
applications. The other errors are caused by SRPI and are treated accordingly.
Application Errors
SRPI is responsible for routing requests to servers and returning replies to
requesters. Requesters and servers are responsible for handling errors (except for
abend) that servers encounter. When a server ends abnormally, SRPI returns to the
requester with an abend notice in the SRPI return code.
The server return code is set by the server on the IBM host computer running
under VM or MVS. The value and meaning of the server return code is dependent
on the requester or the server.
The return code values are word-reversed and byte-reversed within each word. For
example, the SRPI return code X'0100 0402' is stored in the CPRB memory as
X'0204 0001'.
The nnnn bytes are the hexadecimal value that indicates the specific error detected.
The return code definitions and descriptions are listed in Table 44.
Table 44. Type 1 Return Code Definitions and Descriptions
Hexadecimal
Return Code Constant Return Code Description
X'0100 0402' UERERRT1START SRPI is not started because the host
ECF program is not started.
X'0100 0404' UERERRT1LOAD The SRPI router is not loaded.
X'0100 0408' UERERRT1BUSY The SRPI router is busy. This return
code is not used by the Personal
Communications program.
X'0100 040A' UERERRT1VER The version ID in the CPRB passed to
the SRPI router is not supported by the
resident portion of the SRPI router. The
version ID is automatically put into the
CPRB by the C interface facility.
X'0100 040C' UERERRT1EMU Personal Communications is not loaded.
X'0100 040E' UERERRT1ROUT The server name supplied in the CPRB
is not defined in the server routing
table. Default routing is not configured
so SRPI is unable to route the request.
Use a valid server name or update the
configuration to include the server
name.
X'0100 0410' UERERRT1COMMR Communications resource not available.
X'0100 0412' UERERRT1REST 3270 emulation has been restarted since
the application last used SRPI. End the
application and restart it before using
SRPI.
X'0100 0414' UERERRT1INUSE The request has been routed to a
communication session that is in use by
File Transfer.
X'0100 0602' UERERRT1QPLEN Request parameters length exceeds the
maximum value. The maximum value
allowed is 32763.
The 3 error-specific bytes consist of the following exception conditions from the
acknowledge interchange unit:
v xx exception class
The 3 error-specific bytes consist of the following exception conditions from the
acknowledge interchange unit:
v xx exception class
v yy exception code
v zz exception object
The return code definitions and descriptions are listed in Table 45.
Table 45. Type 3 Return Code Definitions and Descriptions
Hexadecimal
Return Code Constant Return Code Description
X'0304 1D00' UERERRT3NORES A resource required by the host SRPI
router to process the request is not
available. This might be a temporary
condition.
X'0304 1E00' UERERRT3NOSER The server is unknown at the host.
X'0304 1F00' UERERRT3UNSER The server is not available at the host.
X'0304 2200' UERERRT3TERMS The server terminated in a normal
fashion but did not send a reply.
X'0304 2300' UERERRT3ABNDS The server terminated abnormally and
did not send a reply.
Note: All exception code values not specified in this table are reserved.
Note: All exception object values not specified in this table are reserved.
PC/3270 Windows mode and PC400 provide a dynamic data exchange (DDE)
interface that allows applications to exchange data. The exchange of data between
two Windows applications can be thought of as a conversation between a client
and a server. The client initiates DDE conversations. The server in turn responds to
the client. Personal Communications is a DDE server for the open sessions that
Personal Communications is managing. For more information about DDE, refer to
Microsoft Windows Software Development Kit Guide to Programming.
Note: If you use DDE functions with Visual Basic, see Chapter 7, “Using DDE
Functions with a DDE Client Application,” on page 297.
In DDE, atoms identify application names, topic names, and data items. Atoms
represent a character string that is reduced to a unique integer value. The character
string is added to an atom table, which can be referred to for the value of the
string associated with an atom. Atoms are created with the GlobalAddAtom
function call. Refer to Microsoft Windows Software Development Kit Guide to
Programming for more information about how to create and use atoms.
Item Function
Formats Returns the list of clipboard formats (numbers) that Personal
Communications is capable of rendering.
Status Returns information about the status of each Personal Communications
session.
SysCon Returns the level of Personal Communications support and other system
related values.
SysItems Returns the list of data items that are available when connected to the
Personal Communications system topic.
Topics Returns the list of Personal Communications topics that are available.
Item Function
CLOSE Retrieves the window close requests.
EPS Retrieves the session presentation space with additional data.
EPSCOND Retrieves the presentation space service condition.
FIELD Retrieves the field in the presentation space of the session.
KEYS Retrieves the keystrokes.
MOUSE Retrieves the mouse input.
OIA Retrieves the operator information area status line.
PS Retrieves the session presentation space.
PSCOND Retrieves the session advise condition.
SSTAT Retrieves the session status.
STRING Retrieves the ASCII string data.
TRIMRECT Retrieves the session presentation space within the current trim rectangle.
Item Function
SF Retrieves the destination/origin structured field data.
SFCOND Retrieves the query reply data.
Find Field
3270 5250 VT
Yes Yes Yes
The Find Field function returns to the client the information of the field specified
by the Set Presentation Space Service Condition function.
Note: The client must set the PS position by using the Set Presentation Service
Condition function before using this function.
The client sends this following message to receive the field information.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aFIELD) );
where:
cfFormat Identifies the format for the field information. This must be CF_DSPTEXT.
aFIELD Identifies field data item.
The Find Field function supports a new format like Visual Basic. Using the new
format, the Find Field function can find a field with specifying its type. The new
format is:
FIELD (pos, type)
Type Meaning
�� or T� This field.
P� The previous field, either protected or unprotected.
N� The next field, either protected or unprotected.
NP The next protected field.
NU The next unprotected field.
PP The previous protected field.
PU The previous unprotected field.
Get Keystrokes
3270 5250 VT
Yes Yes Yes
The Get Keystrokes function returns to the client the keystrokes that are
intercepted by the Start Keystroke Intercept function. The client sends the
following message to receive the keystroke information.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aKEYS) );
where:
cfFormat Identifies the format for the keystroke information. This must be
CF_DSPTEXT.
aKEYS Identifies keystroke data item.
The format for the keystrokes parameters is the same as for the Session Execute
Macro function SENDKEY command.
The Get Mouse Input function returns the latest mouse input intercepted by Start
Mouse Input Intercept function to the client.
Note: The client must call the Start Mouse Input Intercept function before using
this function.
The client sends the following command to receive the mouse input information.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aMOUSE) );
where:
If Personal Communications cannot return the mouse input information, one of the
following status codes is returned in the low-order byte of the wStatus word:
The Get Number of Close Requests function returns to the client the number of
the close requests that are intercepted by the Start Close Intercept function. The
client sends the following message to receive the number of the close requests.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aCLOSE) );
where:
cfFormat Identifies the format for the close intercept information. This must be
CF_DSPTEXT.
aCLOSE Identifies close intercept data item.
The Get Operator Information Area (OIA) function returns a copy of the OIA to
the client. The client sends the following message to request the OIA.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aOIA) );
where:
cfFormat Identifies the format for the OIA. For the OIA this format must be
CF_DSPTEXT.
aOIA Identifies the operator information area as the item.
If Personal Communications cannot return the OIA, one of the following status
codes is returned in the low-order byte of the wStatus word:
The Get Partial Presentation Space function returns all or part of the session
presentation space to the client.
Note: The client must set the start PS position and the length (or set the EOF flag)
by using the Set Presentation Space Service Condition function before
using this function.
The client sends the following command to get the presentation space.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aEPS) );
where:
cfFormat Identifies the format for the presentation space. Valid values are CF_TEXT or
CF_DSPTEXT. The structure of the presentation space, in these two formats,
is shown below.
aEPS Identifies presentation space atom as the item.
Note: The following examples show how to obtain long pointers to the PS and the
PSFIELDS array.
lpps = (lp_EPS_CF_DSPTEXT) lpEPS_CF_DSPTEXT->PSData
+ lpEPS_CF_DSPTEXT->uPSOffset;
lppsfields = (lpPSFIELDS) lpEPS_CF_DSPTEXT->PSData
+ lpEPS_CF_DSPTEXT->uFieldOffset;
Following the PS in the buffer is the following additional structure of fields that
compose the field list.
typedef struct tagFL_CF_TEXT
{
unsigned char Tab5[1]; // Tab character
unsigned char PSFldCount[4]; // Number of fields in the PS
unsigned char Tab6[1]; // Tab character
PS_FIELD Field[1]; // Field List Array
} FL_CF_TEXT, FAR *lpFL_CF_TEXT;
Note: The following examples show how to obtain long pointers to the PS and the
PS_FIELD array.
lpps = lpEPS_CF_TEXT->PS;
lpps_field = (lpPS_FIELD) lpEPS_CF_TEXT->PS
+ atoi(lpEPS_CF_TEXT->PSLENGTH)
+ ((atoi(lpEPS_CF_TEXT->PSROWS) - 1) * 2) // CR/LF
+ 1 + 1 + 4 + 1; // Tabs + size of field count
The Get Presentation Space function returns the session presentation space to the
client. The client sends the following command to get the presentation space.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aPS) );
where:
cfFormat Identifies the format for the presentation space. Valid values are CF_TEXT or
CF_DSPTEXT. The structure of the presentation space, in these two formats,
is shown below.
aPS Identifies presentation space atom as the item.
Note: The following examples show how to obtain long pointers to the PS and the
PSFIELDS array.
lpps = (lp_PS_CF_DSPTEXT) lpPS_CF_DSPTEXT->PSData
+ lpPS_CF_DSPTEXT->uPSOffset;
lppsfields = (lpPSFIELDS) lpPS_CF_DSPTEXT->PSData
+ lpPS_CF_DSPTEXT->uFieldOffset;
Following the PS in the buffer is the following additional structure of fields that
compose the field list.
typedef struct tagFL_CF_TEXT
{
unsigned char Tab4[1]; // Tab character
unsigned char PSFldCount[4]; // Number of fields in the PS
unsigned char Tab5[1]; // Tab character
PS_FIELD Field[1]; // Field List Array
} FL_CF_TEXT, FAR *lpFL_CF_TEXT;
Note: The following example shows how to obtain long pointers to the PS and the
PS_FIELD array.
lpps = lpPS_CF_TEXT->PS;
lpps_field = (lpPS_FIELD) lpPS_CF_TEXT->PS
+ atoi(lpPS_CF_TEXT->PSSIZE)
+ ((atoi(lpPS_CF_TEXT->PSROWS) - 1) * 2) // CR/LF
+ 1 + 1 + 4 + 1; // Tabs + size of field count
The Get Session Status function returns the status of the connected session. The
client sends the following message to request session status:
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aSSTAT) );
where:
cfFormat Identifies the DDE format for the status information. The value used is
CF_TEXT.
aSSTAT Identifies session status as the data item requested.
If Personal Communications cannot return the session status, one of the following
status codes is returned in the low-order byte of the wStatus word:
Notes:
1. The status of each field is updated each time the status is requested.
2. A new field might be added in a future version of Personal Communications.
where:
cfFormat Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aSYSCON Identifies system configuration as the data item requested.
where:
cfFormat Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aFORMATS Identifies formats as the data item requested.
If Personal Communications cannot return the formats data item, a DDE ACK
message is returned with an error code in the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aFORMATS)
The Get System Status function returns the status of each 3270 or 5250
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aSTATUS) );
where:
cfFormat Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aSTATUS Identifies status as the data item requested.
If Personal Communications cannot return the status data item, a DDE ACK
message is returned with an error code in the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aSTATUS)
The Get System SysItems function returns the list of data items available in the
Personal Communications system topic. The client application sends the following
message to get the system topic data items:
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aSYSITEMS) );
where:
cfFormat Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aSYSITEMS Identifies SysItems as the data item requested.
If Personal Communications cannot return the system data items, a DDE ACK
message is returned with an error code in the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aSYSITEMS)
The Get System Topics function returns the list of active DDE topics currently
supported by Personal Communications. The client application sends the following
message to the system topic to retrieve the list of topics that are currently active:
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aTOPICS) );
where:
cfFormat Identifies the DDE format for the data item requested. The value used is
CF_TEXT.
aTOPICS Identifies topics as the data item requested.
Note: The actual number of session topics supported depends on the number of
sessions currently opened. The client program should always query the
topics data item of the system topic to obtain the list of sessions currently
opened.
If Personal Communications cannot return the list of topics, a DDE ACK message
is returned with an error code in the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aTOPICS)
The Get Trim Rectangle function returns to the client the area of the presentation
space that is within the current trim rectangle. The client sends the following
message to receive the trim rectangle.
PostMessage( hServerWnd,
WM_DDE_REQUEST,
hClientWnd,
MAKELONG(cfFormat, aTRIMRECT) );
where:
cfFormat Identifies the format for the trim rectangle. This is CF_TEXT.
aTRIMRECT Identifies trim rectangle as the data item requested.
If Personal Communications cannot return the trim rectangle, one of the following
status codes is returned in the low-order byte of the wStatus word:
The client application sends the following message to initiate a DDE conversation
with a session:
SendMessage( -1,
WM_DDE_INITIATE,
hClientWnd,
MAKELONG(aIBM327032, aSessionN) );
aIBM327032 Identifies the application atom. The string used to create atom aIBM3270 is
IBM3270. In the PC400, the application atom is aIBM5250 and the string
IBM5250 is used to create it.
aSessionN Identifies the topic atom. The string used to create atom aSessionN is either
NULL or Session appended with the session ID A, B, ..., Z.
The client application selects the conversation it wishes to communicate with from
the returned list of topics and terminates all other unwanted conversations.
The client sends the following command to initiate a structured field conversation:
SendMessage( -1,
WM_DDE_INITIATE,
hClientWnd,
MAKELONG(aIBM3270, aLUN_xxxx) );
where:
PC/3270 Response
If PC/3270 can support a structured field conversation with the client application,
it returns an acknowledgment message with the following parameter:
WM_DDE_ACK(aIBM3270, aLUN_xxxx)
where:
The Put Data to Presentation Space function sends an ASCIIZ data string to be
written into the host presentation space at the location specified by the calling
parameter. The client sends the following message to the session to send the string.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
MAKELONG(hData, aEPS) );
where:
If the presentation space does not accept the string data, Personal Communications
returns a negative ACK message containing one of the following status codes in
the low-order byte of the wStatus word:
WM_DDE_ACK(wStatus, aEPS)
This function allows a client application to examine the presentation space for a
specified string in a specified area.
Note: The client must set the start PS position, search direction, a string to be
searched, and EOF flag by using the Set Presentation Space Service
Condition function before using this function.
The client sends the following message to search for the string.
where:
cfFormat Identifies the format for the search information. This is CF_DSPTEXT.
aSTRING Identifies the search data item.
If Personal Communications cannot return the start position of the string, one of
the following status codes is returned in the low-order byte of the wStatus word:
Send Keystrokes
3270 5250 VT
Yes Yes Yes
The Send Keystrokes function sends keystrokes to the connected session. The
client sends the following message to the session to send keystrokes.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
MAKELONG(hData, aKEYS) );
where:
Note: If the keystrokes are pure text then specifying WC_PURETEXT will
transfer the keystrokes to the host in the fastest possible manner. If
WC_HLLAPITEXT is specified then the keystroke data can contain HLLAPI
commands interspersed with the text.
aKEYS Identifies keystrokes as the item.
You can issue commands and macros with the DDE_EXECUTE function. The
DDE_EXECUTE function passes command strings to Personal Communications.
The command strings must conform to DDE specifications. Refer to Microsoft
Windows Software Development Kit Guide to Programming for more information about
the DDE command syntax.
where:
hCommands
Identifies a handle to a Windows global memory object containing
Personal Communications commands. For a list of commands you can
issue, see “Issuing Commands with the Session Execute Macro Function.”
Note:
v Enclose values that contain nonalphanumeric characters or blanks in double
quotation marks ("value value").
v To include a double quotation mark within a string, type it twice (for example,
this is a double quotation mark:"").
v The maximum length for any command is 255 characters.
WINDOW Command
[WINDOW(action[, "name"])]
KEYBOARD Command
[KEYBOARD(action)]
action= LOCK|UNLOCK
SEND Command
[SEND("pcfilename","hostfilename","options")]
options includes any combination of the following file transfer options: MVS, VM,
CICS, QUIET, OS/400, and emulation-specific transfer options, separated by
spaces.
Refer to Administrator's Reference for more information about the transfer options.
RECEIVE Command
[RECEIVE("pcfilename","hostfilename","options")]
options includes any combination of the following file transfer options: MVS, VM,
CICS, QUIET, OS/400, and emulation-specific transfer options, separated by
spaces.
Refer to Administrator's Reference for more information about the transfer options.
SENDKEY Command
[SENDKEY(token,token)]
Note:
v Text strings are enclosed in double quotation marks.
Examples:
1. To logon
[SENDKEY("Logon")]
2. To get reader list
[SENDKEY("RDRL", enter)]
WAIT Command
[WAIT("[time out][wait condition]")]
Waits until the timeout expires or the wait condition the client specified occurs. For
this command, the client has to set at least one option, where:
The Set Cursor Position function allows the client application to set the cursor
position in the session window.
where:
hData Identifies a handle to a Windows global memory object that contains the
cursor positioning information in the following structure:
typedef struct tagSETCURSOR
{
unsigned unused:13; // ** unused **
unsigned fRelease:1; // TRUE = Session frees memory
unsigned freserved:2; // ** reserved **
int cfFormat; // Always CF_DSPTEXT
unsigned uSetCursorType; // Cursor Set Type
unsigned uSetCursor1; // Cursor Row or PS Offset
unsigned uSetCursor2; // Cursor Col
} SETCURSOR, FAR *lpSETCURSOR;
This function specifies the mouse input to be intercepted. The client sends the
following command to set the mouse event to be intercepted.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
MAKELONG(hData, aMOUSE) );
where:
hData Identifies a handle to a Windows global memory object that specifies the
condition of intercepting the mouse input, CF_TEXT or CF_DSPTEXT.
aMOUSE Identifies Mouse atom as the item.
If the format is CF_TEXT, the client program sends the condition in the following
structure:
typedef struct tagSETMOUSE_CF_TEXT
{
unsigned unused:12, //
unsigned fRelease:1, //
unsigned fReserved:3; //
int cfFormat; // Always CF_TEXT
unsigned char Condition[1] //
} SETMOUSE_CF_TEXT, FAR *lpSETMOUSE_CF_TEXT;
If the format is CF_DSPTEXT, the client program sends the condition in the
following structure:
The Set Presentation Space Service Condition function sets the condition for
using the following functions:
v Get Partial Presentation Space
v Find Field
v Search for String
The client application sets the condition by calling this function such as:
v Start PS position
v PS length
v EOF flag
v Search direction
v ASCIIZ string
The client must specify the Set Presentation Space Service Condition function
before invoking the functions listed above. The conditions set by this function
remain in effect until the next Set Presentation Space Service Condition function
is called. The client sends the following message to set the condition:
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
MAKELONG(hData, aEPSCOND) );
where:
This function sets the condition for the DDE_ADVISE of the Start Session Advise
function. The client can specify a search string and a region of the screen. When
the advise condition is met, the server notifies the client of the condition according
to the options specified by the Start Session Advise function.
Note: The client must specify the Set Session Advise Condition function before
invoking Start Session Advise. If the advise condition is set after the Start
Session Advise function is started, the advise condition will be ignored and
the client will receive a negative ACK message. See “Start Session Advise”
on page 412 for more information about starting the advise.
The client sends the following message to set the advise condition.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
MAKELONG(hData, aPSCOND) );
where:
The Set Structured Field Service Condition function passes the Query Reply data
provided by the client application.
Note: The client must call the Set Structured Field Service Condition function
before invoking the Start Read SF function or the Write SF function.
where:
PC/3270 Response
PC/3270 checks the Query Reply ID and Type (not DOID) and the length. If they
are valid, then PC/3270 returns an ACK message:
WM_DDE_ACK(wStatus, aSFCOND)
If PC/3270 cannot perform the Set Structured Field Service Condition function,
then PC/3270 returns a negative ACK message containing one of the following
return codes in the low-order byte of wStatus:
The Start Close Intercept function allows a client application to intercept close
requests generated when a user selects the close option from the emulator session
window. This function intercepts the close request and discards it until the Stop
Close Intercept function is requested. After using this function, the client receives
DATA messages notifying it that close requests occurred (CLOSE).
where:
If the value of fAckReq is 1, the server does not notify the client of
further close requests until the server receives an ACK message from the
client in response to any previous notification.
The cfFormat field specifies the format to send the close request. (Must
be CF_DSPTEXT.)
aCLOSE Identified close intercept as the item.
Once the intercept starts, the client receives DATA messages notifying it that the
close request is intercepted:
WM_DDE_DATA(hData, aCLOSE)
where:
The DATA messages continue until a Stop Close Intercept message is sent to
Personal Communications.
The Start Keystroke Intercept function allows a client application to filter any
keystrokes sent to a session by a terminal operator. After a call to this function,
keystrokes are intercepted, and the client receives them (KEYS).
where:
If the value of fDeferUpd is 1, DDE Data messages are sent to the client
application with the hData set to NULL. The client then issues a DDE
REQUEST to request the data item.
If the value of fAckReq is 1, the server does not notify the client of
further keystrokes until the server receives an ACK message from the
client in response to any previous keystrokes notification.
The cfFormat field specifies the format to send the keystrokes when the
keystroke is sent by a terminal operator. (Must be CF_DSPTEXT.)
aKEYS Identified keystrokes as the item.
Once the intercept has started, the client receives DATA messages notifying it that
the keystroke is intercepted:
WM_DDE_DATA(hData, aKEYS)
The Start Mouse Input Intercept function allows a client application to intercept
mouse input when a terminal operator press the mouse button on emulator session
window. After calling this function, the client receives DATA messages that include
the PS position where mouse input occurred.
The client sends the following command to begin to intercept the mouse input.
PostMessage( hServerWnd,
WM_DDE_ADVISE,
hClientWnd,
MAKELONG(hOptions, aMOUSE) );
where:
If the value of fAckReq is 1, the server does not notify the client of
further structured field data until the server receives an ACK message
from the client in response to any previous notification.
The cfFormat field specifies the format to send the data item has been
updated.
aMOUSE Identified MOUSE as the item.
where:
The DATA messages continue until a Stop Mouse Input Intercept message is sent
to Personal Communications.
The Start Read SF function allows a client application to read structured field data
from the host application. After using this function, the client receives DATA
messages notifying it that close requests occurred.
Note: Before using this function, the client must call the Set Structured Field
Service Condition function to pass the Query Reply data to the server.
where:
If the value of fAckReq is 1, the server does not notify the client of
further structured field data until the server receives an ACK message
from the client in response to any previous notification.
The cfFormat field specifies the format to send the structured field data.
(It must be CF_DSPTEXT.)
aSF Identified structured field as the item.
PC/3270 Response
PC/3270 receives the Start Read SF and returns an ACK message if it can start the
Read SF. Otherwise a negative ACK message is returned to the client with one of
the following return codes in the low-order byte of the wStatus field:
WM_DDE_ACK(wStatus, aSF)
where:
The DATA messages continue until a Stop Read SF message is sent to PC/3270.
The Start Session Advise function establishes a link between the Personal
Communications session and the client. This lets the client receive updates of the
presentation space (PS), the operator information area (OIA), or the trim rectangle
(TRIMRECT) when the data item is updated.
Note: If the client application needs conditional notification when the presentation
space is updated, set an advise condition prior to invoking the advise
function for the presentation space. See “Set Session Advise Condition” on
page 403.
where:
If the value of fDeferUpd is 1, DDE Data messages are sent to the client
application with the hData set to NULL. The client must then issue a
DDE REQUEST to request the data item.
If the value of fAckReq is 1, the server does not notify the client of
further changes to the data item until the server receives an ACK
message from the client in response to any previous update notification.
The cfFormat field specifies the format to send the data item when the
item has been updated.
aItem Specifies the item of information being requested; in this case, the value
can be PS, OIA, or TRIMRECT.
Once the advise has started, the client receives DATA messages notifying it that the
data item (PS, OIA, or TRIMRECT) has changed:
WM_DDE_DATA(hData, aItem)
The DATA messages continue until a Stop Session Advise message is sent to
Personal Communications. The format of the data item will be the same format as
if the client requested the data item via a DDE_REQUEST.
The Stop Close Intercept function ends a client application's ability to intercept
close request. The client sends the following command to perform the Stop Close
Intercept function.
PostMessage( hServerWnd,
WM_DDE_UNADVISE,
hClientWnd,
MAKELONG(NULL, aCLOSE) );
where:
The Stop Mouse Input Intercept function ends a client application's ability to
intercept mouse input.
The client sends the following command to perform the Stop Mouse Input
Intercept function.
PostMessage( hServerWnd,
WM_DDE_UNADVISE,
hClientWnd,
MAKELONG(NULL, aMOUSE) );
where:
Stop Read SF
3270 5250 VT
Yes Yes Yes
The Stop Read SF function ends a client application's ability to read structured
field data.
The client sends the following command to perform the Stop Read SF function.
PostMessage( hServerWnd,
WM_DDE_UNADVISE,
hClientWnd,
MAKELONG(NULL, aSF) );
where:
where:
aItem Specifies the item of information being requested; in this case, the value
can be PS, OIA, TRIMRECT, or NULL.
If the value of aItem is NULL, then the client has requested termination of all
active notifications for the conversation.
The Terminate Session Conversation function disconnects the client from the
Personal Communications session the client has previously started a conversation
with.
The Terminate Structured Field Conversation function disconnects the client from
a structured field conversation.
PC/3270 Response
PC/3270 acknowledges the terminate command with a terminate message:
WM_DDE_TERMINATE
When the user closes a Personal Communications session, any global memory
blocks that were allocated by Personal Communications will be freed by Windows.
This can cause problems for the client if the client retains any of these global
memory objects for long periods of time. If the client application needs to keep the
information in a global memory item for a long period of time, it is suggested that
the client make a copy of global memory item into a global memory item the client
application owns.
Write SF
3270 5250 VT
Yes Yes Yes
The Write SF function allows a client application to write structured field data to
the host application.
Note: The client must call the Set Structured Field Service Condition function
before invoking the Write SF function.
The client sends the following message to write structured field data.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
MAKELONG(hData, aSF) );
where:
PC/3270 Response
PC/3270 receives structured field data and sends them to the host application. If
the data transmission completes successfully, then PC/3270 returns an ACK
message:
WM_DDE_ACK(wStatus, aSF)
The following data hierarchy details the menu map Personal Communications
expects when adding a dynamic menu item and submenu to a session menu bar:
POPUP "MyMenu"
BEGIN
MENUITEM "Send Files to Host", SEND
MENUITEM "Receive Files from Host", RECEIVE
MENUITEM SEPARATOR
MENUITEM "Convert Files", CONVERT
END
When the user selects a menu item from the new menu, Personal Communications
will send a DDE Initiate with 3270MenuN or 5250MenuN as the application and
itemN token as the topic. If an ACK is received from the DDE application,
Personal Communications will inhibit the session from accepting user input. The
Appendix E. DDE Functions in a 16-Bit Environment 419
menu client application can then display a dialog, and so on. When the menu
server application has completed processing of the menu item, it will send a DDE
Terminate to signal Personal Communications the process is complete. Personal
Communications will then reenable the window for the user.
When the user selects a menu item from the new menu, Personal Communications
will send a DDE DATA with aSELECTMENU as the item. When Personal
Communications sends DDE DATA to the client application, Personal
Communications will inhibit the session from accepting user input. The menu
The Change Menu Item function appends, deletes, inserts, modifies, and removes
menu items. The client sends the following message to the session to change a
menu.
PostMessage( hServerWnd,
WM_DDE_POKE,
hClientWnd,
MAKELONG(hData, aCHANGEMENU) );
where:
hData Identifies a handle to a Windows global memory object that contains the
requests for changing a menu. The global memory object contains the
following structure:
typedef struct tagChangeMenu
{
unsigned unused:13; // ** unused **
unsigned fRelease:1; // Session frees memory
unsigned freserved:2; // ** reserved **
int cfFormat; // Always CF_DSPTEXT
HANDLE hMenu; // Handle of the menu item
WORD wPosition; // The position of the menu
// item
WORD wIDNew; // The menu ID of the new
// menu item
WORD wOperation; // Specifies the operation
WORD wFlags; // Specifies the options
unsigned char szItemName[1]; // String of the item
} CHANGEMENU, FAR *lpCHANGEMENU;
If the MF_APPEND is specified in the wOperation field, the following fields must
be filled:
If the MF_INSERT is specified in the wOperation field, the following fields must
be filled:
If the MF_REMOVE is specified in the wOperation field, the following fields must
be filled:
The Create Menu Item function requests Personal Communications to add a menu
item to the menu bar. A pop-up menu will be created at the same time, but it is
initially empty and can be filled with menu items by using this function. The
string of the new menu item that will be added to a top-level menu bar, is also
specified by using the change menu item function.
where:
cfFormat Identifies the format for the ID of the new menu item. The valid value is
CF_DSPTEXT.
aCREATEMENU Identifies the create menu item.
where:
hData Identifies a handle to a windows global memory object that contains the
handle of the menu item. The global memory object contains the
following structure:
typedef struct tagcreatemenu
}
unsigned unused:12, // *** unused ***
unsigned fresponse:1, // true = dd_request response
unsigned frelease:1, // true = client releases memory
unsigned reserved:1, // *** reserved ***
unsigned fackreq:1, // true = dde_ack is required
int cfformat; // always cf_dsptext
handle hmemuitem; // handle of the menu item
} CREATEMENU, FAR *lpCREATEMENU;
If Personal Communications cannot create a menu item, one of the following status
codes are returned in the low-order byte of the wStatus word:
The client application sends the following message to initiate a DDE conversation
with a menu:
SendMessage( -1,
WM_DDE_INITIATE,
hClientWnd,
MAKELONG(aIBM327032, SN) );
where:
aIBM327032 Identifies the application atom. The string used to create atom aIBM3270
is IBM3270 In the PC400, the application atom is aIBM5250 and the
string IBM5250 is used to create it.
SN Identifies the topic atom. The string used to create atom a3270MenuSN
is 3270MenuS appended with the session ID A, B, ..., Z. In the PC400,
the topic atom is a5250MenuSN and the string 5250MenuS appended
with the session ID A, B, ..., Z. is used to create it.
The Start Menu Advise function allows a client application to process a user
defined routine when the menu item that is added by the client application, is
selected. After using this function, the client receives DATA messages indicating
which menu item is selected.
where:
Otherwise, a negative ACK message will be returned to the client with one of the
following return codes in the low-order byte of the wStatus field.
Once the menu item (added to the client application) is selected, the client receives
DATA messages notifying it which menu item is selected:
WM_DDE_DATA(hData, aSELECTMENU)
The DATA messages continue until a Stop Menu Advise message is sent to
Personal Communications.
The Stop Menu Advise function ends a client application's ability to process a
user-defined routine when the menu item added by the client application is
selected. The client sends the following command to perform the Stop Menu
Advise function.
PostMessage( hServerWnd,
WM_DDE_UNADVISE,
hClientWnd,
MAKELONG(NULL, aSELECTMENU) );
where:
The Terminate Menu Conversation function disconnects the client from the
Personal Communications session with which a conversation had been previously
started.
IBM may have patents or pending patent applications covering subject matter
described in this document. The furnishing of this document does not give you
any license to these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing
IBM Corporation
500 Columbus Avenue
Thornwood, NY 10594
U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBM
Intellectual Property Department in your country or send inquiries, in writing, to:
IBM World Trade Asia Corporation
Licensing
2-31 Roppongi 3-chome, Minato-ku
Tokyo 106, Japan
The following paragraph does not apply to the United Kingdom or any other
country where such provisions are inconsistent with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
PUBLICATION “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS
FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or
implied warranties in certain transactions, therefore, this statement may not apply
to you.
Licensees of this program who wish to have information about it for the purpose
of enabling: (i) the exchange of information between independently created
The licensed program described in this information and all licensed material
available for it are provided by IBM under terms of the IBM Customer Agreement
or any equivalent agreement between us.
All statements regarding IBM's future direction or intent are subject to change or
withdrawal without notice, and represent goals and objectives only.
COPYRIGHT LICENSE:
Trademarks
The following terms are trademarks of the IBM Corporation in the United States,
or other countries, or both:
CICS OS/2
eServer OS/400
i5/OS Presentation Manager
IBM PS/2
IBM Global Network System i5
iSeries VisualAge
MVS zSeries
Other company, product, and service names may be trademarks or service marks
of others.
Index 441
Japanese, code page 1390/1399 (continued) operator services functions (continued)
Copy Presentation Space (5) 63 Query Session Status (22) 115
Copy Presentation Space to String (8) 71 Query Sessions (10) 117
Copy String to Field (33) 75 Query System (20) 118
Copy String to Presentation Space (15) 79 Reset System (21) 129
Get Key (51) 96 Send Key (3) 140
Search Field (30) 132 Set Session Parameters (9) 152
Search Presentation Space (6) 136 Start Host Notification (23) 165
Send Key (3) 150 Stop Host Notification (25) 173
Set Session Parameters (9) 160 Wait (4) 174
options 160
K
keyboard enhancement 25 P
keyboard mnemonics parameters
general 17 call 28
tables 142 returned 334
keyboard, session 17 SEND _ REQUEST 332
keystroke filtering 25 supplied 332
keystroke interception, Get Key (51) 94 Paste Clipboard to Presentation Space (36) 84
path, default
Receive File 128
L Send File 140
Pause (18) 23, 105, 173
language interface
PCSAPI
C language 335
general 197
languages 6
how to use 197
Linking
pcsConnectSession 197
description 9
pcsDisconnectSession 198
Dynamic Link Method 10
pcsGetPageSettings 205
Static Link Method 10
pcsGetPrinterSettings 211
Lock Presentation Space API (60) 102
pcsQueryConnectionInfo 199
Lock Window Services API (61) 104
pcsQueryEmulatorStatus 200
locking presentation space 16
pcsQuerySessionList 200
LWAIT 156, 175
pcsQueryWorkstationProfile 202
pcsRestorePageDefaults 207
pcsSetLinkTimeout 203
M pcsSetPageSettings 208
memory allocation 8 pcsSetPrinterSettings 216
mnemonics pcsStartSession 203
ASCII 18 pcsStopSession 204
for Send Key 17 pcsDisconnectSession 198
keyboard, tables 142 pcsQueryConnectionInfo 199
shift key 17 pcsQueryEmulatorStatus 200
Multithreading 11 pcsQuerySessionList 200
pcsQueryWorkstationProfile 202
pcsStartSession 203
N pcsStopSession 204
performance considerations 335
NOATTRB 154
Post Intercept Status (52) 26, 107, 168
NOBLANK 157
prerequisite calls, general 28
NOEAB 157
presentation services functions
NOQUIET 155
Connect Presentation Space (1) 36
NORESET 156
Copy Field to String (34) 40
NOXLATE 157
Copy OIA (13) 48
NULLATTRB 154
Copy Presentation Space (5) 57
numeric only fields 140
Copy Presentation Space to String (8) 65
NWAIT 156, 175
Copy String to Field (33) 73
Copy String to Presentation Space (15) 77
Disconnect Presentation Space (2) 86
O Find Field Length (32) 90
OIA 48, 175 Find Field Position (31) 91
Operator Information Area Get Request Completion (125) 99
See “OIA.” 48 Lock Presentation space API (60) 102
operator services functions Query Additional Field Attribute (45) 108
Pause (18) 105 Query Cursor Location (7) 112
Query Host Update (24) 114 Query Field Attribute (14) 112
Index 443
source code syntax 21 Unicode (continued)
specifying strings 78, 83, 85 Japanese, code page 1390/1399
SRCHALL 154 Copy Field to String (34) 46
SRCHBKWD 154 Copy Presentation Space (5) 63
SRCHFROM 154 Copy Presentation Space to String (8) 71
SRCHFRWD 154 Copy String to Field (33) 75
stack size 2 Copy String to Presentation Space (15) 79
Start Close Intercept 265, 405 Get Key (51) 96
Start Close Intercept (41) 161 Search Field (30) 132
Start Communication Notification (80) 163 Search Presentation Space (6) 136
Start Host Notification (23) 105, 114, 155, 165, 173 Send Key (3) 150
Start Keystroke Intercept 266, 407 Set Session Parameters (9) 160
Start Keystroke Intercept (50) 168 using API header files 2
Start Menu Advise 289, 428
Start Mouse Input Intercept 267, 408
Start Playing Macro (110) 170
Start Read SF 270, 411
W
Wait (4) 23, 141, 174
Start Session Advise 272, 412
window services functions
static link method 10
Change PS Window Name (106) 32
Stop Close Intercept 273, 413
Change Switch List LT Name (105) 33
Stop Close Intercept (43) 171
Lock Window Services API (61) 104
Stop Communication Notification (82) 172
Window Status (104) 175
Stop Host Notification (25) 173
WinHLLAPI Extension Functions
Stop Keystroke Intercept 274, 414
Asynchronous Functions
Stop Keystroke Intercept (53) 173
general 185
Stop Keystroke Intercept (53), you can call the 26
WinHLLAPIAsync 185
Stop Menu Advise 290, 429
WinHLLAPICancelAsyncRequest 191
Stop Mouse Input Intercept 274, 415
Blocking Routines
Stop Read SF 275, 415
general 193
Stop Session Advise 276, 416
WinHLLAPICancelBlockingCall 194
STREOT 154
WinHLLAPIIsBlocking 193
string interception, Get Key (51) 94
WinHLLAPISetBlockingHook 193
string specification
WinHLLAPIUnhookBlockingHook 194
session options 153
general 192
STRLEN 154
Initialization/Termination Functions
syntax, C language 335
general 192
WinHLLAPI Cleanup 193
WinHLLAPI Startup 192
T Summary 185
Terminate Menu Conversation 290, 430 Write SF 278, 418
Terminate Session Conversation 276, 417 Write Structured Fields (127) 178
Terminate Structured Field Conversation 277, 417
Terminate System Conversation 277, 417
TIMEOUT 155
trademarks 436
X
XLATE 157
transport layer errors 359
TWAIT 156, 175
types of presentation spaces 11
U
UERCPRB, C language 336
Unicode
Hindi, code page 1137
Convert Position of Convert RowCol (99) 40
Copy Field to String (34) 47
Copy Presentation Space (5) 64
Copy Presentation Space to String (8) 72
Copy String to Field (33) 76
Copy String to Presentation Space (15) 80
Get Key (51) 98
Search Field (30) 133
Search Presentation Space (6) 137
Send Key (3) 150
Set Cursor (40) 152
Set Session Parameters (9) 160
Printed in USA
SC31-8478-13