delimited File

Latimer, Richard richard.latimer@airways.co.nz
Mon, 19 Aug 2002 08:48:48 +1200


Hi Anthony,

this can be done in Quiz but is much easier in QTP - see the annotated code
exerpt below:
         
                                    
 ACCESS fatscsv                        
 DEFINE t_com char*1 = ","           " this is set to be a comma, you could
use other delimiters"
 DEFINE t_len num*3  = 200          
 DEFINE t_rec char*200 = txt_fats    "this is the input file, 1 X 200
characters with embedded commas"
                                    
 TEMP t_service    char*3            "these are the first three fields to be
extracted,
 TEMP t_dte_filed  char*8            "I left the others out for clarity !)
 TEMP t_tme_filed  char*4
           
 TEMP strt         num*3                                       
 TEMP endd         num*3                                
                                                  
 ; Service                                         
 ITEM strt = 1                                      "beginning of the text
string"
 ITEM endd = index(t_rec{strt:t_len - strt},t_com)  "the first comma"
 ITEM t_service = t_rec{strt : endd - 1}            "our first field : 1 to
comma -1"
                                                  
 ; Filed Date                                      
 ITEM strt = strt + endd                            "start of the second
field is comma + 1"
 ITEM endd = index(t_rec{strt:t_len - strt},t_com)  "the second comma"
 ITEM t_dte_filed = t_rec{strt : endd - 1}          "the second field"
                                                   
 ; Filed Time                                       "keep going  . . . "

 ITEM strt = strt + endd                           
 ITEM endd = index(t_rec{strt:t_len - strt},t_com) 
 ITEM t_tme_filed = t_rec{strt : endd - 1}         
                                                   
 SUBFILE ldfats keep include             &           "we subfiled them first
but they can go straight"         
    t_service, t_dte_filed, t_tme_filed, &           "to a permanent file if
you ncon() numbers"          
    t_operator, t_acft, t_acfttype,      &                     
    t_route, t_dte_dep, t_tme_dep, t_cde_callsign, t_txt_rmrks 



If you haven't got QTP and have to do it with Quiz you can do it with
cascaded defines (quiz doesn't have temps and defines aren't as versatile)
but expect a performance hit. 


Drop me a note off list and I will forward you a sample.

cheers
Richard

ps list stalwart Jeff Hoffman first posted this code - it was in response to
a query of mine asking the same question in September 2000 !



-----Original Message-----
From: Arnone, Anthony [mailto:aarnone@grey.com]
Sent: Sunday, 18 August 2002 7:47 a.m.
To: 'powerh-l@lists.swau.edu'
Subject: delimited File


I have a comma Delimited file and I need to read it in Quiz and break out
each individual field. The Record looks like this:

099000,00172,02,07,01,800

I am not exactly sure what is the best and easiest way to accomplish this.


			Anthony

= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe" in message body to
powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.


**********************************************************************
This electronic message together with any attachments is confidential. If
you receive it in error: (i) you must not use, disclose, copy or retain
it; (ii) please contact the sender immediately by reply email and then
delete the emails. Views expressed in this email may not be those of the
Airways Corporation of New Zealand Limited
**********************************************************************