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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run SQL from Windows against AS/400 1

Status
Not open for further replies.

Dpressm

Technical User
Apr 13, 2004
4
US
It seems the DB2 CLP (Command Line Processor) is the way to go (other ideas???)

I downloaded and installed and configured and got the msg below. However I do not understand it what gets licensed - on the AS400 or Windows? My setup is at the bottom.

SQL8002N Connect processing failed; a valid product license was not found.

SQLSTATE=42968

db2 =>



The final error message was looked up here:






Here is the error message text

SQL8002N
DRDA connect processing failed; a valid product license was not found.


Explanation: A valid license key could not be found and the evaluation period has expired.

User Response: Install a license key for the fully entitled version of the product. You can obtain a license key for the product by contacting your IBM representative or authorized dealer.

sqlcode: -8002





This is a link to where I downloaded the software from:






I then ran the setup and the post setup configuration as found here:



 
How do you initiate the sql - I need something to run at the batch prompt.
 
I use both visual basic and ms access. They can be both launched in batch mode. We have a lot of over night processes that run without out any human intervention. I'm not saying CLP is a bad approach; I've just never tried it. What type of queries are they? Inserts/Updates/Deletes? If select queries, what do you want to do with the results?
 
Selects only - I want to push to a flat file.
 
Is query400 out of the question? I'd create a CL with a runqry, then copytopcd and/or ftp. Use wrkjobscde and schedule the job to run whenever. Is that plausable for your situation?

Mark
 
Dpress,

We use the MS Access TransferData command to push data from AS400 pass-thru queries to windows flat files. This process runs at night via dos batch files. If you're interested in this approach I can post some examples.

- Dan
 
As an apart, if you have an iSeries you will have available to you iSeries Access for Windows which allows you to use ODBC/OLEDB with any compliant language free of charge.

Depending on your iSeries licensing you may even have licenses to use the Data Transfer and 5250 emulator and the Data Transfer may be enough for your needs, but it does require a license, while the ODBC/OLEDB does not.

I may be wrong, but its even possible that having the iSeries Access installed will allow you to use the DB2 CLI you installed originally without further need for the DB2 Connect. Unfortunately I can not test that anymore.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
The following access function is called from a macro to pump queries from the AS400 to windows flat files.
Code:
Function Policies()
    DoCmd.TransferText acExportFixed, "PolicyMaster", "PolicyMaster6", _
      "J:\GTO\Data\PolicyMaster.txt", False, ""
    DoCmd.TransferText acExportFixed, "PolicyEndorsement", _
      "PolicyEndorsement2", "J:\GTO\Data\PolicyEndorsement.txt", False, ""
    DoCmd.TransferText acExportFixed, "PolicyInsured", "PolicyInsured2", _
      "J:\GTO\Data\PolicyInsured.txt", False, ""
    DoCmd.TransferText acExportFixed, "PolicyCoverageCode", _
      "PolicyCoverageCode2", "J:\GTO\Data\PolicyCoverageCode.txt", False, ""
    DoCmd.Quit acSave
End Function
If your unfamiliar with VBA code, you could have done the whole thing graphically (point and click) with an access macro. Unfortunately, I can't post graphics here. In the above code, PolicyMaster6, PolicyEndorsement2, PolicyInsured2, and PolicyCoverageCode2 are the names of odbc pass-thru queries.

As for the dos bat file:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" J:\GTO\GeniusToOracle.mdb /X Policies
EXIT

Policies is the name of a access macro that calls the VBA function listed above. Important: don't forget the EXIT or the docmd.QUIT. Otherwise, the process won't terminate. This is actually a scaled down example from our production system which processes over 100 queries running several in parallel to boost performance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top