* * To compile: * * CRTRPGPGM PGM(XXX/PAGEATATIMERG) SRCFILE(XXX/QRPGLESRC) * *======================================================================= Fsfl003df cf e workstn F sfile(sfl1:rrn1) F infds(info) Fsfl001lf if e k disk Dinfo ds D cfkey 369 369 Dsvlnam S like(dblnam) Dsvfnam S like(dbfnam) Dexit C const(X'33') Dcancel C const(X'3C') Denter C const(X'F1') Drollup C const(X'F5') Drolldn C const(X'F4') Dsflpag C const(15) Dsflpag_plus_1 C const(16) * ***************************************************************** * Main Routine ***************************************************************** * * Clear then build the initial subfile * C exsr clrsfl C exsr sflbld * * Do loop to process the subfile until F3 or F12 is pressed * C dou (cfkey = exit) or (cfkey = cancel) * C write fkey1 C exfmt sf1ctl * * Process position to information entered by the user, then clear * and rebuild the subfile. Lastly, clear the position to field * C select C when (cfkey = enter) and (ptname <> *blanks) C ptname setll sfl001lf C exsr clrsfl C exsr sflbld C clear ptname * * Clear and rebuild the subfile when user pages down (rolls up) * C when (cfkey = rollup) and (not *in90) C exsr clrsfl C exsr sflbld * * Position data file to one page before current subfile data, then * clear and rebuild the subfile to show that previous page * C when (cfkey = rolldn) and (not *in32) C exsr goback C exsr clrsfl C exsr sflbld C endsl C enddo C eval *inlr = *on * ***************************************************************** * CLRSFL - Clear the subfile ***************************************************************** * C clrsfl begsr * * Clear relative record numbers and subfile * C eval rrn1 = *zero C eval *in31 = *on C write sf1ctl C eval *in31 = *off C eval *in32 = *off C endsr * ***************************************************************** * SFLBLD - Build the List ***************************************************************** * C sflbld begsr * * Load the subfile with one page of data or until end-of-file * C do sflpag C read sfl001lf 90 C if *in90 C leave C endif C eval rrn1 = rrn1 + 1 C write sfl1 * * save first record data * C if rrn1 = 1 C eval svlnam = dblnam C eval svfnam = dbfnam C endif C enddo * * If no records added to subfile, do not display it * C if rrn1 = *zero C eval *in32 = *on C endif * C endsr * ***************************************************************** * GOBACK - page backward one page ***************************************************************** * C goback begsr * * Position data file to first record of subfile * C savkey setll sfl001lf * * Re-position pointer in file for rolling backward. If beginning * of file hit before done, set pointer to first record of data file. * C do sflpag_plus_1 C readp sfl001lf C if %eof C *loval setll sfl001lf C leave C endif C enddo * C endsr * ***************************************************************** * KEYLISTS ***************************************************************** * C savkey klist C kfld svlnam C kfld svfnam