November 16, 2006, 08:35 AM
Mark1simple query
We have a lot of tables and sometimes I need to see the data in the fields. Usually I run a simple program like this:
TABLE FILE MYTABLE
PRINT *
WHERE READLIMIT EQ '1000';
END
But, I believe that this only returns the first 1,000 rows in the table. What I really would like to see is some records where every field is populated, so that I can see what kind of data is in each field simply by scrolling to the right. So, is there a way that I can add a WHERE statement to return only records where all fields are populated? Something like this perhaps:
WHERE * IS NOT MISSING or
WHERE * NE MISSING
November 16, 2006, 08:54 AM
Jim_at_LMDEFINE FILE MYTABLE
FLD1_SEL /I1 [MISSING ON] = [IF MISSING THEN 0 ELSE 1] ;
- OR -
FLD1_SEL1 /I1 = IF FLD1 EQ [0 , or " " for alpha] THEN 1 ELSE 0 ;
:
SEL/I1 IF FLD_SEL1 EQ 1 AND FLD_SEL2 EQ 1 ... THEN 1 ELSE 0 ;
:
TABLE
:
WHERE SEL EQ 1
November 16, 2006, 09:52 AM
Francis MarianiThere is no shortcut to selecting rows where each column has a value. I can't think of any programming language that could offer that.
What you need to do is have a WHERE statement for each of the columns:
WHERE CAR IS NOT MISSING
WHERE MODEL IS NOT MISSING
WHERE COUNTRY IS NOT MISSING OR COUNTRY IS-NOT ''
...
AND is implied in multiple WHERE statements, you could code the statments as:
WHERE CAR IS NOT MISSING
AND MODEL IS NOT MISSING
AND (COUNTRY IS NOT MISSING OR COUNTRY IS-NOT '')
...
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 17, 2006, 02:43 PM
LushengYou have to test each field.
November 28, 2006, 12:59 PM
Mark1OK, thanks. I will condition on each field.
November 28, 2006, 01:16 PM
hammo1jQuick and dirty is SUM * since this applies the max prefix to non numeric data. Not so good for numerics tho!
November 28, 2006, 01:41 PM
Leahquote:
Quick and dirty is SUM * since this applies the max prefix to non numeric data. Not so good for numerics tho!
You can use MAX.numfield or FST.numfield with SUM to not get all values summed.
November 30, 2006, 10:06 AM
Mark1Thanks, that worked!!