The Display Text tool simulates (as best it can) a PC browser
function on i5 System. The data to be displayed is passed in an
array of up to 9,999 elements of 78 bytes each. You must supply a
program to interface to the Display Text tool. Use the DMODSPTXT
command for a demonstration.
DMODSPTXT
The display appears and allows rollup, rolldown, move to top, scan
for a value, first page, last page, and a print option.
A selection can be made by the user of the command to return one of
the array elements. Enter:
DSPTXT ALWSELECT(*YES)
When the display appears, position the cursor to a line and press
F19. The index to the array entry is passed back to the calling
program.
F17 and F18 keys
----------------
F17 may be used to position to the first page. F18 may be used to
position to the last page. Both keys are prevented if only a single
page is displayed.
Scanning the data
-----------------
F16 may be used to scan the data for a string. If a hit is found,
the word containing the string is hi-lighted and appears at the top
of the display.
Formatting data for the DSPTXT program
--------------------------------------
In the demonstration program, the data that is displayed is just a
string of text. It is possible to format columnar data. Your
program would have to align the data in the array elements as you
want it displayed.
If you have decimal fields and are using RPG III, the EDTVAR2 TAA
Tool may be used to help align the data.
Interfacing to the DSPTXT (TAADSPNR) program
--------------------------------------------
You can use the sample program TAADSPNR2 to see how the DSPTXT
command is coded. To copy the source for this RPG III program do:
CPYTAA TAAARCMBR(TAADSPNR2)
An RPG IV version also exists (it is not used for DMODSPTXT, but is
the same code).
CPYTAA TAAARCMBR(TAADSPNR3)
This will place the source in QATTRPG in TAATOOL.
The program has a parameter list of 3 fields passed from the
DMODSPTXT CPP (TAADSPNC2). You may not need any of these.
The program assembles the TITLE (used at the top of the DSPTXT
display), the COLHDG (used for the column heading line) and the
SPLNAM (name of spooled file if printing is requested).
The array of data is passed as 9999 78 byte elements read from the
source. When the TAADSPNR program is called, the following
parameters must be passed.
TITLE A 40 byte character field with the title that will
appear at the top of the display. You must center
the title with your own technique. It may be blank.
COLHDG The column heading line that appears above the first
line of text on each page. It may be blank.
SPLNAM The name of the spooled file if printing is
requested. If the value is blank, the name DSPTXT
is used.
RTNOPT The Return Option. If *NO is entered, the F19 key
is not available. If the value is blank, *NO is
assumed.
If *NO2 is entered, the F19 key is not available and
the scan line and F16 are not available.
*YES may be specified to allow the F19 key to be
used in conjunction with the cursor position to
return the element of the array that the user has
selected. The index value is returned in the RTNIDX
field. This allows for further processing of an
entry.
*YS2 may be specified to allow the F19 key, but
prevent the scan line. The index value is returned
in the RTNIDX field.
RTNIDX The Return Index. If RTNOPT(*NO) or (*NO2) is
specified, RTNIDX will always be zero. If
RTNOPT(*YES) or (*YS2) is specified and the user did
not make a selection, the RTNIDX value will be 0.
If RTNOPT(*YES) or (*YS2) is specified and the user
made a selection using F19, the index of the element
that was selected will be returned. Note that only
the index is returned. Your program must access the
information from the array as is shown in the
demonstration program.
Normally, the RTNIDX value should be passed as 0.
However, there are cases where you will want to pass
a value.
1) If you have a large amount of text and want
to pass the entire array, but start the display
somewhere other than page 1 of the text, you
should pass the index location of the first
record to be displayed.
If your first program invokes DSPTXT (which
allows rollup for more than a single page) and
then based on the F19 selection invokes a
second program which uses DSPTXT, you will
normally want to position to the last page
displayed by the first program. To achieve
this, save the RTNIDX value from the first
program and place it in the RTNIDX field when
DSPTXT is invoked again.
ARA The Array of data to be passed. The array must be
defined as 9999 entries of 78 bytes each. See the
section on 'Determining the end of the array'.
In the demonstration program, the array data is part
of the source program. This is not a requirement.
The array information could be generated in many
different methods.
Determining the end of the array
--------------------------------
The DSPTXT function allows you to identify the 'end of array data' by
placing '%% ENDARR %%' in the first 12 positions of the element
following your last data element. When '%% ENDARR %%' sensed, the
DSPTXT function knows the maximum amount of data that exists (the
demonstration program uses this technique).
If no '%% ENDARR %%' element is found, the DSPTXT will allow rollup
until 45 consecutive blank elements have been read and then sends a
message stating that it has assumed the end of data.
If no '%% ENDARR %%' exists and the user presses F18 (last page), the
DSPTXT will check for 45 consecutive blank lines and then display the
last page that had data.
Using the function twice from the same interface
------------------------------------------------
In some cases, you may want a function that does an initial display
using DSPTXT and then based on the F19 selection, invoke another
program using DSPTXT. If the first program allows rollup to another
page, the return from the second program will cause the same page
that F19 was pressed on to be displayed again.
DSPTXT escape messages you can monitor for
-------------------------------------------
None. Escape messages from based on functions will be re-sent.
DMODSPTXT Command parameters *CMD
----------------------------
ALWSELECT A *YES/*NO parameter that determines whether the F19
command key option will exist to allow the user to
select an item on the display.
*NO is the default meaning the F19 key will not be
displayed and is not active.
*YES may be specified to allow the F19 key to be
used. The index of the element selected is passed
back to the calling program.
Restrictions
------------
None.
Prerequisites
-------------
The following TAA Tools must be on your system:
EDTVAR Edit variable
FILEFDBCK File feedback
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDESCINF Send escape information
SNDESCMSG Send escape message
Implementation
--------------
You must have a program that interfaces to the Display Text program
TAADSPNR in TAATOOL.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
DMODSPTXT *CMD TAADSPN2 QATTCMD
TAADSPNR *PGM RPG TAADSPNR QATTRPG
TAADSPNR2 *PGM RPG TAADSPNR2 QATTRPG
RPGLE TAADSPNR3 QATTRPG
TAADSPND *FILE DSPF TAADSPND QATTDDS
The TAADSPNR3 program is the RPGLE version of the TAADSPNR2 used for
copying.
Structure
---------
TAADSPNR RPG Pgm - Display Text main program
TAADSPND Display file
DMODSPTXT Cmd
TAADSPNC2 CL Pgm
TAADSPNR2 RPG Pgm
|