Ü
ASSUME/OVERLAY
·
If we want to specify that the
OS/400 program is to assume that this record is already shown on the display, when the file is opened.
·
Use this keyword to receive
data that a previous program has left on the display.
·
If we don’t use this keyword
then the display screen of the previous display file goes blank when the new
display screen is opened. To avoid this situation we use ASSUME keyword along
with overlay.
·
OVERLAY keyword allows the
overlaying of fields on this record without erasing the entire display.
·
ASSUME is placed on a format
that a program is supposed to pretend is on the screen.
·
It is mainly used for display
files that present windows.
·
It is not placed on the window
itself, but a dummy non window format.
Ü
KEEP
·
If we want to Keep the display
from being deleted when the display file is closed.
·
It avoids the flicker that
happens when we are returning to the previous display file after closing the
current one. E.g. We press F4 on the main screen to display a window and then
when we return from this window a flicker happens. To avoid this we use this
KEEP keyword.
Example
Display file for main
program that calls a window program.
Columns . . . : 1 80 Browse AMITCCCCC/QRPGLESRC
SEU==> WIND_DSP4
FMT DP .....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++++++++++
*************** Beginning of data *************************************************
0001.00 A DSPSIZ(24 80 *DS3)
0002.00 A CF04(04 'PROMPT')
0003.00 A CA03(03 'EXIT')
0004.00 A R HEADER
0005.00 A 1 35'MAIN SCREEN'
0006.00 A 1 71DATE
0007.00 A EDTCDE(Y)
0008.00 A 2 71TIME
0009.00 A 5 13'FIELD NO. 1'
0010.00 A 6 13'FIELD NO. 2'
0011.00 A 7 13'FIELD NO. 3'
0012.00 A FLD001 12A B 5 30COLOR(BLU)
0013.00 A FLD002 20A B 6 30COLOR(BLU)
0014.00 A FLD003 12A B 7 30COLOR(BLU)
0015.00 A R FOOTER OVERLAY
0016.00 A 24 02'F3 = EXIT'
0017.00 A 24 13'F4 = WINDOW PROMPT'
****************** End of data *************************************************
Main program WIND_PGM4
that calls the window program which prompts on the main display screen
Columns . . . : 6 80 Browse AMITCCCCC/QRPGLESRC
SEU==> WIND_PGM4
FMT H HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*************** Beginning of data ********************************************
0001.00 HOPTION(*NODEBUGIO)
0002.00 FMASTER IF E K DISK
0003.00 FWIND_DSP4 CF E WORKSTN
0004.00 C *LOVAL SETLL REC1
0005.00 C READ REC1
0006.00 C DOW *IN03=*OFF
0007.00 C 03 LEAVE
0008.00 C WRITE HEADER
0009.00 C WRITE FOOTER
0010.00 C READ HEADER
0011.00 C IF *IN04=*ON
0012.00 C CALL 'WIND_PGM4C'
0013.00 C ENDIF
0014.00 C ENDDO
0015.00 C SETON LR
****************** End of data *********************************************
Display file having window
record format used in the called program WIND_PGM4C.
Columns . . . : 1 80 Edit AMITCCCCC/QRPGLESRC
SEU==> WIND_DSP4C
FMT DP .....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++++++++++++++
*************** Beginning of data ************************************************
0001.00 A DSPSIZ(24 80 *DS3)
0002.00 A R WIN001
0003.00 A CA12(12 'PREVIOUS')
0004.00 A KEEP
0005.00 A OVERLAY
0006.00 A WINDOW(2 10 15 40)
0007.00 A WDWBORDER((*COLOR YLW) (*DSPATR RI)-
0008.00 A (*CHAR '...:::.:'))
0009.00 A WDWTITLE((*TEXT 'SAMPLE WINDOW') (*-
0010.00 A COLOR RED))
0011.00 A 14 2'F12 = PREVIOUS'
0012.00 A 3 2'ORG CODE'
0013.00 A DSPATR(HI)
0014.00 A 3 15'ACCOUNT NUMBER'
0015.00 A DSPATR(HI)
0016.00 A 3 32'CURRENCY'
0017.00 A DSPATR(HI)
0018.00 A ORG R O 5 5REFFLD(REC1/ORG AMIT/MASTER)
0019.00 A ACC R O 5 16REFFLD(REC1/ACC AMIT/MASTER)
0004.00 A KEEP
0005.00 A OVERLAY
0006.00 A WINDOW(2 10 15 40)
0007.00 A WDWBORDER((*COLOR YLW) (*DSPATR RI)-
0008.00 A (*CHAR '...:::.:'))
0009.00 A WDWTITLE((*TEXT 'SAMPLE WINDOW') (*-
0010.00 A COLOR RED))
0011.00 A 14 2'F12 = PREVIOUS'
0012.00 A 3 2'ORG CODE'
0013.00 A DSPATR(HI)
0014.00 A 3 15'ACCOUNT NUMBER'
0015.00 A DSPATR(HI)
0016.00 A 3 32'CURRENCY'
0017.00 A DSPATR(HI)
0018.00 A ORG R O 5 5REFFLD(REC1/ORG AMIT/MASTER)
0019.00 A ACC R O 5 16REFFLD(REC1/ACC AMIT/MASTER)
0020.00 A CCY R O 5 34REFFLD(REC1/CCY AMIT/MASTER)
0021.00 A R DUMMYRCD
0022.00 A ASSUME
0023.00 A 10 10' '
****************** End of data ***************************************************
Called program WIND_PGM4C
that prompts as a window on the main display screen
Columns . . . : 6 80 Browse AMITCCCCC/QRPGLESRC
SEU==> WIND_PGM4C
FMT H HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*************** Beginning of data ********************************************
0001.00 HOPTION(*NODEBUGIO)
0002.00 FMASTER IF E K DISK
0003.00 FWIND_DSP4CCF E WORKSTN
0004.00 C *LOVAL SETLL REC1
0005.00 C READ REC1
0006.00 C DOW *IN12=*OFF AND NOT %EOF(MASTER)
0007.00 C WRITE WIN001
0008.00 C READ WIN001
0009.00 C READ REC1
0010.00 C ENDDO
0011.00 C SETOFF 0412
0012.00 C SETON LR
****************** End of data ***********************************************
OUTPUT
We run the main program WIND_PGM4 and get the output below.
MAIN SCREEN 12/04/13
13:41:04
FIELD NO. 1 _____________
FIELD NO. 2 ______________________
FIELD NO. 3 _____________
F3 = EXIT F4 = WINDOW PROMPT
Now to call the window
program we press F4.
In the below screen we can see that the background screen goes
blank, if don’t use ASSUME keyword. Hence, ASSUME receives the data that a
previous program(WIND_PGM4) has left on the display. Also the Overlay keyword allows
the overlaying of fields on this record without erasing the entire
display.
............. SAMPLE WINDOW ..............
: :
: :
: ORG CODE ACCOUNT NUMBER CURRENCY :
: :
: 190 A00000000001 EUR :
: :
: :
: :
: :
: :
: :
: :
: :
: F12 = PREVIOUS :
: :
:..........................................:
Output when we use ASSUME +
OVERLAY keyword. Background is there from the previous display file.
MAIN SCREEN 12/04/13
13:41:04
MAIN SCREEN 12/04/13
13:41:04
............. SAMPLE WINDOW ..............
: :
: :
: ORG CODE ACCOUNT NUMBER CURRENCY :
: :
: 190 A00000000001 EUR :
: :
: :
: :
: :
: :
: :
: :
: :
: F12 = PREVIOUS :
: :
:..........................................:
F3 = EXIT F4 = WINDOW PROMPT