Previous Page Contents Page Next Page

4.6 Copy Field to String

The Copy Field to String function copies all the characters in a specified field in the current presentation space to a data string in your application program. Copied characters are translated from EBCDIC (used in the host presentation space) to ASCII before they are stored in the data string.

4.6.1 Prior Functions

Your application program must be connected to a valid presentation space before issuing this function. Use Connect Presentation Space to connect to a presentation space.

4.6.2 Request Parameters

Your application program must pass the following parameters to this function:

func_number

34 HA_COPY_FIELD_TO_STR

data_string

An empty data string to hold the information copied from the field. This string must be at least the length specified in the data_length parameter.

data_length

Number of bytes you want to copy from the specified field. If the option is set in Set Session Parameters, this must be twice the number of character positions in the field, because each character copied will be followed by its EAB.

ps_position

Position of the field you want to copy in the presentation space. The value you supply here can be any position within the target field (including the position of the attribute byte), but the copy will always begin at the first position of the field.

The range for this number depends on the type of display you are using. Presentation Space Sizes, shows the PS positions for each of the display models.

4.6.3 Returned Parameters

This function returns the following parameters to your application program:

func_number

34

data_string

Information copied from the beginning of the field identified by ps_position.

data_length

The number of characters in the returned data string.

return_code

The valid return codes are:

HARC_SUCCESS

Function was successful; field was copied to your application program.

HARC_NO_CONNECTION

Application program is not connected to a valid presentation space.

HARC_BAD_PARM

A supplied parameter was not valid.

HARC_TRUNCATION

Field in the presentation space was not the same length as the data_length parameter supplied by your application program (either longer or shorter). Some data may have been truncated.

HARC_INVALID_PS_POS

Your application program specified a presentation space position that is not valid.

HARC_SYSTEM_ERROR

System error occurred.

HARC_STR_NOT_FOUND_UNFM_PS

String or field was not found, or host presentation space was unformatted.

4.6.4 Affected by Set Session Parameters?

This function is affected by the following options of the Set Session Parameters function:

Copies each character from the presentation space followed by its extended attribute byte.

Does not copy attribute bytes.

If the option is set, causes the copied extended attribute bytes to be translated into CGA format. If the option is not set, is ignored.

If the option is set, causes extended attribute bytes to be copied without translation. If the option is not set, is ignored.

For more information, see Set Session Parameters.

4.6.5 Usage and Restrictions

Usage and restrictions are:

Previous Page Contents Page Top of Page Next page