Okay, forget what I said in my last post about not being able to do it with a subfile.
I just cobbled this together and it works. No data queues, just a subfile.
The display file SELFUPD2 should be created with WAITRCD(3)
Code:
A DSPSIZ(24 80 *DS3)
A PRINT
A INVITE
A CA03(03 'exit')
A R SFL1 SFL
A SDATA 5 O 4 4
A R CTL1 SFLCTL(SFL1)
A OVERLAY
A 91 SFLDSP
A 90 SFLDSPCTL
A 89 SFLCLR
A SFLSIZ(0161)
A SFLPAG(0160)
A SFLLIN(0004)
A 90 SFLEND(*MORE)
A 1 3TIME
A 1 30'SELF UPDATING DISPLAY'
A DSPATR(HI)
A DSPATR(UL)
A 3 26'Your Data Will Be Shown Here'
A DSPATR(HI)
A R FKEYS
A OVERLAY
A 24 4'F3=Exit'
A COLOR(BLU)
The RPG program SELFUPR2 should be created with DFTACTGRP(*NO)
Code:
FSELFUPD2 CF E WORKSTN SFILE(SFL1:RRN1) maxdev(*file)
D event S 5a
D rrn1 S 4 0
d subFileFull c 999
/free
exsr ClrSfl;
write fkeys;
dou *In03 ;
if rrn1 >= subfileFull;
exsr clrSfl;
endif;
write(e) ctl1;
read(e) selfupd2 ; //ĪRead From Display File
sData = %subst(%char(%time):4:5);
rrn1 += 1;
Write(e) sfl1;
*IN91 = *On ;
enddo ;
*inlr = *On ;
begsr clrSfl;
*In89 = *On ;
*In90 = *Off ;
*In91 = *Off ;
*In75 = *Off ;
write(e) ctl1;
rrn1 = 0 ;
*In89 = *Off ;
*In90 = *On ;
*In91 = *Off ;
endsr ;
/end-free
When called the program adds a record to the subfile then displays it. It keeps adding and displaying automatically.
The only thing I would say is make sure you read the filename rather than the subfile control record name.