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

WRITESTREAM

» 

Technical documentation

» Feedback

 » Table of Contents

 » Glossary

 » Index

WRITESTREAM creates the data stream that your program on the HP 3000 sends to the host (LU.T2 emulation only).

Syntax

                      I         I         I        CA      I
WRITESTREAM      (terminalid, offset, outbuflen, outbuf, result)

Parameters

terminalid (input)

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

offset (input)

Integer specifying the offset, in characters, into the internal screen image. The data transfer starts at the location you specify in offset. The first character has an offset value of zero. The offset parameter must be zero when the DBCS option to the OPEN3270 intrinsic is enabled.

outbuflen (input)

Integer specifying the length of the character string outbuf, in characters. The maximum values for outbuflen are as follows:

540 bytes for 480-character screens

2160 bytes for 1920-character screens

3870 bytes for 3440-character screens

outbuf (input)

Character array that contains the data stream to be written to the internal screen image.

result (output)

The following values can be generated by the WRITESTREAM intrinsic:

0 = Successful completion.

1 = Device not open.

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

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)

44 = WRITESTREAM called during LU.T1 session.

52 = Data stream is too long.

54 = Device not opened in transparent mode.

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

Description

The WRITESTREAM intrinsic can be used only during LU.T2 emulation and only in transparent mode. To open a device in transparent mode, call the OPEN3270 intrinsic with bit 14 of the flags parameter set to 1.

To send data to the host, call WRITESTREAM to create the data stream, then call TRAN3270 to transmit it to the host. WRITESTREAM accepts an array of characters destined for the host and puts these characters into your internal screen image. You must supply the terminal identifier, the array of characters, and the number of characters in the data stream.

The maximum length of the outbuf string (and the maximum value for the outbuflen parameter) is as follows:

540 bytes for 480-character screens

2160 bytes for 1920-character screens

3870 bytes for 3440-character screens

After your application receives the initial screen from the host (for example, the CICS or TSO welcome screen), it is communicating over the LU-SSCP session. At this point, data you write to the internal screen image with the WRITESTREAM intrinsic will be appended to the end of the data received from the host. When you call TRAN3270 to transmit the internal screen image to the host, data is read starting from the first position after the last data received from the host. Therefore, you must set the offset parameter of the WRITESTREAM intrinsic to the length of the last data stream received from the host. (The offset in your WRITESTREAM call should equal the actinbuflen from your last call to READSTREAM). An offset of zero would place the data at the beginning of the internal screen image, before the position where reading begins, and an empty RU would be sent to the host.

After the BIND, when the LU-LU session has been established, the internal screen image is read from the beginning (position 0). When you call TRAN3270, the entire screen image, beginning at position 0, is transmitted to the host. Therefore, while your application is communicating over the LU-LU session, you should set the offset parameter of the WRITESTREAM intrinsic to 0.

If you make multiple calls to WRITESTREAM before you call TRAN3270, each write must begin where the last one left off. In other words, the offset of the second WRITESTREAM call should be the outbuflen value from the first call, the offset of the third call should be the sum of the outbuflen values from the previous two calls, and so on.

When sending data to the host, your WRITESTREAM buffer needs to contain only the data to be transferred. SNA IMF divides this data into frames and adds the SDLC and SNA protocol headers. The AID key and cursor address, which you specify in your call to TRAN3270, are inserted at the front of the first frame. You can suppress insertion of the AID key and cursor address in transparent mode. See the description of TRAN3270, earlier in this chapter, for more information.

If cursor suppression is not used, and you are sending the [CLEAR] key or a PA key during an LU.T2 session, call WRITESTREAM with an outbuf of length zero before calling TRAN3270. In transparent mode, SNA IMF will not check the AID key to determine whether it is the [CLEAR] key or a PA key. In non-transparent mode, no data is sent with the [CLEAR] or PA keys.

Call WRITESTREAM only in transparent mode. See Chapter 2 “Using SNA IMF Intrinsics” for information about transparent mode.

COBOL Calling Sequence

CALL "CWRITESTREAM" USING TERMINALID OFFSET OUTBUFLEN OUTBUF RESULT. (on MPE V and in compatibility mode on MPE XL)

CALL INTRINSIC "WRITESTREAM" USING TERMINALID OFFSET OUTBUFLEN OUTBUF 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 WRITESTREAM (TERMINALID, OFFSET, OUTBUFLEN, OUTBUF, RESULT)

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

BASIC Calling Sequence

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

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

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

SPL Calling Sequence

WRITESTREAM (TERMINALID, OFFSET, OUTBUFLEN, OUTBUF, RESULT)

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

Pascal Calling Sequence

WRITESTREAM (TERMINALID, OFFSET, OUTBUFLEN, OUTBUF, RESULT);

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

C/XL Calling Sequence

WRITESTREAM (&TERMINALID, &OFFSET, &OUTBUFLEN, OUTBUF, &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 **************************}const   MAXBUFLEN = 2160;                    { maximum buffer length for }                                        { 1920-character screens }                                        { in transparent mode }...type   shortint      = -32768..32767;       { global type, two bytes (half word) }var   terminalid    : shortint;          { value returned by OPEN3270 intrinsic }   result        : shortint;...procedure WRITESTREAM;  intrinsic;...{************************** Local Declarations **************************}var   offset      : shortint;         { All WRITESTREAM variables except }   outbuflen   : shortint;         { terminalid and result are local. }   outbuf      : packed array[1..MAXBUFLEN] of char;...{************** Variable Initialization and Intrinsic Call **************}offset := 0;outbuflen := 51;outbuf := 'logon applid(tso) data(sales/sales) logmode(imf2k) ';
WRITESTREAM (terminalid, offset, outbuflen, outbuf, result);
Feedback to webmaster