* * To compile: * * CRTRPGPGM PGM(XXX/SFL002RG) SRCFILE(XXX/QRPGLESRC) * *======================================================================= FseflextDDScf e workstn F sfile(sfl1:rrn1) F infds(info) Fsfl001lf if e k disk Dinfo ds D cfkey 369 369 Dexit C const(X'33') Dcancel C const(X'3C') Denter C const(X'F1') Drollup C const(X'F5') Dsflpag C const(15) Dlstrrn S 4 0 inz(0) * ***************************************************************** * 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 * * Add more records to the subfile if user is at the bottom * C when (cfkey = rollup) and (not *in32) 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 lstrrn = *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 * * Make RRN1 = to the last relative record number of the subfile * so that the load process will correctly add records to the bottom * C eval rrn1 = lstrrn * * 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 C enddo * C if rrn1 = *zero C eval *in32 = *on C endif * C eval lstrrn = rrn1 * C endsr