g32_get_cursor Function

Purpose

Sets the row and column components of the g32_api structure to the current cursor position in a presentation space.

Libraries

HCON Library
C (libg3270.a)
Pascal (libg3270p.a)
FORTRAN (libg3270f.a)

C Syntax

#include <g32_api.h>

g32_get_cursor ( as)

struct g32_api as

Pascal Syntax

function g32curs (var  as : g32_api) : integer; external;

FORTRAN Syntax

EXTERNAL G32GETCURSOR

INTEGER  AS(9), G32GETCURSOR

RC = G32GETCURSOR(AS)

Description

The g32_get_cursor function obtains the row and column address of the cursor and places these values in the as structure. An application can only use the g32_get_cursor function in API/3270 mode.

HCON application programs using the Pascal language interface must include and link both the C and Pascal libraries. Applications programs using the FORTRAN language for the HCON API must include and link both the C and FORTRAN libraries.

The g32_get_cursor function is part of the Host Connection Program (HCON).

The g32_get_cursor function requires one or more adapters used to connect to a host.

C Parameters

Item Description
as Specifies a pointer to the g32_api structure. This structure contains the row (row) and column (column) address of the cursor. Status information is also set in this structure.

Pascal Parameters

Item Description
as Specifies the g32_api structure.

FORTRAN Parameters

Item Description
AS Specifies the g32_api equivalent structure as an array of integers.

Return Values

Item Description
0 Indicates successful completion.
  • The corresponding row element of the as structure is the row position of the cursor.
  • The corresponding column element of the as structure is the column position of the cursor.
-1 Indicates an error has occurred.
  • The errcode field in the g32_api structure is set to the error code identifying the error.
  • The xerrinfo field can be set to give more information about the error.

Examples

Note: The following example is missing the required g32_open and g32_alloc functions which are necessary for every HCON Workstation API program.

The following example fragment illustrates, in C language, the use of the g32_get_cursor function in an api_3270 mode program:

#include <g32_api.h>      /* API include file */
#include  <g32_keys.h>
main()
{
struct g32_api *as;      /* g32 structure */
char *buffer;         /* pointer to char string */
int return;         /* return code */
char *malloc();         /* C memory allocation function*/
.
.
.
return = g32_notify(as,1);   /* Turn notification on */
buffer = malloc(10);
return = g32_get_cursor(as);   /* get location of cursor */
printf ("The cursor position is row: %d col: %d/n", 
   as -> row, as -> column);
/* Get data from host starting at the current row and column */
as -> length = 10;      /* length of a pattern on host */
return = g32_get_data(as,buffer); /* get data from host */
printf("The data returned is <%s>\n",buffer);
/* Try to search for a particular pattern on host */
as ->row =1;      /* row to start search */
as ->column =1;      /* column to start search */
return = g32_search(as,"PATTERN");
/*Send a clear key to the host */
return = g32_send_keys(as,CLEAR);
/* Turn notification off */
return = g32_notify(as,0);
.
.
.