Receives a message from a host application.
HCON Library
C (libg3270.a)
Pascal (libg3270p.a)
FORTRAN (libg3270f.a)
#include <g32_api.h>
g32_read (as, msgbuf, msglen)
struct g32_api *as;
char **msgbuf;
int *msglen;
function g32read (var as : g32_api; var buffer : stringptr; var msglen : integer) : integer; external;
EXTERNAL G32READ
INTEGER AS(9), BUFLEN, G32READ
CHARACTER *XX MSGBUF
RC= G32READ (AS, MSGBUF, BUFLEN)
The g32_read function receives a message from a host application. The g32_read function may only be used by those applications having API/API or API/API_T mode specified with the g32_alloc function.
HCON application programs using the Pascal language interface must include and link both the C and Pascal libraries. Application programs using the FORTRAN language for the HCON API must include and link both the C and FORTRAN libraries.
as | Specifies a pointer to a g32_api structure. |
msgbuf | Specifies a pointer to a buffer where a message from the host is placed. The API obtains space for this buffer by using the malloc library subroutine, and the user is responsible for releasing it by issuing a free call after the g32_read function. |
msglen | Specifies a pointer to an integer where the length, in bytes, of the msgbuf parameter is placed. The message length must be greater than 0 but less than or equal to the maximum I/O buffer size parameter specified in the HCON session profile. |
> 0 (greater than or equal to zero) | Indicates successful completion. |
-1 | Indicates an error has occurred. |
The following example illustrates the use of the g32_read function in C language.
#include <g32_api> /* API include file */ main() { struct g32_api *as, asx /* g32_api structure */ char **msg_buf; /* pointer to host msg buffer */ char *messg; /* pointer to character string */ int msg_len; /* pointer to host msg length */ char * malloc(); /* C memory allocation function */ int return; /* return code is no. of bytes read */ . . . as = &asx; msg_buff = &messg; /* point to a string */ return = g32_read(as, msg_buff, &msg_len); . . . free (*msg_buff); . . .
The g32_read function is part of the Host Connection Program (HCON).
The g32_read function requires one or more adapters used to connect to a host.
In a DBCS environment, the g32_read function only reads SBCS data from a host in the MODE_API_T mode.
/usr/include/g32_api.h | |
Contains data structures and associated symbol definitions. | |
/usr/include/g32const.inc | |
Defines Pascal API constants. | |
/usr/include/g32hfile.inc | |
Defines Pascal API external definitions. | |
/usr/include/g32types.inc | |
Defines Pascal API data types. |
List of HCON Programming References in 3270 Host Connection Program 2.1 and 1.3.3 for AIX: Guide and Reference.
Programming HCON Overview in 3270 Host Connection Program 2.1 and 1.3.3 for AIX: Guide and Reference.