Yap ... but although CSV is slower, the use of them are very rampant in
the Supply-Chain industry. I actually have codes which deals with a very
widely used CSV formatted files called EDI
(http://en.wikipedia.org/wiki/Electronic_Data_Interchange ) everyday. 

For me J is a very good processing language because it lends well into
parsing the document as opposed to using Visual Basic or C#. Take the
following example code (the data can be found in
http://www.dcs.bbk.ac.uk/~ptw/teaching/e-commerce/slide4.html ):
   NB. Read the EDI document
   [edi=. fread 'c:\sample850.edi'
ISA*00*     *00*  *08*61112500TST      *01*DEMO
WU000003*970911*1039*U00302000009561*0*P?
GS*PO*611125001I*WU000003 *970911*1039*9784*X*003020
ST*850*397822
BEG*00*RE*194743**970911
REF*AH*M109
REF*DP*641
REF*IA*000100685
DTM*010*970918
N1*BY*92*1287
Nl*ST*92*87447
N1*ZZ*992*1287
PO1*1*1*EA*13.33**CB*80211*IZ*364*UP*71837927164l
PO1*1*2*EA*13.33**CB*80211*IZ*382*UP*718379271573
PO1*1*3*EA*13.33**CB*80213*IZ*320*UP*718379271497
PO1*1*4*EA*13.33**CB*80215*IZ*360*UP*718379271848
PO1*1*5*EA*13.33**CB*80215*IZ*364*UP*718379271005
CTT*25
SE*36*397822
GE*1*9784
IEA*1*000009561

   NB. Convert the EDI document into a matrix for easier processing
   [data=: > '*' cutstring each cutopen edi
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|ISA|00 |          |00       |      |08     |61112500TST      |01
|DEMO WU000003|970911|1039|U00302000009561|0|P? |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|GS |PO |611125001I|WU000003 |970911|1039   |9784             |X
|003020       |      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|ST |850|397822    |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|BEG|00 |RE        |194743   |      |970911 |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|REF|AH |M109      |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|REF|DP |641       |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|REF|IA |000100685 |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|DTM|010|970918    |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|N1 |BY |92        |1287     |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|Nl |ST |92        |87447    |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|N1 |ZZ |992       |1287     |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|PO1|1  |1         |EA       |13.33 |       |CB               |80211|IZ
|364   |UP  |71837927164l   | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|PO1|1  |2         |EA       |13.33 |       |CB               |80211|IZ
|382   |UP  |718379271573   | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|PO1|1  |3         |EA       |13.33 |       |CB               |80213|IZ
|320   |UP  |718379271497   | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|PO1|1  |4         |EA       |13.33 |       |CB               |80215|IZ
|360   |UP  |718379271848   | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|PO1|1  |5         |EA       |13.33 |       |CB               |80215|IZ
|364   |UP  |718379271005   | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|CTT|25 |          |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|SE |36 |397822    |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|GE |1  |9784      |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
|IEA|1  |000009561 |         |      |       |                 |     |
|      |    |               | |   |
+---+---+----------+---------+------+-------+-----------------+-----+---
----------+------+----+---------------+-+---+
   NB. Lets get the PURCHASE ORDER NUMBER for this document
   [pono=. > data {~ < 3 ,~ 'BEG' boxsindex~ {. "1 data
194743   
   NB. Resolve the Total Order Quantity
   +/ ". > 2 { "1 data {~ I. 'PO1' boxsequal~ {. "1 data
15

This is one of the application of J where it shows its strengths. You
would normally have to loop through each rows with VB or C# just to find
the matching rows like for the PO1 segments then do your calculations. 

r/Alex

P.S.
Btw, if you don't have the cutstring method (I believe this is written
by Chris Burke), its defined as:
   cutstring
','&$: :(4 : 0)
if. 0 = #y do. '' return. end.
if. L. y do. y return. end.
txt=. y, {.x
msk=. txt = ''''
com=. (txt e. x) > ~: /\ msk
msk=. (msk *. ~:/\msk) < msk <: 1 |. msk
(msk # com) <;._2 msk # txt
)


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Randy MacDonald
Sent: Monday, January 07, 2008 12:23 PM
To: General forum
Subject: Re: [Jgeneral] Successful stories

Hello Bob;

Would it be possible to elaborate on 'parens?' Mom and Dad perhaps?  
BSF, Jargon/paraphrasing is rampant, and my habit is to ask when I need 
clarification.

My personal guess about the handling of CSV's is the overhead of lining 
up the row lengths can make processing those files to be slower than 
what is possible with fixed length 'records.'

Lynn & Bob Graf wrote:
> I'm a newbie at this.  Don't exactly understand what a CSV is, but
perhaps the first time an abbreviation is used, could it be written out,
with the abbreviation in parens.  This is the way many technical reports
are written - a nice courtesy.
>
> At any rate, on the subject, in addition to a matrix of fixed length
rows, what's wrong with a list of boxes?
>
> Bob in Boynton Beach, FL.
>
>
>        
> ---------------------------------
> Looking for last minute shopping deals?  Find them fast with Yahoo!
Search.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>   

-- 
------------------------------------------------------------------------
|\/| Randy A MacDonald       | APL: If you can say it, it's done.. (ram)
|/\| ramacd <at> nbnet.nb.ca |
|\ |                         | The only real problem with APL is that
BSc(Math) UNBF'83            | it is "still ahead of its time."
Sapere Aude                  |     - Morten Kromberg
Natural Born APL'er          |
-----------------------------------------------------(INTP)----{ gnat }-


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to