Question2: Informix 4GL Programming
Posted in 2000
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL
Dear all, I have other short questions about Informix 4GL. Q1: Why the SQLCA.SQLCODE's use is preferable to the STATUS global variable? Q2: Don't konw exactly of set_count() do? Is there any example? Q3: Syntax of Case-when, which following is correct (I get confused from the book) Case (p-variable) When "A" .... When "B" .... or Case p-variable When "A".... When "B".... Q4: What is MODE ANSI's deault behavior of handling a Run-time error? The program continues, logging the error to the error log. or The program is interrupted, issuing a prompt to the user for further processing dirction.. or something else. Q5(from the Informix website): When will opening a database, using the DATABASE statement between the OUTPUT TO REPORT and FINISH REPORT statements, cause a run-time error? A) if the report is a one-pass report =>B) if your report is a two-pass report C) if your report contains the REPORT TO statement D) if the report contains the ORDER EXTERNAL BY statement What is two-pass report??? Thanks for your answer. Chih-Ming Kao joekao@erols.com
Chih-Ming Kao wrote: > I have other short questions about Informix 4GL. > Q1: Why the SQLCA.SQLCODE's use is preferable to the STATUS global variable? STATUS is more volatile than SQLCA.SQLCODE, but I use STATUS and save it when I need it to remain unchanged. Prior to release 4.00, STATUS was fairly stable; it became a lot more volatile when 4.00 was released. The WHENEVER ANY ERROR stuff was part of the trouble... > Q2: Don't konw exactly of set_count() do? Is there any example? Before DISPLAY ARRAY or INPUT ARRAY WITHOUT DEFAULTS to tell the program how many rows of initialized data it should display. > Q3: Syntax of Case-when, which following is correct (I get confused from the > book) > Case (p-variable) > When "A" .... > When "B" .... > or > Case p-variable > When "A".... > When "B".... Both these are valid and have the same effect -- at least, without having done a test compile, I'd say both are valid. There is also the CASE WHEN <bool-exp> variant of the statement. > Q4: What is MODE ANSI's deault behavior of handling a Run-time error? > The program continues, logging the error to the error log. > or The program is interrupted, issuing a prompt to the user for further > processing dirction.. > or something else. Why don't you try it to see? The correctest answer in testing terms is "something else", mainly because logging the error to the error log depends on whether you've started an error log or not. Yes, the default behaviour for a program compiled against a MODE ANSI database is to continue after an error (instead of stop as in non-ANSI databases). > Q5(from the Informix website): When will opening a database, using the > DATABASE statement between the OUTPUT TO REPORT and FINISH REPORT > statements, cause a run-time error? > A) if the report is a one-pass report > =>B) if your report is a two-pass report > C) if your report contains the REPORT TO statement > D) if the report contains the ORDER EXTERNAL BY statement > > What is two-pass report??? It is one where the data has to be saved while it is presented to the report for some reason. Pass 1 saves the data and accumulates overall aggregates, and pass 2 re-reads the data and does the printing. Causes of a two phase report? * An ORDER BY (as opposed to ORDER EXTERNAL BY) clause. * An aggregate (other than a group aggregate) appearing anywhere other than the ON LAST ROW clause. * A GROUP PERCENT aggregate. Diploma question: why does a GROUP PERCENT cause the report to be a two pass report? Good luck with your exam! -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.95 -- see http://www.perl.com/CPAN #include <disclaimer.h>