IFREAD (HLI function): Difference between revisions
(Created page with " ==Summary== <dl> <dt>Description</dt> <dd>The IFREAD call (READ) obtains a line of output from Model 204.</dd> <dt>Thread type</dt> <dd>IFDIAL</dd> <dt>IFCALL function number...") |
No edit summary |
||
Line 1: | Line 1: | ||
The conventions used on this page are described in [[HLI: Function call list#Function call notation conventions|Function call notation conventions]]. | |||
==Summary== | ==Summary== |
Revision as of 22:52, 11 July 2016
The conventions used on this page are described in Function call notation conventions.
Summary
- Description
- The IFREAD call (READ) obtains a line of output from Model 204.
- Thread type
- IFDIAL
- IFCALL function number
- 9
Syntax
IFREAD(RETCODE,LINE_AREA,MSG_DESC,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 | [O,c,r] The line area is a required output parameter that is set to the output line from Model 204.
Note: If Model 204 generates a logical line of output that is longer than a connection's line size, the logical line is broken into two or more physical lines that do not exceed the connection's line size. A hyphen (-) is placed in the continuation character position of each continued line and a completion code of 2 is returned until the entire logical line has been transmitted. For example, suppose that the line size was set to 4 and Model 204 is to print the string ABCDEFGH. Three calls to IFREAD are required, as summarized below: Programs using a language indicator of 2, for example, COBOL and FORTRAN, must blank out the line area before each call to IFREAD. |
||||||||||||||||||||||
MSG_DESC | [O,i,o] The message descriptor is an optional output parameter. Model 204 returns the descriptor as an integer value in the following format:
|
||||||||||||||||||||||
LINE_LEN | [I,i,o] The line length is an optional input parameter that specifies the transfer length for IFREAD.
This parameter determines the maximum line length for the IFREAD call. If this parameter is present, it overrides any value specified on IFDIAL or IFDIALN. For PL/1, the length is the minimum of this value plus the string length. See Transfer length for output from Model 204 for more information about the IFREAD line length. |
Usage notes
Use the IFREAD call only with an IFDIAL connection to receive data from Model 204.
See Sample subroutine to convert IFREAD flags for a coding example of a subroutine that translates the message descriptor (MSG_DESC) values returned by Model 204.
You can specify a different buffer length with each call by specifying the line length in IFREAD. See the next page for detailed information about the IFREAD line length.
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 IFDIAL processing for more information about coding IFDIAL applications.
If the IFREAD call is unsuccessful, Model 204 returns an error code for either of the following error conditions:
Code | Condition |
---|---|
12 | No output ready from Model 204 call IFWRITE to provide more input. In this case, the answer area is not altered. IFREAD call not accepted (IFWRITE call expected). |
100 | No current Model 204 connection exists or the connection is lost. |
Transfer length for output from Model 204
The parameters in effect during the execution of the IFREAD call determine the length of data transferred from Model 204 and the actions taken when the receiving area is a different size than the Model 204 output line.
The following factors determine the length:
The first factor is 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.
Additionally, the transfer length for output from Model 204; this value is based on the following order of precedence, from highest to lowest:
-
The optional length parameter in the IFREAD call. The HLI application program may optionally specify a buffer length in the IFREAD call (see the LINE_LEN parameter) which is different from the CRAM buffer size returned by the IFDIAL or IFDIALN call.
For PL/1, if this length is greater than the maximum string length, the maximum string length is used.
Note: This value is in effect only for this specific IFREAD call.
-
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 maximum string length, the string length is used.
-
The standard default length, which is set relative to the host language (that is, the language indicator parameter specified in the IFDIAL or IFDIALN call); Model 204 uses either of the following lengths:
- 252 for COBOL, FORTRAN, and Assembler
- PL/1 maximum string length (dope vector)
Note: The maximum length of a data area that can be transferred over an IFDIAL thread is 32763 bytes. For more information about buffer size parameters, see Defining the runtime environment (CCAIN).
When transfer length differs from output line size
The maximum length of data that can be transferred is a result of the transfer length. If this value is different than the actual Model 204 output line size, truncation or padding may occur.
Note: For all languages, when the output transfer length is less than the Model 204 output line size, Model 204 truncates the data.
However, if the transfer length is greater than the output line size, Model 204 performs either of the following actions:
- For COBOL, FORTRAN, and PL/1 fixed string areas, pads the remaining area with spaces.
- For PL/1, Model 204 sets the current string length to the output line size. The remaining answer area is unchanged.
Overview of IFREAD data transfer
The following table summarizes the relationship between the parameters that determine the IFREAD data transfer length and the actions taken by Model 204.
The table uses the following codes:
- Lang=n, which is the language indicator specified in the IFDIAL or IFDIALN call.
- LENGTH1, which is the default length parameter in the IFDIAL call.
- LENGTH2, which is the length parameter in the IFREAD call.
- FIXED, which is a PL/1 string argument that is declared as fixed.
- VARYING, which is a PL/1 string argument that is declared as varying.
- MAXLEN, which is the maximum length of the PL/1 string.
- Pad, which indicates that Model 204 pads the remaining answer area with spaces.
- Set length, which indicates that PL/1 string length field (CURRLEN) is set to the Model 204 output line size, and the remaining answer area is unchanged.
Parameters in effect | Transfer length | Action | |||
---|---|---|---|---|---|
IFDIAL | IFREAD | ||||
Lang=1 | LENGTH1 LENGTH1 |
LENGTH2 ¬LENGTH2 |
min(LENGTH2,MAXLEN) min(LENGTH1,MAXLEN) |
Set length | |
Lang=2 | LENGTH1 LENGTH1 |
LENGTH2 ¬LENGTH2 |
LENGTH2 LENGTH1 |
Pad | |
Lang=3 | LENGTH1 LENGTH1 |
LENGTH2, ¬LENGTH2, |
FIXED FIXED |
min(LENGTH2,MAXLEN) min(LENGTH1,MAXLEN) |
Pad |
Lang=3 | LENGTH1 LENGTH1 |
LENGTH2, ¬LENGTH2, |
VARYING VARYING |
min(LENGTH2,MAXLEN) min(LENGTH1,MAXLEN) |
Set length |
Legend:
LENGTHn | Parameter was specified |
¬LENGTHn | Parameter was not specified |
min(l,m) | Transfer length is determined to be the minimum value of l and m |
Coding example (Assembler)
. . . CALL IFDIAL... . . . CALL IFWRITE... . . . MVC RLEN(4),=F'30' CALL IFREAD,(RETCODE,INPUT,MDF,RLEN),VL CLI MDF+2,X'14' DO WE NEED A PASSWORD . . . RETCODE DC F'0' INPUT DC CL30' ' MDF DS 0F MDFLEN DS H MDFTYPE DS BL2 X'80'=CLASS E ERROR MESSAGE * X'40'=NEW PAGE * X'20'=RESTART * X'10'=PASSWORD PROMPT * X'08'=$READ PROMPT * X'04'=CLASS I MESSAGE RLEN DC F'0' END