This looks a bit dangerous.

It is converting all @AMs and @VMs to pipes.  This is assuming that the number 
of AMs and VMs will be consistent for each REC - a very bad idea in general 
considering the whole concept of multi-values (and for that matter, 
multi-attributes).

To extract just specific fields (attributes), you will need to add more lines 
of code to only grab those fields, and then write this out to your CSV file.  
For example:
        LINE = REC<1>
        LINE<-1> = REC<4>
        LINE<-1> = REC<8>
        ...
        CONVERT @FM TO "|" IN LINE
        WRITESEQ LINE ON CSVFIL ...

Again, this does not cover the issue of multi-values.  If field 4 of the first 
record has 1 multi-value, but field 4 for the 2nd record has 10 multi-values, 
then using a pipe for a shared delimiter will make the export almost completely 
worthless.  You might want to convert AMs to pipes and convert VMs to tildas 
(~) or some other ASCII delimiter, however, that will be us to you and your end 
user.


John Israel
Senior Programmer/Analyst
Dayton Superior Corporation
721 Richard St.
Miamisburg, OH  45342
937-866-0711 x44380

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dattatraya
Sent: Monday, November 30, 2009 12:01 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] How to Extract Selected multivalue colums


Dear All

I have a following program to extract pipe delimated data, but I want to
select only some columns how to do that? and how to split output file after
some records ( ie 10000 or 20000 ) .
-------------
OPEN 'CUSTOMER' TO FIL ELSE STOP 201 'CUSTOMER'
OPENSEQ 'CUSTOMER.CSV' TO CSVFIL ELSE NULL
WEOFSEQ CSVFIL
SELECT FIL
LOOP WHILE READNEXT ID DO
READ REC FROM FIL,ID THEN
LINE = '' : CHANGE(CHANGE(REC,@AM,'|'),@VM,'|') : '|':ID
WRITESEQ LINE ON CSVFIL ELSE CRT 'CAN NOT EWRITE TO CSV FILE'
END
REPEAT
---------------

Regards
Dattatraya

-- 
View this message in context: 
http://old.nabble.com/How-to-Extract-Selected-multivalue-colums-tp26569624p26569624.html
Sent from the U2 - Users mailing list archive at Nabble.com.

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to