| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

12-07-09, 13:50
|
|
Registered User
|
|
Join Date: Dec 2009
Posts: 3
|
|
|
Help converting an old database to something newer
|
|
I apologize if this is not posted in the correct area. This seemed to be the closes one to what I was asking.
Ok, years ago I wrote a simple DOS Basic program to catalog music. I now have something close to 30,000 + songs cataloged in this database. What I would like to do is to be able to convert ALL of this data into something more 'TODAY'...i.e. Excel or something. Does anyone have a clue if this is possible. The old data file is a Random Access .DAT file. I custom configured the array and I am posting some of the code so you can see what I am talking about. Or can anyone point me in the direction of a good database board that might can help me with this?
I wrote this thing back in the earlier 90's and it is still working, but I really would like to move this data over to something else, without having to manually enter over 30,000 songs
Here is the code:
COMMON SHARED MN
' STORES MUSIC, BY MEDIUM, NUMBER, & ARTIST
Type MUSICREC
NUMBER As String * 5
ST As String * 1
SONGTITLE As String * 50
ARTIST As String * 45
RATING As Integer
EDATE As Long
End Type
Dim MR As MUSICREC
Dim A$(200), B$(200), C$(200), D$(200), E(200)
Open "C:\MUSIX\RF.DAT" For Random Access Read Write As #1 Len = 107
|
|

12-07-09, 15:45
|
|
Jaded Developer
|
|
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
|
|
if you have access to a dos basic interpreter then you could write the existing data to a csv file and then import it into what ever db tool you have access to.
that coudl be Access or FileMaker and so on
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
|
|

12-08-09, 10:26
|
|
Papabi's friend
|
|
Join Date: Sep 2009
Location: Ontario
Posts: 629
|
|
|
|
If you don't have Basic anymore, if you have a program that prints the entire list, you could create a generic text printer and print the list to disk, then you should have a fixed column file with no printer escape sequences that you could load into a database.
|
|

12-08-09, 11:11
|
|
Registered User
|
|
Join Date: Dec 2009
Posts: 3
|
|
Quote:
Originally Posted by healdem
if you have access to a dos basic interpreter then you could write the existing data to a csv file and then import it into what ever db tool you have access to.
that coudl be Access or FileMaker and so on
|
I still have my copy of VB 6.0 and that will open it up. It has been years (and I do mean years) since I have done any programming. Can you share a little more info on what you are talking about writing?
|
|

12-08-09, 12:21
|
|
Papabi's friend
|
|
Join Date: Sep 2009
Location: Ontario
Posts: 629
|
|
This is somewhat like the blind leading the blind. The following pseudo code should create a tab delimited file.
Quote:
COMMON SHARED MN
' STORES MUSIC, BY MEDIUM, NUMBER, & ARTIST
Type MUSICREC
NUMBER As String * 5
ST As String * 1
SONGTITLE As String * 50
ARTIST As String * 45
RATING As Integer
EDATE As Long
End Type
Dim MR As MUSICREC
Dim A$(200), B$(200), C$(200), D$(200), E(200)
Open "C:\MUSIX\RF.DAT" For sequential Access Read As #1 Len = 107
open "C:\MUSIX\LIST.TXT" for sequential access write as #2
while read #1
do
print #2,number;chr$(9);st;chr$(9);songtitle;chr$(9);art ist;chr$(9);rating;chr$(9);edate
end while
close #2
quit
|
|
|

12-08-09, 13:19
|
|
Jaded Developer
|
|
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
|
|
yup that should do it, or get you close to it
it may be smarter to encapsualte string columns with text delimiters eg " or '
it may be smart to repalce existing ' or " in the data stream with the escape sequence (forget waht it is in Access may well be \ eg o'callaghan become o\'callaghan
depending on how you are writing this data it may be smarter to use the comma to separate the columns and save the file as a CSV rather than a TXT file but thats down to your preference
you may bneed to tinker with the date to make certain its valid when importing into access. you will undoubtedly make your life easier if you use the abomination of a US styled date eg mm/dd/yyyy.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
|
|

12-09-09, 11:12
|
|
Registered User
|
|
Join Date: Dec 2009
Posts: 3
|
|
Thanks for the tips, I will give that a try.
I said transfer it to Excel in my earlier post. I really don't care what I can get it transferred into, I just want to get it into something that is actually more for modern Windows.
Update:
When I type these two lines into VB 6:
Open "C:\MUSIX\RF.DAT" For sequential Access Read As #1 Len = 107
open "C:\MUSIX\LIST.TXT" for sequential access write as #2
I get an error. These says ' compile error: Expected: Input or Output or Append or Binary or Random'
Could I be getting this error because the original file is 'Random Access'?
|
Last edited by darkcyber; 12-09-09 at 13:28.
|

12-17-09, 14:58
|
|
Super Moderator
|
|
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
|
|
Code:
Type MUSICREC
NUMBER As String * 5
ST As String * 1
SONGTITLE As String * 50
ARTIST As String * 45
RATING As Integer
EDATE As Long
End Type
Private Sub XfrData
Dim N as Integer
Dim RecBuff as MUSICREC
Open "C:\MUSIX\RF.DAT" For Random Read As #1
open "C:\MUSIX\LIST.TAB" for output as #2
Do While not EOF(#1)
N=N+1
Get #1,N,RecBuff
With RecBuff
Print #2, """" & .NUMBER & """" & vbTab & """" & .ST & """" & vbTab & """" & .SONGTITLE & """" _
& vbTab & """" & .ARTIST & """" & vbTab & cStr(.RATING) & vbTab & Cstr(.EDITDATE)
End With
Loop
Close #2
Close #1
End Sub
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert
|
|

12-17-09, 18:41
|
|
Super Moderator
|
|
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
|
|
FYI. It had been a while since I've done anything with random I/O files, and had a couple of hours to burn, so I threw together a little VB6 app that may help.
Merry Christmas!
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert
|
|

01-11-10, 02:17
|
|
Registered User
|
|
Join Date: Apr 2008
Location: Bangalore, India
Posts: 23
|
|
|
csv to sql
Once you have exported your .DAT file to CSV format, you could straight away import it into a DB using many free online tools (just google for csv to sql) And Excel opens these csv files anyway.
I'm just curious are these mp3 files? in which case most of players support some form of library management.
__________________
--
Girish.B
Lytecube.com
code free application environments
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|