Home > Archive > Clarion > May 2006 > Parsing through a CSV file - need a little help
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Parsing through a CSV file - need a little help
|
|
| CFCUG President 2006-05-07, 6:56 pm |
| Hello,
I am trying to parse through a CSV file.
I imported the table into my CW55PE dictionary using the basic driver.
Here is my problem:
I am trying to capture an account number where ever one exists in the
first column.
The difficulty is that I have to do an instring search for the string
"(P)" if found then go to the previous row and assign the value to a
temporary string. Then I need to go 2 rows further and start searching
again. Here is my attempt thus far using Legacy code (this is inside a
loop already) It is basically reading a few rows and exiting.
Any ideas are welcome...
AccountPosition = INSTRING('(P)',SMSD:Label1,1,1)
IF AccountPosition > 0
Previous(SMSDatabase) !Read previous row
CSN = LEFT(SUB(SMSD:Label1,1,6))
CUSW:CSN = CSN
GET(Customers,CUSW:CSNKey)
IF ERRORCODE()
CUSW:SECCSN = CSN
GET(Customers,CUSW:SECCSNKey)
IF ERRORCODE()
LogRecords = '*** Non-existent customer ' & ERROR() &
CSN
CLEAR(CUSW:Record)
Add(LogQueue)
Display(?List1)
NEXT(SMSDatabase) !Skip to next row
NEXT(SMSDatabase) !Skip to next row
END!IF
END!IF
LogRecords = 'Customer found ' & CUSW:CSN
Add(LogQueue)
Display(?List1)
END!IF
COC:CustomerNumber = CUSW:CustomerNumber
IF COC:CustomerNumber = 0 !Do not process a record if it does not
exist in our client file
CYCLE
END!IF
| |
| Dan Pressnell 2006-05-07, 6:56 pm |
| PREVIOUS() is not supported by the Basic driver. It might be best to employ
a queue to do what you want.
"CFCUG President" <securitypro@cfl.rr.com> wrote in message
news:1146925994.608141.231710@j33g2000cwa.googlegroups.com...
> Hello,
>
> I am trying to parse through a CSV file.
>
> I imported the table into my CW55PE dictionary using the basic driver.
>
> Here is my problem:
>
> I am trying to capture an account number where ever one exists in the
> first column.
> The difficulty is that I have to do an instring search for the string
> "(P)" if found then go to the previous row and assign the value to a
> temporary string. Then I need to go 2 rows further and start searching
> again. Here is my attempt thus far using Legacy code (this is inside a
> loop already) It is basically reading a few rows and exiting.
>
> Any ideas are welcome...
>
> AccountPosition = INSTRING('(P)',SMSD:Label1,1,1)
> IF AccountPosition > 0
> Previous(SMSDatabase) !Read previous row
> CSN = LEFT(SUB(SMSD:Label1,1,6))
> CUSW:CSN = CSN
> GET(Customers,CUSW:CSNKey)
> IF ERRORCODE()
> CUSW:SECCSN = CSN
> GET(Customers,CUSW:SECCSNKey)
> IF ERRORCODE()
> LogRecords = '*** Non-existent customer ' & ERROR() &
> CSN
> CLEAR(CUSW:Record)
> Add(LogQueue)
> Display(?List1)
> NEXT(SMSDatabase) !Skip to next row
> NEXT(SMSDatabase) !Skip to next row
> END!IF
> END!IF
> LogRecords = 'Customer found ' & CUSW:CSN
> Add(LogQueue)
> Display(?List1)
> END!IF
>
> COC:CustomerNumber = CUSW:CustomerNumber
> IF COC:CustomerNumber = 0 !Do not process a record if it does not
> exist in our client file
> CYCLE
> END!IF
>
|
|
|
|
|