IFWRITE (HLI function)

From m204wiki
Revision as of 23:09, 8 July 2016 by ELowell (talk | contribs) (Created page with " ==Summary== <dl> <dt>Description</dt> <dd>The IFWRITE call (WRITE) sends a line of input to Model 204.</dd> <dt>Thread type</dt> <dd>IFDIAL</dd> <dt>IFCALL function number</d...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Description
The IFWRITE call (WRITE) sends a line of input to Model 204.
Thread type
IFDIAL
IFCALL function number
10

Syntax

IFWRITE|IFWRIT(RETCODE,LINE_AREA,LINE_LEN)

Compile-only form
Not available
Execute-only form
Not available

Specify the parameters in the syntax order shown above.

Parameter Description
RETCODE [O,i,r] The Model 204 return code is the required output parameter. The code is a binary integer value.
LINE_AREA [I,c,r] The line area is a required input parameter that is the input line to be sent to Model 204.
LINE_LEN [I,i,o] The line length is an optional input parameter that specifies the transfer length for IFWRITE.

This parameter determines the maximum line length for the IFWRITE call. If this parameter is present, it overrides any value specified in IFDIAL or IFDIALN. For PL/1, the length is the minimum of this value plus the string length.

See Transfer length for input to Model 204 for more information about the input line length.

Usage notes

Use the IFWRITE call only with an IFDIAL thread to transmit data to Model 204.

When using IFWRITE, note that %VAR must be a string equal to TERMINAL and either a PREPARE or IDENTIFY imagename is required prior to writing a new image. See HLI: IFDIAL processing for more information about coding IFDIAL applications.

You can specify a different buffer length with each call by specifying the line length in IFWRITE.

Completion return code (RETCODE)

Code your IFDIAL application to check the return code for the following values:

Code Required action
1 Call IFWRITE next to provide Model 204 with input.
2 Call IFREAD next to get more output from Model 204.

See HLI: IFDIAL processing for more information about coding IFDIAL applications.

If the IFWRITE call is unsuccessful, Model 204 returns an error code for either of the following error conditions:

Code Error condition
12 IFWRITE call not accepted (IFREAD call expected).
100 No current Model 204 connection exists or the connection is lost.

Transfer length for input to Model 204

The parameters in effect during the execution of the IFWRITE call determine the length of data transferred to Model 204. Several factors determine the length.

The first factor is the PL/1 string length; for PL/1 compilers (F-level, Optimizer and Checkout) use a dope vector when passing character string arguments. This dope vector contains the maximum length of the string and its address. For strings declared as VARYING, it also contains the current length.

The next factor is the transfer length for input to Model 204. This value is based on the following order of precedence, from highest to lowest:

  1. The optional length parameter in the IFWRITE call.

    For PL/1, if this length is greater than the current string length, the current string length is used.

    Note: This value is in effect only for this specific IFWRITE call.

  2. The optional default length parameter in the IFDIAL call. This new default remains in effect until IFHNGUP is called.

    For PL/1, if this length is greater than the current string length, the current string length is used.

  3. The standard default length is one of the following:
    • 252 for COBOL, FORTRAN, and Assembler
    • PL/1 current string length (dope vector)

Note: The maximum length of a data area that can be transferred over an IFDIAL thread is 32763 bytes. For all languages, if the transfer length is greater than the CRAM buffer size, the data is truncated and the length adjusted.

For more information about buffer size parameters, see Defining the runtime environment (CCAIN).

Overview of IFWRITE data transfer

The following table, "IFWRITE data transfer length," summarizes the relationship between the parameters that determine the IFWRITE data transfer length.

The table uses the following codes:

  • Lang=n is the language indicator specified in the IFDIAL or IFDIALN call.
  • LENGTH1 is the default length parameter in the IFDIAL call.
  • LENGTH2 is the length parameter in the IFREAD call.
  • FIXED is a PL/1 string argument that is declared as fixed.
  • VARYING is a PL/1 string argument that is declared as varying.
  • CURRLEN is the current length of the PL/1 string.
  • LENGTHn signifies that the parameter was specified.
  • ¬LENGTHn signifies that the parameter was not specified.
  • min(l,m) is the transfer length, which is the minimum value of l and m.
  • IFWRITE data transfer length
    Parameters in effect Transfer length
    IFDIAL IFREAD
    Lang=1 LENGTH1

    LENGTH1
    LENGTH1

    LENGTH1
    LENGTH2

    ¬LENGTH2
    LENGTH2

    ¬LENGTH2

     

    Lang=2 LENGTH1

    LENGTH1
    ¬LENGTH1

    ¬LENGTH1
    LENGTH2

    ¬LENGTH2
    LENGTH2
    ¬LENGTH2

    LENGTH2

    LENGTH1
    LENGTH2
    252

    Lang=3 LENGTH1

    LENGTH1
    ¬LENGTH1

    ¬LENGTH1
    LENGTH2, FIXED

    ¬LENGTH2, FIXED
    LENGTH2, FIXED

    ¬LENGTH2, FIXED
    min(LENGTH2,MAXLEN)

    min(LENGTH1,MAXLEN)
    min(LENGTH2,MAXLEN)

    CURRLEN
    Lang=4 LENGTH1

    LENGTH1
    ¬LENGTH1
    ¬LENGTH1

    LENGTH2, VARYING

    ¬LENGTH2, VARYING
    LENGTH2, VARYING

    ¬LENGTH2, VARYING
    min(LENGTH2,MAXLEN)

    min(LENGTH1,MAXLEN)
    min(LENGTH2,MAXLEN)

    CURRLEN

    Coding example (Assembler)

    . . . CALL IFDIAL... . . . CALL IFREAD... . . . MVC WLEN(4),=F'9' CALL IFWRITE,(RETCODE,LOGONMSG,WLEN),VL CLC RETCODE(4),=F'2' BNE END . . . END ABEND 999,DUMP . . . RETCODE DC F'0' LOGONMSG DC C'LOGON USR' WLEN DC F'0' END