Write Data (QsnWrtDta) API


  Required Parameter Group:

1 Data Input Char(*)
2 Data length Input Binary(4)

  Omissible Parameter Group:

3 Field ID Input Binary(4)
4 Row Input Binary(4)
5 Column Input Binary(4)
6 Starting monochrome attribute Input Char(1)
7 Ending monochrome attribute Input Char(1)
8 Starting color attribute Input Char(1)
9 Ending color attribute Input Char(1)
10 Command buffer handle Input Binary(4)
11 Low-level environment handle Input Binary(4)
12 Error code I/O Char(*)

  Returned Value:

Return code Output Binary(4)

  Default Public Authority: *USE

  Service Program: QSNAPI

  Threadsafe: No

The Write Data (QsnWrtDta) API writes data to the display at a given row and column using standard attributes. If a command buffer is specified that does not contain a previous or current WTD command, one is implicitly added to the buffer using the control characters QSN_CC1_NULL and QSN_CC2_UNLOCKBD. The display address after this operation will be one position past the last data byte written to the screen (including the ending screen attribute, if any).

This command corresponds indirectly to the 5250 Write to Display command (WTD) with a Set Buffer Address order if the row and column are specified. (For an indirect operation, a WTD is placed in the command buffer only if one does not already exist in that buffer.)


Restrictions

If window mode is not set and the data (including attributes) exceeds the length of a row, the data will be wrapped to the next line. If bottom-to-top wrapping is not supported, a CPFA308 error occurs when the data (including attributes) exceeds the last row on the screen. If window mode is set, data that exceeds the width of the window will not be truncated or wrapped within the window, but will wrap across screen rows.

If the field ID given was created or last redefined by the QsnSetFldCC API, a CPFA346 will be signaled. This API should only be used to write data to fields that are not CCSID-capable. QsnWrtDta is only able to enforce this for fields that have an associated field ID, however.


Authorities and Locks

None


Required Parameter Group

Data
INPUT; CHAR(*)

The data to be written to the screen. If the data being passed is graphic DBCS, the data must be enclosed by extended ideographic attributes. (Use the Write Data (QsnWrtDta) API to specify the data stream Write Extended Attribute order. See the 5250 Functions Reference, SA21-9247, for further details.)

Data length
INPUT; BINARY(4)

The number of characters contained in the data parameter.


Omissible Parameter Group

Field ID
INPUT; BINARY(4)

The field ID indicating the field at which to set the display address. If this parameter is specified with a nonzero value, the row and column parameters are ignored and the row and column values corresponding to the field ID are used to set the display address. If neither the field ID nor the row and column parameters are specified, the current display address is used.

Row
INPUT; BINARY(4)

The row at which to write the data. The row parameter must refer to a row no greater than the current screen or window mode height (if window mode is enabled). The actual screen row used for a screen I/O operation is calculated using the formula base+offset=actual. The base is the row location of the top window border (0 for full screen) if offset is positive, or the row location of the bottom window border (screen height plus 1 for full screen) if offset is negative. The offset is the row parameter value specified, and actual is the actual screen row to be used. A CPFA307 error occurs if an incorrect row value is specified.

If both the field ID and the row and column parameters are omitted, the data is written starting at the current display address. If this is the case and the command is a direct operation, or the buffer specified does not contain a preceding output operation that sets the display address, the current display address is set to row 1, column 1 prior to writing the data.

Row and column must both be specified or omitted; one cannot be specified if the other is omitted.

Column
INPUT; BINARY(4)

The column at which to write the data. The column parameter must refer to a column no greater than the current screen or window mode width (if window mode is on). The actual screen column used for a screen I/O operation is calculated using the formula base+offset=actual. The base is the column location of the left window border (0 for full screen) if offset is positive, or the column location of the center window border (screen width plus 1 for full screen) if offset is negative. The offset is the column parameter value specified, and actual is the actual screen column to be used. A CPFA307 error occurs if an incorrect column value is specified.

Starting monochrome attribute
INPUT; CHAR(1)

The initial screen attribute for monochrome displays. If this parameter is omitted and monochrome attributes are to be used, no initial attribute is written to the display for the data.

The monochrome and color attributes parameters are the initial and ending screen attributes: an initial and ending screen attribute to be used for a monochrome or a color display, respectively. One of these parameters will be selected based on the underlying display type, and the other will be discarded. Any of the attributes can be specified as a special value, X'00', indicating that no screen attribute should be written to the display. If the initial screen attribute is specified as an actual attribute, the data column, if specified, must be greater than or equal to 2. The initial screen attribute, if not X'00', will be written to the screen at the column previous to the first data character if row and column are specified, otherwise to the current display address. The ending screen attribute, if not X'00', will be written at the column directly after the last data character. See Screen Attribute Characters for a description of the screen attribute values.

Ending monochrome attribute
INPUT; CHAR(1)

The ending screen attribute for monochrome displays. If this parameter is omitted, and monochrome attributes are to be used, no ending attribute is written to the display for the data.

Starting color attribute
INPUT; CHAR(1)

The initial screen attribute for color displays. If this parameter is omitted and color attributes are to be used, no initial attribute is written to the display for the data.

Ending color attribute
INPUT; CHAR(1)

The ending screen attribute for color displays. If this parameter is omitted and color attributes are to be used, no ending attribute is written to the display for the data.

Command buffer handle
INPUT; BINARY(4)

A handle for the command buffer in which to store the command. If this parameter is omitted or specified as 0, this is a direct operation and the data is written to the screen at the specified location. Otherwise, this is an indirect operation and the command is stored in the command buffer without an I/O operation taking place.

Low-level environment handle
INPUT; BINARY(4)

The low-level environment that the operation applies to. If this parameter is omitted or given with a value of zero, the default low-level environment is used.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter. If this parameter is omitted, diagnostic and escape messages are issued to the application.


Returned Value

Return code
OUTPUT; BINARY(4)

A return code indicating the result of the operation. The value returned will be 0 if the operation was successful, or -1 otherwise.


Error Messages

Message ID Error Message Text
CPF24B4 E Severe error while addressing parameter list.
CPF3CF1 E Error code parameter not valid.
CPF3CF2 E Error(s) occurred during running of &1 API.
CPFA301 E Command buffer is full.
CPFA303 E Error occurred for screen I/O operation.
CPFA304 E Data-stream error &1 reported for screen I/O operation.
CPFA305 E Cannot add operation to command buffer.
CPFA307 E Screen position &1, &2 outside of display or window area.
CPFA308 E Attempt to write data past end of display.
CPFA30D E Invalid screen attribute.
CPFA31D E Attempt to write outside of window area.
CPFA31E E Required parameter &1 omitted.
CPFA331 E Buffer handle incorrect.
CPFA333 E Parameter &1 not positive integer value.
CPFA334 E Low level environment handle incorrect.
CPFA335 E Screen address parameter error.
CPFA33C E Undefined field ID &1.
CPFA33F E Error occurred during data conversion.
CPFA343 E Output operation not done.
CPFA344 E The file &2 in library &3 is not valid.
CPFA345 E The invite active flag is not valid.
CPFA346 E Operation for field ID &1 not valid.


API introduced: V2R3

[ Back to top | Dynamic Screen Manager APIs | APIs by category ]