Non Interactive 'In Progress' Displays
We have discovered a technique where you can have APPX display each record in a file, and for each record indicate the status of that record as the status changes, and then move on to the next record in the file. This is the same kind of display you get when you restructure files, or process the Data Dictionary to name just a few places in the runtime application. For example, when you restructure files in a database, APPX displays the file name, then various messages that describe the progress (Restructuring, Restructured, Structure File Rebuilt, etc.), and then moves on to the next file.
There is an example of how to do this in the '1EX' application that ships with APPX, however, it is quite complex, has several memory files, and probably as much code as the INVOICES POST routine in Accounts Payable.
This is a much simpler technique. First, define an INPUT process with a scrolling frame. You can use whatever sizes and positions are appropriate, and populate it with whatever fields you want. In the start of process, set SCROLL TO END equal to "Y". This causes APPX to read and display every record in the file instead of just reading enough to fill the scrolling display. The second part (and this is the secret) is in Option Intercept, you can do whatever processing you want (i.e. invoke a subroutine, etc) and then set OPTION = REDISPLAY. You should only do this if INTERACTIVE PHASE = DATA SCROLL, which tells you that APPX is still reading records to fill the display. When you set the OPTION = REDISPLAY, this will cause APPX to go back to the image, redisplay all the fields for the same record, and then return to Option Intercept event point.
Consider the following OPTION INTERCEPT code:
IF --- INTERACTIVE PHASE NE DATA SCROLL T END IF --- TEMP 80 EQ STATE 1 C** GOSUB :PERFORM SOME PROCESSING T SET --- TEMP 80 = STATE 2 T SET --- OPTION = REDISPLAY T DISPLAY --- TEMP 80 (AT APPEARANCE # ) T END IF --- TEMP 80 EQ STATE 2 C** GOSUB :PERFORM SOME DIFFERENT STUFF T SET --- TEMP 80 = DONE T SET --- OPTION = REDISPLAY T DISPLAY --- TEMP 80 (AT APPEARANCE # ) T ENDTEMP 80 is set to 'STATE 1' in the POST PCF READ event point, so the first time APPX comes into this Event Point, the first test on TEMP 80 will be true. On our image, we have painted some fields from the PCF file, and the TEMP 80 field. While APPX is performing the 'PERFORM SOME PROCESSING' subroutine, the PCF file images and 'STATE 1' will be displayed on the screen. When the subroutine is complete, TEMP 80 is changed, and OPTION is set to REDISPLAY, which causes APPX to redisplay the PCF fields and TEMP 80 ('STATE 2') for the same record. When APPX comes back into this Event Point, it will hit the second test on TEMP 80, and perform the 'PERFORM SOME DIFFERENT STUFF' routine. During this time, the PCF fields and TEMP 80 (which now contains 'STATE 2') will be displayed. When the subroutine is complete, TEMP 80 is changed and OPTION is again set to REDISPLAY. This will cause APPX to redisplay the same record and TEMP 80 (which now contains DONE). APPX will then come back into this Event Point, and since none of the IF's are true, it will just display the record, and read the next record in the PCF file. This will reset TEMP 80 to STATE 1 (via the code in the POST PCF READ), and the process will repeat for the next record.
Depending what you want to happen when everything is done, you can either code an END PROC when INTERACTIVE PHASE is no longer DATA SCROLL in the PREDISPLAY event point, or if you want APPX to redisplay the entire file so the operator can review it, you can code something like this (also in PREDISPLAY):
IF --- INTERACTIVE PHASE NE DATA SCROLL T IF --- QI EQ 0 TT SET --- OPTION = SCROLL FIRST TT SET --- QI = 1Setting OPTION to SCROLL FIRST will cause APPX to go back to the beginning of the PCF file and fill the display from there. For some reason, it is not necessary to reset SCROLL TO END to "N". It is necessary, however, to know whether we have set OPTION to SCROLL FIRST or not, which is why we use QI as a flag. If we don't do this, we will end up in an infinite loop.
The only disadvantage with this approach is that we cannot use the image manipulation commands (BRIGHT, DIM, INVERSE, BLINK). It would be nice if we could highlight the record in progress by making it brighter, but these commands don't seem to apply during DATA SCROLL mode.
Do you have a tip you want to pass on? Contact Us.