|
Pedro, First, I would warn you... there are many in this group who will severely chastise you for even thinking about using control breaks and cycle processing. I, on the other hand believe it is a tool that can be used to great effect under the proper circumstances. That said, Yes, control indicators are on the first pass, BUT... "Total Time" (CLx in positions 6-8 of a 'c' spec) calculations and output (T on an output spec) ARE NOT processed on the first record. Think of it this way: If you want to do something AFTER READING the 1ST record of a control group, use detail time processing (blanks in pos 7-8 of 'c' spec), With Lx specified (either as a left hand indicator YUK) or in an IF statement. If you want to do something AFTER READING the LAST record of a control group (BEFORE reading a new record and thus changing the field values), use total time processing (CLx in positions 6-8 OF 'c' spec). see this example of a simple report. (this report could have been written using WRKQRY in about 1/10th the time of the RPG program, but it serves as a good example of cycle processing ---------- FPrimaryF IP E k DISK FPrinterF O E PRINTER FLocMst IF E k DISK FItemClass IF E k DISK IPrimaryR I SHLOC L2 I SHITCL L1 * 1st record of location * Chain and get location description for printing on detail line. C IF *inL2 C SHLOC CHAIN LocMst C END * 1st record of new item class * chain and get description for printing C IF *inL1 C SHITCL CHAIN ItemClass C END * Detail processing for every record read C EVAL DTEXTC = SHPRQT * SHSTCS C EVAL L1EXTC = L1EXTC + SHSTCS * ------------------ C WRITE (E) DTROW * ------------------ C EXSR ChkOvrFlw * control break on item class CL1 EVAL L2EXTC = L2EXTC + L1EXTC * ------------------ CL1 WRITE (E) L1TOT * ------------------ CL1 EVAL L1EXTC = 0 CL1 EXSR ChkOvrFlw * control break on ship to location CL2 EVAL LREXTC = LREXTC + L2EXTC * ------------------ CL2 WRITE (E) L2TOT * ------------------ CL2 EVAL L2EXTC = 0 CL2 EXSR ChkOvrFlw * ------------------ CLR WRITE (E) LRTOT * ------------------ * * * * * * * * * * * * * * * * * * * * * ChkOvrFlw - check for overflow error * * * * * * * * * * * * * * * * * * * * C ChkOvrFlw BEGSR C IF %error C EVAL $overflw = *on C WRITE PageHdr C END C ENDSR hth, rick original message- Pedro sez: > hello, Can anyone tell me what will be the value of the control level indicators after the first read of a primary file ? If it is ' ON' , a control break will occur in the first record itself .How can we handle such a situation ? thanks!>>>> +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.