Example program (nb this has been posted before in this group - the group
is searchable at nabble )
* ANALYSEFILE
* By Symeon Breen - to analyse a data file and give a resume of what
attributes are used
* Usage - ANALYSEFILE {file name}
s...@sentence
IF Sen[1,4]="RUN " THEN Sen=Sen[5,999]
IF Sen[1,11]#"ANALYSEFILE" THEN CRT "Verb must be called
ANALYSEFILE";STOP
FN=TRIM(Sen[12,99])
IF FN='' THEN
CRT "ENTER FILE NAME :":
PROMPT ''
INPUT FN
END
AREC='' ;*VAL1= No of blank recs, 2=num numeric, 3= num text, 4=min
length, 5=max length
AREC.HDR="Null":@VM:"Numeric":@VM:"Text":@VM:"Min len":@VM:"Max
len":@VM:'# with MVs'
OPEN FN TO FIL ELSE CRT "Can not open file ":FN;STOP
SELECT FIL
cnt=0
LOOP WHILE READNEXT ID DO
cnt+=1
READ REC FROM FIL,ID ELSE REC=''
MAX=DCOUNT(REC,@AM)
FOR X = 1 TO MAX
REC.NULL=CHANGE(CHANGE(REC<X>,@VM,''),@SVM,'')='' ;*i.e. all
vals and subvals null
IF COUNT(REC<X>,@VM) THEN AREC<X,6>+=1
IF REC.NULL THEN
AREC<X,1>+=1
END ELSE
IF NUM(REC<X,1,1>) THEN AREC<X,2>+=1 ELSE AREC<X,3>+=1
REC.LEN=LEN(REC<X,1,1>)
IF AREC<X,4>='' THEN
AREC<X,4>=REC.LEN
END ELSE
IF REC.LEN < AREC<X,4> THEN AREC<X,4>=REC.LEN
END
IF REC.LEN > AREC<X,5> THEN AREC<X,5>=REC.LEN
END
NEXT X
REPEAT
CRT
CRT "Analysis for ":cnt:" records of ":FN
CRT
CRT SPACE(15):AREC.HDR<1,1>'R#10':' ':AREC.HDR<1,2>'R#10':'
':AREC.HDR<1,3>'R#10':' ':AREC.HDR<1,4>'R#10':' ':AREC.HDR<1,5>'R#10'
MAX=DCOUNT(AREC,@AM)
FOR X=1 TO MAX
CRT "Attribute ":X'R#4':' ':AREC<X,1>'R#10':' ':AREC<X,2>'R#10':'
':AREC<X,3>'R#10':' ':AREC<X,4>'R#10':' ':AREC<X,5>'R#10'
NEXT X
CRT "Finished."
END
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Evan Carroll
Sent: 21 January 2010 00:05
To: [email protected]
Subject: [U2] UniVerse RetreiVe how do I query a file for all of its
column's values?
This is a repost from a stackoverflow question I asked:
http://stackoverflow.com/questions/2068026/universe-retreive-how-do-i-query-
a-file-for-all-of-its-columns-values
=== START REPOST ===
In UniVerse you can't query a file for all of its columns unless the @
phrase in your file's dictionary is set to all of the tables columns.
If it isn't how do you query a table for all of its column's values?
So I can get the total column listing (column name & display name)
using:
LIST DICT file NAME
This will return a listing of all columns and their display names. How
do I then query the table for all of the columns it has?
LIST file
Will only query it for LIST file @id (@id is the only thing in @).
....
=== END REPOST ===
I'd like to follow up with a request to see if anyone has a copy of a
BASIC program that does this, I imagine it is something every heavy
universe must keep in arms reach.
Thanks a ton,
--
Evan Carroll
System Lord of the Internets
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users