Link to home
Start Free TrialLog in
Avatar of tlw2651
tlw2651

asked on

Transfer contents of Sequential File to MS SQL Database

I am importing a sequential data file with about 5000 lines of data (generated by an application coded in COBOL) to a MS SQL Database table...  Everything runs smoothly until the program hits a line that contains a period (as in:  2.5 grams).  After that it starts a new line and throws eveything out of synch.  Naturally everything crashes as the program tries to insert things into places where they don't belong...  Right now I work around it by changing all of the periods (.) to commas (.) using a text editor before I start the import process - but it's a ponderous work around...  Any ideas on how I can do this from inside VB or tell VB to accept the periods as part of the string
Avatar of tomook
tomook

What are you using for delimiters? Can you get the COBOL program to either quote delimit text ("2.5 grams"), or have your program interpret numbers as such? I guess I do not have enough information about the import method you are using. Please tell us how you are:
A) reading the file, and
B) what method you are using to post to SQL Server.
I have an application that does pretty much the same thing.  I bring the data into a listbox first, that way the user can check and/or edit it.  Each line has several periods in it, and I don't have any problem with them.
If you want more info, let me know.
ASKER CERTIFIED SOLUTION
Avatar of Dr. Kamal Mehdi
Dr. Kamal Mehdi
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tlw2651

ASKER

Kamall's answer is a good work around but I still don't understand why the program gets thrown off because of the commas.  I'm using the MID function to cut out the bits of information from the sequential and then calling a MS SQL stored procedure to store them in the appropriate rows of the database.  For some reason when the program encounters a comma it ignores the instructions pertaining to the length of the bit of text I want to cut out and starts the next bit.

Here's are 3 lines of the type of information I'm trying to extract.  The '[' were put in to make it easier to program initially.

000000003[01[20[029[29[200[SOLUTRAT 150MG X 20COMP. [        [        [01[000000000[000000000[000000000[+[000000000[0000000000000[0000000000000[00000000[0000000000002[0000000000002[00[04041998[0000000000002[0000000000002[04041998[29061997[04041998[00000000[000000000[ [0000[0000[ [ [ [000020000[+[000019000[01[000[2645071       [20[              [0000[029[29[SOLUTRAT 150M[01[SOLUTRAT 150MG[20[ [000000162[N[N[N[N[S[FAROPR      [*********[                                                            

000000004[01[30[029[29[077[NIVAQUINE COMP X 30      [        [        [01[000000000[000000000[000000000[+[000000000[0000000000000[0000000000000[00000000[0000000000000[0000000000000[00[00000000[0000000000000[0000000000000[00000000[30061997[00000000[00000000[000000000[ [0000[0000[ [ [ [000030000[+[000015000[01[000[0910092       [20[              [0000[029[29[NIVAQUINE COM[01[NIVAQUINE COMP[30[ [000000054[N[N[N[N[S[FAROPR      [*********[                                                            

000000005[01[20[029[29[807[BLAVIN 10MG COMP X 20    [        [        [01[000000000[000000000[000000000[+[000000000[0000000000000[0000000000000[00000000[0000000000000[0000000000000[00[00000000[0000000000000[0000000000000[00000000[29061997[00000000[21021998[000000000[ [0000[0000[ [ [ [000020000[+[000021000[01[000[3398712       [20[              [0000[029[29[BLAVIN 10MG C[01[BLAVIN 10MG CO[20[ [000000142[N[N[N[N[S[FAROPR      [*********[                                                            

Thanks for your responses