× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Rob,

Qshell supports filename wildcards using the * character. Set aside DB2 for now, and consider the following example:

STRQSH CMD('cp * /tmp')

This command uses a wildcard. I've told it to find all of the files in the current directory of the IFS, and copy them to the /tmp directory. What you may not realize is that it resolves the wildcard BEFORE it runs the 'cp' command.

Qshell itself finds all of the filenames, and inserts them into the command, then runs it. So if you have files named file1.txt and file2.txt in your current directory, QShell actually runs the following:

cp file1.txt file2.txt /tmp

QShell converted the wildcard into a list of files, modified the command appropriately, then called the "cp" command with the result. The wildcards are resolved BEFORE it runs the command. QShell does NOT leave it up to the called command to figure out what the wildcard means like MS-DOS does.

Back to DB2... You were sending the following:

DB2 select * from gdidivf.rco

now that you know QShell thinks that * is a wildcard, and you know that it inserts the values of the files in the directory BEFORE calling the DB2 utility, what do you think will happen? It will make the command look like this:

DB2 select file1.txt file2.txt from gdidivf.rco

So when the DB2 gets teh command line, and tries to interpret it as an SQL statement, THAT is what it sees... it never sees your * character. So it says "hmmm... Rob wants to select a field named TXT from a file named FILE1. (which is legal) but then it gets the "file2.txt" and chokes on that since there wasn't a comma, it's interpreting it as something else (a null indicator?) but doesn't like the dot in the file name... so it goes "Hey dude, you can't put that there... you need a comma with another field, or you need the word FROM..." (It's a very informal SQL interpreter, and calls people "dude" a lot.)

If you want to say select *, then try using quotes so it doesn't interpret it as a wildcard...

STRQSH CMD('DB2 "Select * from from gdidivf.rco"')

Good luck!


rob@xxxxxxxxx wrote:
It doesn't appear that I can do this:
STRQSH CMD('DB2 Select * from gdidivf.rco')
**** CLI ERROR ***** SQLSTATE: 42601 NATIVE ERROR CODE: -104 Token . was not valid. Valid tokens: , FROM INTO.
But this works fine:

STRQSH CMD('DB2 Select cmpny, cmpnam from gdidivf.rco')

Please read both before commenting. Otherwise you may think its a dot versus slash thing.

Rob Berendt


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.