Small problem. Although it seems extremely difficult in PICK/UniVerse.
I just need some basic code or some recall statements (LIST?) to output
the data in comma delimited format. That is it!
The output could also be in any format such that I can read it into
MySQL or Excell (again the comma delimted is fine!)
I am very very new to Pick/Universe databases. HELP!
D. Ulm
If you don't know the file structure, or how certain fields (dates,
money) are stored, or if you don't know what an attribute is, or how to
write a native file then you are in over your head and should have
someone else do this.
Again, this is easy.
Take my advice and use tab-delimited.
Luke
I don't have the URL handy, but look for the Cedarville DOWNLOAD
program (as in University at www.cedarville.edu). It works with both
UniVerse and UniData. I'm pretty sure the author reads u2-users (sign
up for that list following instructions from www.u2ug.org) and others
there use it too, so if you don't find it right off, you might want to
ask there.
--dawn
Here's a routine I am using to create a .csv (comma delimited file)
001 *
002 * This routine creates a comma delimited csv file given a FILENAME
003 *
004 OPEN '&SAVEDLISTS&' TO PF ELSE STOP 201,PF
005 GET(ARG.,1)FILENAME ELSE
006 PRINT 'Usage: CREATE.CSV filename itemname delimiter'
007 STOP
008 END
009 *
010 GET(ARG.,2)ITEMNAME ELSE
011 ITEMNAME = FILENAME:'.csv'
012 END
013 GET(ARG.,3)DELIMITER ELSE DELIMITER = ','
014 *
015 OPEN FILENAME TO THE.FILE ELSE STOP 201,FILENAME
016 DIM LIST(100000)
017 MAT LIST = ''
018 *
019 HDNG = ''
020 IF NOT(INDEX(FILENAME,',',1)) THEN
021 OPEN 'DICT ':FILENAME TO DICT.FILE THEN
022 DONE = 0
023 FOR I = 1 TO 20 UNTIL DONE
024 READ DICTREC FROM DICT.FILE,I THEN
025 HDNG<-1> = OCONV(CHANGE(DICTREC<3>,@VM,' '),'MCU')
026 END ELSE DONE = 1
027 NEXT I
028 IF HDNG # "" THEN
029 LIST(1) = 'ID,':CHANGE(HDNG,@AM,',')
030 END
031 END
032 END
033 *
034 PERFORM 'SSELECT ':FILENAME:' BY @ID'
035 *
036 CNT = 0 + (HDNG # "")
037 LOOP
038 CNT += 1
039 READNEXT ID ELSE EXIT
040 READ REC FROM THE.FILE,ID THEN
041 LIST(CNT) = ID:DELIMITER:CHANGE(REC,@AM,DELIMITER)
042 IF NOT(REM(CNT,100)) THEN PRINT @(0,23):CNT:" ":
043 END
044 REPEAT
045 PRINT
046 MATWRITE LIST ON PF,ITEMNAME
good luck
It can be downloaded from ftp://ftp.cedarville.edu
Check out the new documentation at
ftp://ftp.cedarville.edu/download/download.pdf
[skip lecture]
a small lecture on data storage structure might help - if known, skip
this:
in a multivalue environment (be it universe,pick,etc)
- tables are known as "files", rows as "records", columns as "fields"
- every file has a "data portion" and a "dictionary portion"
- the dictionary describes the layout of rows (ie the columns in them)
- ie the structure of the row
- the data portion holds multiple rows all looking alike in structure.
[/skip lecture]
there is a query language accessible from the command line. It kind of
looks like SQL in reverse, eg
LIST ABC.FILE BY NAME BY DATE NAME DATE TOTAL QTY
which would list the ABC.FILE
sorted by columns date within name
listing columns NAME, DATE, and QTY
with a total of QTY at the end of the report
To create a CSV file, I create an extra dictionary definition, which I
call
"COMMA" (surprisingly), which goes like this:
001 A
002 0
003 ,
004
005
006
007
008 F;","
009 L
010 1
note that line 3 also contains just a single comma - this ensures that
the headings from the report also have separating commas.
file this in either the dictionary of the file you want to list, or in
DICT.DICT to work for every file in the account
(I currently work on Pick/D3 so you may have to massage that for UV)
That's it (for the overhead)
-------------------------------------------------------
For every report I want to export as CSV
I then set the SPOOLER to HOLD, SUPPRESS
sp-assign HS F0
which will route printed files to &HOLD& (or PEQS for me)
LIST ABC.FILE BY NAME BY DATE NAME COMMA DATE COMMA QTY (P
will now list ABC.FILE as before but with commas between name, date and
qty (the total is now removed as it no longer makes sense)
finally copy the &HOLD& printfile to windows (and save it as a dot csv)
------------------------------------------------
I know it looks all muddled here, but once in the DICT.DICT file, it
makes CSV creation a cinch for anything.
> actually there are many ways. The easiest I've used takes a bit
> of time to set up (not that much really) and then is wonderfully
> easy thereafter.
There is a program called DOWNLOAD available at ftp.cedarville.edu
which works with UD and UV under Unix or Windows and Information
under Primos. It can extract MV data to CSV, fixed format, HTML, XML
and several other formats. I just found it this morning and have not
had a chance to play with it, so I cannot tell you any more than
that.
--
===========================================================
Norman Morgan <> http://www.norm-morgan.com
===========================================================
Sometimes I wake up grumpy. Other times I let her sleep.
===========================================================
Along with the other suggestions given, you might also consider
upgrading to QM http://www.ladybridge.com/ This seems to be the one MV
provider who wants to produce functionality to meet todays needs.
This (CSV) is a small requirement and as many have pointed out there is
a solution available if you don't want to write your own.
QM currently has a very nice 'DELIMITER' keyword that will produce nice
tab and comma delimited reports. Martin tells me that in the 2.2-12
release there will be a 'CSV' keyword that will produce reports
compliant with the IETF's mime draft for CSV format.
After years of dealing with PS/RD, Ladybridge's responsiveness has
really impressed me.
HTH,
-Tom