|
Hi Sadiq I do the same thing; I write the function key record, the message subfile control and then EXFMT the subfile control record once only. If a function key or Page Down key is not pressed (i.e. Enter is pressed) then I validate the subfile. * Keep displaying the subfile until F3 is pressed... C Dou F3_Key = Pressed * If the Refresh (F5) key was pressed then reload the subfile... C If F5_Key = Pressed * a) Clear (initialise) the subfile... C Eval SflDsp = False C Write SflCtl02 * b) Position to the start of the input file... C *Loval Setll Sysl9071 * c) Load the first page of records to the subfile... C Eval Line02 = *Zeros C ExSr LoadSubfile * d) Clear the error message subfile... C Callp ClrPgmMsgq C EndIf * Now display the subfile and any error messages... C Write Footer C Write SflCtl01 C ExFmt SflCtl02 * Process the input from the subfile... C Select C When F3_Key = Pressed C When F5_Key = Pressed C When PgDwn = Pressed C ExSr LoadSubfile C Other C ExSr Validate C If Errors = NotFound C ExSr Process C If Errors = NotFound C Eval F5_Key = Pressed C EndIf C EndIf C EndSl C EndDo * F3 (Exit) was pressed, so it's time to leave... C Eval *InLR = *On C Return I know I don't need to have the "When F3_Key = Pressed" and "When F5_Key = Pressed" in the Select group, but I find it keeps me on the right track when checking for function key usage. In the Validate subroutine I use READC to pick up the changed records and then update the subfile with SFLNXTCHG set on regardless of whether or not an error was detected. In the Process subroutine I then use READC again to only pick up the changed records to save having to go through the whole subfile. My understanding has always been that once you've done a READC on a subfile record the "changed" flag is removed so you can't pick up the same record again using a READC without manually setting the SFLNXTCHG indicator. In the distant past when I first tried subfile processing I can remember not setting the SFLNXTCHG indicator and then pressing Enter on a screen full of errors. The validation subroutine at that time didn't pick up the existing errors as I hadn't keyed anything on the records, simply pressed Enter without any input. Since then I've always used SFLNXTCHG. All the best Jonathan -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of MD, Sadique Sent: 08 March 2006 09:15 To: RPG programming on the AS400 / iSeries Subject: RE: How to validate input subfile Hi Jonathan, I absolutely agree with you that SFLNXTCHG indicator should be on before updating the subfile record format as a standard I too code that way only May be I am not true But I handle subfile only with only one EXFMT for Subfile control record format in the whole program in a do loop Then execute a subroutine for one more do loop to check for READC if RRN > *Zeros, before the end of this do loop I Have every time checked for validations and for any errors update the sub file record format other wise process those records.Then once this do loop is left and enter in the main do loop it would EXFMT the Subfile control record format Now user would see all those error messages displayed and reverse images etc if any and for next input values changes done /or not done or simply an enter again my READC subroutine is executed Which would check for any changed values and do the validations as said above So in this case I really don't require for SFLNXTCHG it perfectly works Thanks Sadiq -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jonathan Mason Sent: Wednesday, March 08, 2006 1:10 PM To: 'RPG programming on the AS400 / iSeries' Subject: RE: How to validate input subfile >> For validation part >> With READC you can get the subfile changed records If you find any >> invalid values then flag on the Error indicators if any Or display >> any error messages via message subfile Update your subfile record >> format and EXFMT your subfile control record format If you're using the READC operation to get changed records only, then on the subfile record in the DDS you should code the SFLNXTCHG keyword conditioned by an indicator. For example: A R SFL02 SFL A* ======= A 74 SFLNXTCHG A S£OPT 1A B 8 3 A 31 COLOR(RED) A 31 DSPATR(PC) A S£CURC 3A B 8 7CHGINPDFT A 50 DSPATR(PR) A N50 DSPATR(UL) A 32N50 COLOR(RED) A 32 DSPATR(PC) A S£DESC 40A B 8 13 A 33 DSPATR(PC) A 33 COLOR(RED) A CHECK(LC) Then during your validation routine, immediately before updating the subfile record with any error indicators you should turn on the SFLNXTCHG conditioning indicator. You do this regardless of whether there are any errors or not so that if there are any errors then the record will be re-read next time the user presses Enter, and if there aren't any errors then READC can be used for processing the subfile after all errors have been validated. Best regards Jonathan -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.