PDA

View Full Version : A little begining help with running SQL



Guest.Visitor
01-01-1995, 02:00 AM
I am in a shop that dosn't believe in SQL the programers run RPGIII. I am attempting to pick this up on my own and a little help would go a long way. I have created several SQL statements using STRSQL, I have tested them and I can run them when I am in SQL. What I am trying to do is save these statements in a source file I have created and use SUNSQLSTM to execute these statements as part of a job. When I use the command RUNSQLSTM pointing to my source file and member I get errors like SQL0104 Token SELECT was not valid. I know that I am missing a step or two but I have not figured it out on my own. I am just looking for some tips or somewhere to look. I am trying to use the AS400 online library now but am still at a loss. Any help is greatly appreciated. Thank you.

Guest.Visitor
10-25-2000, 02:13 PM
Mark, Look for the detailed error messages when you get this one. We need to see exactly how the 400 is reading your statement. If your company can afford it, I would highly recommend the SQL/4Less product from ProData. At the very least, you might try their 30-day trial. Bill

Guest.Visitor
10-25-2000, 05:19 PM
Good for you Mark. In taking the time to advance your skills even against the norm of norm of your peers. Paste or attach any code that you are having trouble with in the future and we can work through it. To answer your question the best place I find is the IBM information center. <a > href="http://publib.boulder.ibm.com/pubs/html/as400/v4r4/ic2924/info/db2/rbafyms t02.htm">This is the V4R4 SQL Programming Manual</a> also the <a > href="http://publib.boulder.ibm.com/pubs/html/as400/v4r4/ic2924/info/db2/rbafzms t02.htm">IBM V4R4 SQL reference</a> Dan

Guest.Visitor
10-26-2000, 05:05 AM
I believe that SELECT is not valid with RUNSQLSTM

Guest.Visitor
10-26-2000, 08:03 AM
I read a lot last night and found part of a a few words on the SELECT not working. Is there any to run these with CL? To avoid writing somthing in RPG to call the SQL statemen. Thank you very much for your responces.

nycsusan@hotmail.com
10-26-2000, 08:17 AM
Mark, Have you looked into OPNQRYF (Open Query File)? If all you want to do is select off records to work with, then OPNQRYF will do the job. It runs in CL programs.

Guest.Visitor
10-26-2000, 08:30 AM
I have several files that I am joining with user prompts. I don't think that I can use the OPNQRYF command to do what I need. Thank you.

nycsusan@hotmail.com
10-26-2000, 08:34 AM
Mark, You can CAN join multiple files using OPNQRYF. Enter the "+" to add multiple files.

Guest.Visitor
11-01-2000, 02:39 PM
You cannot run an SQL select statement with RUNSQLSTM. If you want to run a select statement create your select in Query Manager (STRQM) and use STRQMQRY if the CL.

Guest.Visitor
11-01-2000, 03:35 PM
Mark, If you have Operations Navigator installed you can store your SQL statements (even select statements) in a file and rerun them as often as you would like. Operations Navigator is part of Client Access and will cost you nothing. You get to the run SQL Scripts... option in Operations Navigator by right clicking on the database tab. The help and samples are also better than what you get with the green screen RUNSQL command. One caveat is that the default naming convention is *SQL, you probably do not want this. To change it go to the connection drop down and select ODBC setup.... Then specify *SYS for the naming format, which is located on the format tab. David Morris