*--------------------------------------------------------------* * Manage CLASSES table * * This service program is called by the iSeries Table Web * * component to fill the subfile with all records in the file. * * When the page containing the iSeries Table Web component * * is loaded, this service program is called before the page * * is displayed. * * Compile instructions: * * - Use CRTRPGMOD to create this as an RPG module * * - Use CRTSRVPGM command to create this as a service * * program. It must be bound with service program * * QDTSSFL which performs the actual subfile operations * * * *--------------------------------------------------------------* Hnomain * * Class table FCourses IF E k Disk usropn * * Define program variables DFMT S 10A Drc S 4 0 Dspc S 10A DisLoggedIn S N Inz(*ON) * * Define the subfile record * The subfile VCT must contain the following columns in this order * Also ensure the subfile column types/length match the fields DRecord DS D SFLName like(name) D SFLRoom like(room) D SFLText like(text) * * This is the structure passed back to the detail page DInfo DS D ClassName like(name) D ClassRoom like(room) D ClassText like(text) * DGetDetail PR ExtProc('GetDetail') D sfl 10 D flow 20 D i Like(info) * DCHECKLOG PR ExtProc('ATTEND') D forward 20 * DFillSFL PR * /Copy WEBTOOLS/QRPGLESRC,SUBFILEPR * *------------------------------------------------------------* * Terminate - Called when the subfile page is unloaded * *------------------------------------------------------------* PTERM B export D TERM PI * C Close *ALL C Return * PTERM E *---------------------------------------------------------------* * INIT - Initialize the subfile * * This procedure is called by the subfile VCT before the page * * is actually displayed. * * This procedure will intialize, clear then fill the subfile * * with all items in the inventory database * *---------------------------------------------------------------* PINIT B export DINIT PI D spcl 10 * C Eval spc = spcl C Eval rc = initSF(spcl): C %Addr(Fmt): C %Size(Record)) C Eval rc = clearSF(spcl) C CallP FillSFL C Return PINIT E * *--------------------------------------------------------------* * * * FillSFL * * This procedure will fill the subfile VCT by reading all * * records in the file. * * The appendSF procedure is called to add the records to the * * subfile * * * * Note that the subfile must have been previously initialized * * and cleared by calling the INIT procedure * * * *--------------------------------------------------------------* PFillSFL B * C Open Courses 99 C *LOVAL Setll Courses C Read Courses * * Read all records and add them to the subfile VCT C DoW NOT %EOF C Eval SFLName = Name C Eval SFLRoom = room C Eval SFLText = text C Eval rc = appendSF(spc: C %Addr(Record): C %Size(Record)) C Read Courses C EndDo * C Close Courses * PFillSFL E *---------------------------------------------------------------* * GetDetail * * Returns detail information on an item selected in the subfile * * Setting the variable 'flow' determines which JSP is displayed * * on return * *---------------------------------------------------------------* PGetDetail B export D GetDetail pi D sfll 10 D flow 20 D s like(info) * * Read the selected record C Eval rc=readcSF(sfll: C %Addr(Record): C %Size(Record): C 1) * Clear the return structure C Clear Info C Eval s = info * * If there was a selected record on the subfile, get it C If rc > 0 C Open Courses C ClassName Chain Courses 99 C Eval s = info C Close Courses C Eval flow = 'OK' * * No record selected C Else C Eval flow = 'NOTOK' C EndIf * PGetDetail E * * End *---------------------------------------------------------------* * Check logged in * *---------------------------------------------------------------* PCHECKLOG B export D CHECKLOG pi D forward 20 * C If isLoggedIn C Eval forward = 'LOGOK' * C Else C Eval forward = 'NOTLOG' C EndIf * PCHECKLOG E * * End
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.