Print Fields: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
Line 19: Line 19:


===Syntax===
===Syntax===
[[Image:Printfields,png]]
[[Image:Printfields.png]]


===Supplemental Syntax ("field-spec" parameter)===
===Supplemental Syntax ("field-spec" parameter)===

Revision as of 01:46, 30 January 2013

The Print Fields (PR F)statement uses the capabilities of full screen processing to print information at any position on the screen or in a window using a variety of attributes.

1.) MAT grouping is now allowed in all full screen processing statements. This feature allows you to indicate that input or output should alternate between all MAT variables that are specified within parentheses in the I/O list. In the following code fragment, the A$ variable identifies the positions on the screen from which input values should be drawn. Business Rules! will assign the first input value to the first element of B$. However, because the B$ and C matrices are specified within parentheses, it will then assign the second input value to the first element of C. The third value will go to B$, the fourth to C, and so on until both matrices are fully assigned. The last input value will go to X$.
00020 INPUT FIELDS A$: (MAT B$,MAT C),X$

Without MAT grouping, the above line must be coded as follows in order to achieve the same results (this example assumes that B$ and C have each been dimensioned for five elements):

 00020 INPUT FIELDS A$:B$(1),C(1),B$(2),C(2),B$(3),C(3),B$(4),C(4),B$(5),C(5),X$

MAT grouping is a lot easier to code, executes faster, and most importantly, handles much larger arrays than are possible without using MAT grouping, as the resulting compiled line takes up less space in memory. The number of matrices that can be grouped together is 62, which in practical terms is no limit. All matrices in a group must have the same number of elements per matrix, or an error 0106 will result. Only MAT variables may be used in such groupings.

2.) Using an alpha character for field length in INPUT FIELDS or PRINT FIELDS will now produce an error. Previously the character as well as the attributes following it were being ignored. (This may affect your programs). Extraneous characters in attribute specifications will still be ignored.
3.) The FMT specification is now supported. However, because Business Rules does no formatting or Verifying of data that is output to the screen with FMT, FMT is equivalent to the C format spec on screen output.

Comments and Examples

PRINT FIELDS displays data anywhere on the screen except the status line. One field or several fields can be displayed with the PRINT FIELDS statement. PRINT FIELDS, INPUT FIELDS, RINPUT FIELDS, INPUT SELECT and RINPUT SELECT are all used for full screen processing. See the Screen I/O chapter for information and examples common to all of these statements.

Syntax

Supplemental Syntax ("field-spec" parameter)

Defaults

1.) Output to the full screen (not a window).
2.) Interrupt the program if an error occurs and "ON error" is not active.
3.) Fraction length=0.
4.) Maximum DIM length.
5.) Use current attributes.

Parameters

The "wind-num" parameter represents the file number of a window which has already been opened by an OPEN window statement. When this parameter is used, Business Rules! inputs to and outputs from the window as if it were a separate screen: the first row and column of the window are considered row 1 and column 1. Note that it's preceded by an asterisks.

"FIELDS" is a required keyword which signals that data is to be printed to specific fields on the screen. It must be followed by one of three possible parameters, each of which defines the fields to be used for input.

The "MAT string-array" parameter indicates that multiple field definitions are located in the specified string array. The array must contain all the same elements that are identified in the "field-spec" parameter.

The "string expression" parameter may also be used to define the input fields, but its value must also contain all the same elements that are identified in the "field-spec" parameter.

The "field-spec" parameter represents a separate syntax (see the Supplemental Syntax) that identifies the following for each input field: row number; column number; format type, length and fraction length (if required) of the data to be input; and the monochrome and/or color attributes which are to be used for the field (control attributes are ignored).

See Format Specification and File I/O for information about the format specifications which may be used with the PRINT FIELDS statement.

After the required colon, at least one "data-item" or "MAT array-name" is required. These two parameters represent the list of variables to be assigned values from the entered data. Multiple variables must be separated by commas.

PRINT FIELDS provides error processing with the optional "error-cond line-ref" parameter. See Error Conditions for more information.

Technical Considerations

1.) Relevant error conditions are: CONV, ERROR, EXIT, HELP, IOERR, and SOFLOW.
2.) Whereas control attributes are acted upon in INPUT FIELDS and RINPUT FIELDS statements, they are ignored if specified in PRINT FIELDS.
3.) When OPTION INVP is in effect, the normal printing of commas and periods is interchanged in PIC, N, NZ, L, G and GZ format specifications to produce European-style numbers.
4.) See Functions for information about CNT, which applies to errors in field definition arrays used in full screen processing.

See Also