Re: Strange behavior : I4GL , transactions AND reports = Lost data
Posted in 2012
Not sure if I was clear enough... The ORDER BY requires the use of a temporary table... and that is affected by your rollbacks... Regards. On Fri, Nov 30, 2012 at 11:19 AM, Fernando Nunes <domusonline@gmail.com>wrote: > > > On Fri, Nov 30, 2012 at 9:30 AM, Isidre Pons Roca <ipons@base.cat> wrote: > >> #----- Beguin example TEST.4gl---- >> #--------------------------------------------------------- >> # >> # Strange behavior I4GL : Transactions and reports >> # >> # (c) BASE - Gesti d'Ingressos >> # Isidre Pons >> # 11/30/2012 v 1.0 >> # >> #--------------------------------------------------------- >> database oartdb >> >> >> #------------------------------------------------------------------------------- >> main >> >> #------------------------------------------------------------------------------- >> define i smallint >> >> start report test_1 to "kk.out" >> >> for i = 1 to 10 >> begin work >> if (i mod 3) = 0 then >> display "Commited value :",i >> commit work >> else >> display "Rollback value :",i >> rollback work >> end if >> output to report test_1(i) >> end for >> >> finish report test_1 >> prompt "Press a key : " for char status >> >> end main >> >> >> #------------------------------------------------------------------------------- >> report test_1(r_value) >> >> #------------------------------------------------------------------------------- >> define r_value smallint >> >> output >> left margin 0 >> top margin 0 >> bottom margin 0 >> >> order by r_value >> # order external by r_value >> >> format >> >> after group of r_value >> display " ---------- > change of group ",r_value >> print " ---------- > change of group ",r_value >> >> on every row >> display " Row: ",r_value clipped >> print " Row: ",r_value clipped >> end report >> #---- End example TEST.4gl ----------- >> > > This works as designed... From the 4GL manual: > > The EXTERNAL Keyword > Specify ORDER EXTERNAL BY if the input records have already been sorted > by the SELECT statement. The list of variables after the keywords ORDER > EXTERNAL BY control the execution order of GROUP BY control blocks. > Without the EXTERNAL keyword, the report is a two-pass report, meaning that > 4GL processes the set of input records twice. During the first pass, it > sorts the > data and stores the sorted values in a temporary file in the database. > During > the second pass, 4GL calculates any aggregate values and produces output > from data in the temporary files. > With the EXTERNAL keyword, 4GL only needs to make a single pass through > the data: it does not need to build the temporary table in the database for > sorting the data. Specifying EXTERNAL to instruct 4GL not to sort the > records > again might result in an improvement in performance. > > > "temporary table"... > > > And if I monitor the session: > > User-created Temp tables : > partnum tabname rowsize > 500002 t_test_1 2 > > Regards. > > > -- > Fernando Nunes > Portugal > > http://informix-technology.blogspot.com > My email works... but I don't check it frequently... > -- Fernando Nunes Portugal http://informix-technology.blogspot.com My email works... but I don't check it frequently...