|
Because of comments made about loading subfiles I decided to see what actually happens on today's boxes. I just wrote a DDS and RPGLE program to fully load a large subfile. I chose a name and address file with about 5,500 records. The subfile program has a Parm for the I.D. Number and another Parm for a Name. The program fills the subfile with all 5,500 records and displays the subfile with the first record shown <= Name Parm. I hardwired the Name Parm with "Jones" so the file would display the Jones's upon opening. There is nothing fancy in the program (the DDS is about 50 lines and the RPGLE is about 80 lines). The program fully loads and displays in 10 to 12 seconds. This is not a long time for a program to initialize and open is it? I'm not suggesting this is the only way to write a subfile, but it should be considered as a candidate for solving some problems, and is a very fine candidate in my opinion for inquiry and look-up windows for prompt screens. It is easy to provide the equivalent of a dropdown box on a green screen. Coupled with the *DFT window setting it becomes a drop down box on a green screen for those 5 to 85 item validations, like Freight Codes, State names, SalesPerson, Available Terms, and other small tables that have to be validated with almost every screen application. I use it this way: If the user is in a field and clicks F4 they get a dropdown box for that field. If the user keys an invalid value into a field instead of getting an error message they get a drop down box of valid values preset at the choice <= to what they've already typed. The code is short. Anyone that's interested, I included it as an attachment because putting it in line seemed pushy.
Here's the DDS: *************** Beginning of data ************************************ A*%%TS SD 19991017 000939 BOOTH REL-V4R4M0 5769-PW1 A*%%EC A DSPSIZ(24 80 *DS3) A REF(*LIBL/APNAMES) A R SFLA SFL A*%%TS SD 19991016 234045 BOOTH REL-V4R4M0 5769-PW1 A APNVID R H A APNALP R O 2 1 A APNCTY R O 2 32 A APNPHN R O 2 51EDTWRD(' - - ') A*%%TS SD 19990725 135719 BMARTIN REL-V4R2M0 5769-PW1 A** A R FMT01 SFLCTL(SFLA) A*%%TS SD 19991017 000939 BOOTH REL-V4R4M0 5769-PW1 A OVERLAY A SFLCSRRRN(&RRNA) A SFLDSP A SFLDSPCTL A 91 SFLEND(*SCRBAR *MORE) A SFLSIZ(&NBRREC) A SFLPAG(0010) A WINDOW(*DFT 12 65 *NOMSGLIN) A MOUBTN(*ULD ENTER) A 1 1'A/P Name Cit- A y Phone ' A DSPATR(UL) A COLOR(BLU) A RRNA 5S 0H A RRNT 4S 0H SFLRCDNBR(CURSOR *TOP) A NBRREC 5S 0P A R DUMMY A TEXT('PREVENTS PREVIOUS SCREEN FROM- A BEING CLEARED') A ASSUME A 5 9' ' ****************** End of data ************************************************** Here's the RPG: *************** Beginning of data ************************************ ************************************************************* * A program to show a pick window for prompting: * * 7/99 Booth M. * * (Uses mouse button click) * * * ************************************************************* FWINDOWD CF E WORKSTN F SFILE(SFLA:RRNA) FAPNAMES1 IF E K DISK INFDS(INFDS) * .................................................. * INFDS for database file. FileSize will contain the number * of records in the file when the file is opened. DINFDS DS D FILESIZE 156 159B 0 * .................................................. * "sds" is the whole System Data Structure /QDDSSRC/SDS. D SDS DPARMS# 37 39S 0 * .................................................. C *ENTRY PLIST C PARM PARMID 5 C PARM PARMNAMEA 30 * if no parm use *blanks(for testing, etc.) C PARMS# IFGT *ZEROS C MOVE *ZEROS PARMID0 5 0 C MOVEL PARMNAMEA PARMNAME 30 C ELSE C MOVE *ZEROS PARMID0 * Set the subfile at the first non-blank name: C* MOVEL 'a ' PARMNAME C* (for now, test with "Jones" to see if the subfile positions correctly: C MOVEL 'JONES' PARMNAME C MOVE 'No' ParmFlag 2 C END * If file is empty: C FILESIZE IFGT *ZEROS C Z-ADD FILESIZE NBRREC C Z-ADD 1 RRN 4 0 C Z-ADD 1 RRNA C READ RAPNAMES 58 C* Fill the subfile: C *IN58 DOWEQ *OFF C Z-ADD RRN RRNA C WRITE SFLA * Set the subfile's initial display at parm in: C if RRNT=*Zeros And PARMNAME<=APNALP C eval RRNT=RRN C Endif C ADD 1 RRN C READ RAPNAMES 58 C END C RRNA IFGT 10 C MOVE *ON *IN91 C END C EXFMT FMT01 C** C* If a choice was made, save it to PARM for return: C RRNA IFGT *ZEROS C RRNA CHAIN SFLA 54 * If there's no Parm in, then can not fill Parm out: C if ParmFlag<>'No' C MOVE APNVID PARMID C END C END C END C MOVE *ON *INLR C*------------------------------------------------------------------- ****************** End of data *****************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.