PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: jmanio19 at eos dot eos dot net (John Manion)
Subject: Re: BCP and index drop Questions
Date: Feb 22 1996 3:26PM

mpeppler@itf.CH (Michael Peppler) writes: 
> 
> > From: jmanio19@eos.eos.net (John Manion)
> > 
> > First off, I'm completly new to sybperl and I apologize if any of this has
> > been hashed out before.  Also, this is a long note, and I apologize for 
> > that as well, I'm trying to be thorough.  :-)
> 
> That's actually a good idea. At least we can then rule out a number of
> potential problems...
> 
> That said, there are two problems that I can see straight away:
> 
> One is a syntax error:
> 
>      die "bcp_sendrow failed at row $Cnt" if ($SybSess->bcp_sendrow($SybSess, @dat) == FAIL);
> should be
>      die "bcp_sendrow failed at row $Cnt" if ($SybSess->bcp_sendrow(@dat) == FAIL);
> 
> But that's pretty trivial.
> 

Ok, Changed that.

> The big problem is that your input file needs a lot more parsing.
> 
> I ran the following script on your data:
> 
> #!/usr/local/bin/perl
> 
> while(<>) {
>     chop;
>     @d = split(/\t/);
>     foreach $i (@d) {
>         print "$i\n";
>     }
> }
> 
> I got the following results:
>  
>                       Should be status field -- 0
> "MGMember.2"          NOAid  Field
> 1                     Lock Field
> "mcapdev"             Updtuser
> "2/21/1996 12:01"     UpdtDate
> "mcapdev"             UserId
> "2/21/1996 12:01"     CreateDate
> "2/21/1996 12:01"     ObscDate
> "000000000"           SSN
> "MURPHY"              Name_Last
> "19460608"            DOB
> "JAMES"               Name_First
> "45405"               Address_Zip
> 'Member ( MIDUOID MGMember.2 Name ( First JAMES Middle E Last MURPHY  ) SSN 000000000 DOB 19460608 Address ( Street1 "367 NILWOR AVENUE" City DAYTON State OH Zip 45405  ) Gender Male NOAid MGMember.2  ) '
> 

     This last field is NOA, a text field made up of named pairs of data and
     sub-NOA's.  It's a long story, we don't want to get into that.

> This is exactly what you are feeding bcp_sendrow. I very much doubt
> that this is what you want, and I'm fairly positive that the quotes are
> unwanted.

This is correct, although I put the quotes in hoping that it was having trouble
with the text type fields knowing it shouldn't.

The last field is a sybase text field and everything from the word Member to
the last matching parenthesis really goes into that field.

Somehow you left off the first field, which is a zero in the data I sent
out
> 
> If you can come back with a description of which portions of which
> fields go into which columns (;-) we can probably figure out the
> parsing pretty quickly...
> 

I fixed the syntax error and took the quotes out, now the sendrow 
call seems to work (At least it gets past it) but the code simply hangs
on the bcp_batch and the bcp_done commands.

I dropped the $Cnt check value down to 10 and tried it with more than 
10 records and it hung on the bcp_batch call.  
The I tried it with 8 records and it hung on the bcp_done call.

Just a side note, I can bcp this data into the table from the shell using
the bcp command.

> 
> Michael
> 

Thanks again,

John