HPlogo SNA IMF Programmer's Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 Intrinsics Used with Standard MPE I/O

WRITEFIELD

» 

Technical documentation

» Feedback

 » Table of Contents

 » Glossary

 » Index

WRITEFIELD writes data from your program on the HP 3000 into an unprotected field of the internal screen image.

Syntax

                      I           I       I      CA         I         I
WRITEFIELD       (terminalid, fieldnum, offset, outbuf, outbuflen, result)

Parameters

terminalid (input)

Integer identifying the terminal. The terminalid is returned in a call to the OPEN3270 intrinsic.

fieldnum (input)

Integer specifying the relative number of the field into which data will be inserted. Field number 1 is the field following the first attribute character in the internal screen image. If the screen is unformatted (the SCREENATTR intrinsic has returned numfields = 0), you should specify 0 in the fieldnum parameter.

offset (input)

Integer specifying the character offset at which writing begins within the field. The first character position in the field is zero. The offset parameter must be zero when the DBCS option to the OPEN3270 intrinsic is enabled.

outbuf (input

Character array containing the data to replace the previous contents of the field. Only uppercase and lowercase alphabetics, numerics, ASCII character codes 34 and 36 (octal), and certain special characters are allowed.

The uppercase and lowercase alphabetics, numerics, ASCII character codes 34 and 36 (octal), and the special characters correspond to the following ASCII character codes:

34, 36, and 40 through 377 (octal)

1C, 1E and 20 through FF (hexadecimal).

Entering 34 (octal) is equivalent to pressing the [DUP] key on an IBM 3278 display station keyboard. Entering 36 (octal) is equivalent to pressing the [FIELD MARK] key on a 3278 keyboard.

Several characters are represented differently in ASCII and in EBCDIC. In Table 3-4 “Different Displayed Characters, HP and IBM”, the first column shows the ASCII character representions used by HP terminals and printers; the second column shows the EBCDIC character representations used by IBM terminals and printers.

Table 3-4 Different Displayed Characters, HP and IBM

ASCII Character

EBCDIC Character

[ (left bracket)¢ (cent sign)
] (right bracket)! (exclamation)
! (exclamation)| (or sign)
^ (caret) (not sign)

 

In a numeric field, you can enter only numeric characters (0-9), the period (.), the minus sign (-), and the DUP character (octal 32). The attribute character indicates whether a field is numeric.

Asian users: When the DBCS option to the OPEN3270 intrinsic is enabled, you may enter Shift-Out (hex "0E") and Shift-In (hex "0F") control characters as valid data. Data between SO and SI control characters is transmitted to the host without any range checking.

outbuflen (input)

Integer indicating the length, in characters, of the string to be written into the field. outbuflen must be less than or equal to the maxfieldlen parameter returned by the FIELDATTR intrinsic.

If outbuflen is larger than the maxfieldlen value returned by FIELDATTR, or if offset extends beyond the end of the field, then no data is written to the internal screen image, and the result parameter returns 13.

result (output)

The following values can be generated by the WRITEFIELD intrinsic:

0 = Successful completion.

1 = Device not open.

9 = Host modified screen since last receive request. (MPE V only)

10 = Attempt made to update a protected field.

11 = Non-existent field number specified.

12 = Invalid character in field or data stream.

13 = Field length specified for WRITEFIELD is too long.

14 = Attempt made to update a field or transmit from an LU.T3 printer.

17 = Attempt made to write to a field where input is inhibited.

21 = Field offset specified is out of range.

22 = BASIC calling sequence error has occurred.

25 = Intrinsic call made while in split stack mode.

26 = Intrinsic call made with the parameter value out of bounds.

29 = Called intrinsic with a request already outstanding. (No-wait I/O only)

30 = Internal error occurred in IMF intrinsic.

53 = Invalid intrinsic called for data stream mode device.

97 = An attempt was made to write SO (hex "0E") control character to a field where only 8-bit data is allowed.

98 = An attempt was made to write SO (hex "0E") control character to a field where only 16-bit data is allowed.

100 = A bad (non-zero) offset was specified in the intrinsic call.

Description

The WRITEFIELD intrinsic allows you to replace the contents of an unprotected field with new data or to put data into a field that was previously empty. If WRITEFIELD is successful, the Modified Data Tag (MDT) bit in the attribute character for that field is turned on.

If the screen is unformatted (the SCREENATTR intrinsic has returned numfields = 0), you can write to the screen by calling WRITEFIELD with the fieldnum parameter set to zero.

You may use either WRITEFIELD or STREAM3270 to enter data into your internal screen image. The WRITEFIELD intrinsic allows you to access a field by its number and write only to that field. STREAM3270 allows you to move across the internal screen image and enter data into more than one field with a single intrinsic call.

Call the WRITEFIELD intrinsic in non-transparent mode.

COBOL Calling Sequence

CALL "CWRITEFIELD" USING TERMINALID FIELDNUM OFFSET OUTBUF OUTBUFLEN RESULT.

(on MPE V and in compatibility mode on MPE XL)

CALL INTRINSIC "WRITEFIELD" USING TERMINALID FIELDNUM OFFSET OUTBUF OUTBUFLEN RESULT. (in native mode on MPE XL)

All parameters are numeric data items except OUTBUF, which is an alphanumeric data item.

FORTRAN Calling Sequence

CALL WRITEFIELD (TERMINALID, FIELDNUM, OFFSET, OUTBUF, OUTBUFLEN, RESULT)

All parameters are integer variables except OUTBUF, which is a character array.

BASIC Calling Sequence

CALL BWRITEFIELD (T, N, O1, O$, L9, R) (on MPE V and in compatibility mode on MPE XL)

CALL WRITEFIELD (T, N, O1, O$, L9, R) (in native mode on MPE XL)

All parameters are integer variables except O$, which is a string variable.

NOTE: When WRITEFIELD is called from BASIC, the actual number of characters moved is no greater than the logical length of the string variable passed in O$. BASIC cannot write a string of more than 255 characters. Because a field length may exceed 255 characters, offset gives you a way to choose the portion of the field you want to write. By making multiple calls to WRITEFIELD with different offsets, your BASIC programs can accommodate a field that exceeds 255 characters.

SPL Calling Sequence

WRITEFIELD (TERMINALID, FIELDNUM, OFFSET, OUTBUF, OUTBUFLEN, RESULT)

All parameters are integer variables except OUTBUF, which is a byte array.

Pascal Calling Sequence

WRITEFIELD (TERMINALID, FIELDNUM, OFFSET, OUTBUF, OUTBUFLEN, RESULT);

All parameters are short integer variables except OUTBUF, which is a packed array of char.

C/XL Calling Sequence

WRITEFIELD (&TERMINALID, &FIELDNUM, &OFFSET, OUTBUF, &OUTBUFLEN, &RESULT);

All parameters are of type short, except OUTBUF, which is an array of characters (a pointer to a char).

Pascal Program Excerpts

Following are excerpts from a Pascal program that calls SNA IMF intrinsics. For examples of complete Pascal programs in non-transparent and transparent modes, see Appendix F “Sample Programs”

{************************** Global Declarations **************************}type   shortint      = -32768..32767;       { global type, two bytes (half word) }...var   terminalid    : shortint;          { value returned by OPEN3270 intrinsic }   result        : shortint;...procedure WRITEFIELD;  intrinsic;...{************************** Local Declarations **************************}var   fieldnum    : shortint;         { All WRITEFIELD variables except }   offset      : shortint;         { terminalid and result are local. }   outbuf      : packed array[1..MAXINBUFLEN] of char;                                   { The value of MAXINBUFLEN is returned }                                   { by the FIELDATTR intrinsic. }   outbuflen   : shortint;...{************** Variable Initialization and Intrinsic Call **************}offset := 0;fieldnum := 0;                     { Write to unformatted screen. }outbuf := 'logon applid(tso) data(sales/sales) logmode(imf2k) ';outbuflen := 51;WRITEFIELD (terminalid, fieldnum, offset, outbuf, outbuflen, result);
Feedback to webmaster