Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate Flat File Dump! 2

Status
Not open for further replies.

sera

Technical User
Jun 29, 2000
360
US
I need to automate a flat file dump in Paradox. I have never used Paradox. I need to get the data into an Oracle database (resides in UNIX) from the Paradox database. I have been unable to find a Paradox ODBC for Unix, so the next step is to automate a dump of a flat file from Paradox. This would allow us to do essentially the same thing. Is there a programming environment in Paradox? Has anyone done this before?



Sera
I often believe that...
My computer is possessed!
 
Yes, there is programming environment for Paradox. The old DOS version was called PAL (Paradox Application Language) and the newer, Windows version is called OPAL (Object PAL). Depending on the contents of the tables which comprise your database, there are several options you have. If the data is simplistic (meaning no BLOBs, logical fields, etc...) you could probably get away with a copy of Paradox 4.5 Runtime for DOS and a text editor.

It gets more complicated if the data is stored in the higher level field types. You can do a straight export interactively if you have a full version of Paradox. However, if there are BLOBs you will have to delve into the language a bit.

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Mac,
Do you know how I would automate the script....? Run it through windows tasker?


Sera
I often believe that...
My computer is possessed!
 
Yes, that would be the simplest solution if this was going to be a regular event.



Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Well thanks....I will go figure it out! Do you have the t-shirt for the saying that you have at the bottome of your posts? You can get it at thinkgeek.com.

Sera

Sera
I often believe that...
My computer is possessed!
 
Sera,

Assuming you have a relatively recent version of Paradox for Windows, e.g. 5.0 or later, you'll want to:

1) Create a script that exports the table to the text file.

2) Create a shortcut that launches Paradox and runs your script.

3) Use something like the Windows Scheduled Task utility to launch your Paradox shortcut.

4) Get the text file transferred to your Unix box.

For Step 1, something like this should be sufficient:

Code:
method run(var eventInfo Event)

   exportASCIIVar( "c:\\fullpath\\tablename.db",
                   "c:\\fullpath\\cdf_file.txt",
                   ",", "\"", TRUE, FALSE )
   exit()

endMethod

Please note the following:

1. The backslash is the escape character in ObjectPAL, so you need two backslashes to separate directory names in strings.

2. For best results, specify the complete path for the source table and the target text file.

3. Use mapped drives, not UNC paths--especially if you're using an older version of Paradox for Windows.

4. The delimiter uses the backslash to escape the double-quotation mark, which is also the delimiter for strings in ObjectPAL. (ObjectPAL doesn't support single quoted strings like Perl or other tools you're probably more familiar with.

For Step 2, copy your current Paradox shortcut, paste it into an Explorer window, right-click it, choose Properties, and then change Target to something like:

Code:
"C:\PdoxPath\pdxwin32.exe" c:\fullpath\export.ssl

For this step, please note the following:

1. You only use a single backslash to spearate directories.

2. The quotation marks only surround the file name; they do not include the name of the script you created in the previous step.

3. You need to specify the fully qualified path of your script. (Again, mapped drives are best.)

I'll leave the last two steps for you to work through. Once you've exported the data, you can use an technique you're comfortable with to get the file to your server.

Hope this helps...

-- Lance
 
Very Nice Lance....Well I don't have to worry about the UNIX part. I have a system admin doing that. But I do have a newer version of Corel, and I am very grateful for that script. It would have taken me a while to figure it out. You have saved me tons of time. I love tek-tips.com!!! It is so awesome!



Sera
I often believe that...
My computer is possessed!
 
Lance,
I am getting the error....from the script above...

Disk error occurred while reading file

Do you have any ideas as to why this might be happening?



Sera
I often believe that...
My computer is possessed!
 
Well I will just answer my own question..just in case someone needs the solution. I was running the script improperly. I tried to add the script into a text document and then just changed the extension to .ssl. When I created the script from within the Paradox environment I was able to run it without the error.....must be something that the Paradox environment does differently.



Sera
I often believe that...
My computer is possessed!
 
<<When I created the script from within the Paradox environment I was able to run it without the error.....must be something that the Paradox environment does differently.
>>

Paradox for Windows deals with Objects. All &quot;things&quot; are variations of a single Object. Forms have a surface to display stuff and interact with, as well as provision for holding code. Reports just have a surface (well, mostly !), libraries are just code-containers but can't be launched, and scripts are code-containers that can be run, but have no GUI, unlike forms. The ObjectPAL code is compiled into threaded object code when the object is saved, so it is nothing at all like a text file !


One last trick that might help you too:

If you want to get the contents of a Paradox table (not BLObs like memos, binaries, pictures, etc - sorry !) into something like Excel, open the table on the Paradox desktop, do Edit | Select ALL and then Edit | Copy. Go to Excel and select ONE cell only and use Edit | Paste.
Et voila ! All your table in Excel ! I don't know if that'll work into Oracle (I haven't got a copy here handy) but it might then be easier to push from Excel into Oracle ...

hth

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top