Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL)
Written by Steven Goetjen
Tuesday, 24 October 2006
Turn a multi-step process into a one-step process.
If you have ever needed to download DB2/400 data to your
PC and view the data in MS Excel, as an HTML document, as a simple XML document,
or just as a text file, you know how tricky this task can be. As a System i
developer, I spend much of my time downloading information from the big box to
the small box on my desktop. As much as I love the System i, all my best
productivity tools are still on my PC. I do all my number crunching in Excel, my
emailing in Outlook, my presentations in PowerPoint, and my text editing work in
Edit Plus. When I need data from my DB2/400 database (which is all the time), I
still jump through hoops to download the data. The basic drill is something like
this: I use my handy dandy STRSQL command to select the information I need from
the database. Then, after I get the SQL statement working the way I want, I
change the session attributes and send the Select Output to a file. Next, I jump
to my PC and open a new document in Excel and create a new database query using
the Client Access ODBC driver that points to the library holding my SQL output.
Finally, I select the file and download it to my Excel spreadsheet. Ta da! Isn't
technology amazing?
This multi-step process can be accomplished many
different ways, some easier and some harder. One could use the Client Access
add-ins to pull the data, use the CPYTOIMPF command to copy the file to the IFS,
or link directly to the physical files and use a third-party SQL utility. All
approaches are fine, but none of them are one-step, completely free, and
completely customizable with source included.
Allow me to introduce
STRCGISQL. STRCGISQL is an RPG ILE Common Gateway Interface (CGI) program that
communicates with the System i HTTP server to deliver real-time DB2/400 data to
the Web. The program attempts to mimic the Start SQL (STRSQL) Interactive
Session command by allowing the user to perform all the same Select Only
functions using a Web browser. Since Web browsers are installed on most PCs,
there is no need for third-party software, emulation software, or System i
command-line access. The user is able to enter an SQL Select statement, press
the Submit button, and get the results of the SQL returned to the browser in the
form of an Excel spreadsheet, HTML, text, or XML.
How STRCGISQL Works
STRCGISQL is totally
self-contained and needs no additional programs or HTML code. It generates its
own HTML input forms and returns its own HTML response. This CGI program is
invoked by the System i HTTP server each time a user sends a request to its URL.
The request to the HTTP server contains the program parameters selected by the
user in the HTML form, and these parameters define the task that the program
will perform.
The first time the user requests the STRCGISQL program
(with no parameters) a Start CGI SQL prompt is displayed (see Figure 1).
Figure 1: The first time you request the STRCGISQL program, you'll get a
Start CGI SQL prompt. (Click images to enlarge.)
STRCGISQL Technical Description
STRCGISQL consists of three
components: STRCGISQL (the main program module), SCS_PROTO (the source
member containing prototypes), and PSCSPARM (a physical file for parsing the
parameters passed to the program). All the programming logic, procedures, and
functions are contained within STRCGISQL. The program has four main processing
tasks: process the parameters, process the SQL statement, build the work files,
and return the results.
Process the Parameters
The parameters that are passed to
the STRCGISQL program are the heart of its processing. These parameters are
defined by the fields in physical file PSCSPARM. The APICvtDB function
(QTMHCVTDB API) parses the data from the input request buffer to an externally
described data structure based on file PSCSPARM. The program then moves the data
structure values to the file fields and writes a new record. If the SQLSTM
parameter is *Blanks, then the SQL prompt returns to the browser. Otherwise, the
SQL statement is processed.
Process the SQL Statement
Processing the SQL statement
involves all the elements required to process dynamic SQL statements and is a
bit more complex than writing an embedded SQL statement for an existing
application. When processing the SQL statement dynamically, one never knows what
the statement will contain and how the output will look. Because of this, the
input requires a syntax check and the output file must be built to obtain the
results on the fly.
The first step involves using the SQL PREPARE
statement to dynamically prepare the SQL statement for processing. The PREPARE
also flags the error (SQLCOD) if the SQL syntax is incorrect. The next step is
to implement the SQL DESCRIBE statement, which obtains information that
describes the SQL statement. This information loads into a data structure
(SQLDA$) for use in the RPG program. The data structure contains all the
field-level information that the program requires to enable it to build the
output files and the SQL statement for returning the results of the SQL
statement.
Build the Work Files
The STRCGISQL program loopds through the SQLDA$ data
structure in subroutine BldCrtTblSQL to get the field information (names and
type) and piece it together into a SQL CREATE TABLE command string. The SQL
EXECUTE IMMEDIATE command executes the string and creates a new table in QTEMP
called DATAOUT. The DATAOUT table possesses the exact record format required to
hold the result of the SQL statement. This being the case, all that's required
is a simple SQL INSERT INTO command in subroutine LoadWrkFile to load the
results of the SQL statement into the DATAOUT file.
The other file
created is the SQLOutput file, a flat physical file that holds the formatted
result for return to the browser.
Return the Result
The result data is now safely
stored in the DATAOUT file. The only thing left to do is format the data into
the requested output. To accomplish this, build another SQL SELECT statement in
subroutine BldxxxSelSQL (where xxx is CSV, HTM, TXT, or XML), execute the
statement to insert the formatted data into the output file in subroutine
LoadOutput, and send the formatted data back to the HTTP server in subroutine
SndxxxOutput (where xxx is CSV, HTM, TXT, or XML).
The BldxxxSelSQL and
SndxxxOutput subroutines have specific formatting controls to return the data to
the Web browser as a CSV document (Figure 2), an HTML document (Figure 3), a TXT
document (Figure 4), or an XML document (Figure 5).
Figure 2: The data is returned as a CSV document.
Figure 3: The data is returned as an HTML document.
Figure 4: The data is returned as a text document.
Figure 5: The data is returned as an XML document.
Easy Does It
This program was created to be easy to understand and
easy to customize. It may be lacking some bells and whistles, but you can modify
it. The only limitations are your imagination and time. Good luck, and use it
well.
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Dec 06 2006 23:56:00
Hi RD <p>After few days, I decided to come back to the source. Based on your advice, (refer the code) <p>1) I've duplicated few lines of code that remarked "Clean the less-then character (<) and replace it with its replacement <" <p>2) Place it before "Eval X_SQLSTM = SQLSTM" <p>3) Replace "RtnStr" with "SQLSTM" <p>4) Replace "<" with "x'2f'" <p>5) Replace "<" with "x'61" <p>6) Compile the program and run. <p>It worked!! just as you've said. <p>Thanks RD. <p><!--mccodelink_begin--> <BR>
<!-- do not remove --> <BR>
<hr width=50 align=left><small><a href='http://www.mcpressonline.com/mc/showcode@@.6b3cdbf9/24' target='_blank'>Code</a></small> <BR>
<!--mccodelink_end-->
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Dec 06 2006 12:12:00
I receive the following error message: <p>call strcgisql <p>Length or start position is out of range for the string operation. <p>Any idea what I'm doing wrong?
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Dec 06 2006 11:51:00
you need to have the same date format that your file has <p>let's say you're keeping your date in your file in *ISO then if you're using interactive sql, start it with STRSQL DATFMT(*ISO), or <BR>
if you're using embedded sql in an rpg program, try this before executing any sql statement <BR>
C/exec sql <BR>
C+ Set Option <BR>
C+ Datfmt = *ISO <BR>
C/end-exec <p>and if you're using another method, try locating the parameter to change the date format <p>martin
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 27 2006 17:01:00
<i>The HTTP server converts the ascii characters to ebcdic using the QEBCDIC and QASCII conversion tables.</i> <p>Are you sure? TCP/IP sockets normally use the QTCPEBC and QTCPASC tables. (HTTP normally uses port 80 or 443). Just asking... <p>Chris
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 27 2006 16:09:00
The HTTP server converts the ascii characters to ebcdic using the QEBCDIC and QASCII conversion tables. This table defines the ebcdic equilvent to the Ascii "/" slash character. To correct this, you would have to change the conversion table to convet the "/" character to the correct x'61'. <p>You can check to see if this is the problem by retrieving the the conversion table source. <BR>
RTVTBLSRC TBL(QEBCDIC) SRCFILE(QGPL/QCLSRC) <BR>
Now use SEU to edit the source file members created by RTVTBLSRC. <BR>
Check the value in Line(2),position(31),length(2). It should be '61'. <p>If you think that this is the problem then you should work with your system admin to change/create the conversion table. Warning: Don't change these tables without fully understanding them. <p>Another (safer) work around would be to set your library list in the STRCGISQL program (via a CL command call) to avoid using the library (and the /) in your SQL statement.
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 27 2006 16:06:00
The HTTP server converts the ascii characters to ebcdic using the QEBCDIC and QASCII conversion tables. This table defines the ebcdic equilvent to the Ascii "/" slash character. To correct this, you would have to change the conversion table to convet the "/" character to the correct x'61'. <p>You can check to see if this is the problem by retreiving the the conversion table source. <BR>
RTVTBLSRC TBL(QEBCDIC) SRCFILE(QGPL/QCLSRC) <BR>
Now use SEU to edit the source file members created by RTVTBLSRC. <BR>
Check the value in Line(2),position(31),length(2). It should be '61'. <p>If you think that this is the problem then you should work with your system admin to change/create the conversion table. Warning: Don't change these tables without fully understanding them. <p>Another (safer) work around would be to set your library list in the STRCGISQL program (via a CL command call) to avoid using the library (and the /) in your SQL statement.
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 25 2006 16:47:00
btw, Araman, you have the source, you can work around this and see how far you get. After the return from API call that populates the PSCSPARM DS (i.e., APICVTDB), do a substring replacement in SQLSTM for hex 2F with hex 61. An example character hex definition in the program is NewLine x'15'. <p> That should allow the SQL processor to parse the SQL statement. But also insert the %char(SQLCOD) in the error message as I noted in a previous post so if it does fail you know the specific reason. <p> As long as you're in between the web page and processing, you can do anything needed. <p> rd
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 25 2006 14:25:00
I was a PC assembler programmer for 10 years back in the dawn of time (the 80's :), so I lived in hex. <p> No, not being on 5 4 changes direction somewhat. For example, the CCSID 1208 business and all the references I cited was as of 5 4. It's a little simpler now in that it can be assumed it's just a failure to convert at least one ASCII special character to EBCDIC, and that others trying this don't have this problem because the system and job CCSID values are 37, that is, convert to EBCDIC, while yours is 65535, do not convert, which can be important when some jobs are using perhaps an international CCSID set. <p> I'm not knowledgeable about the possibilities and reasoning for that. I'm just a programmer. :) <p> Given that the program is already CCSID 37, the next least disruptive thing is to get the job running the CGI program to run with a CCSID of 37 instead of 65535. <p> From IBM doc <BR>
<a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic///nls/rbagsjobdefaultccsid.htm">http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic///nls/rbagsjobdefaultccsid.htm</a> <BR>
<i> <BR>
Job default coded character set identifier <p>A job attribute, job default CCSID (DFTCCSID), is created for jobs with a CCSID of 65535. The DFTCCSID value is used by a system code when a CCSID other than 65535 is needed. <BR>
</i> <p> This would seem to me to be an attribute of the CGI job launched by the web server. The IBM doc for V5R2 web server is <BR>
<a href="http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzaie/rzaiemain.htm">http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzaie/rzaiemain.htm</a> <p> Not sure if anything there is this specific. <p> From a search on DFTCCSID on IBM Infocenter, <i>If the job CCSID is 65535, the DFTCCSID value is based on an appropriate value derived from the job language identifier (LANGID).</i> <p> Google shows some questions about default CCSID, but the link is to the generic IBM Infocenter blackhole link. A googlebot blindly finds everything, but cannot link back to it, and mere mortals using the IBM web interface cannot find it again. :) That is why I say Google makes IBM web doc almost usable. <p> I see under the V5R3 announcement <i># CGI enhancements for running an initialization URL at startup and ability to set CGI jobs' library list.</i> <p> That looks like something along the lines of what you need to change the CGI job CCSID. It will be something in the area of job description and user profile used to get the job CCSID set to 37, I think, without that initialization URL capability. <p> Hopefully that's enough info to find a solution, Araman. :) <p> rd
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 25 2006 04:33:00
Wow! You sure know this stuff very well. <BR>
It looks like I'm out of luck. (Just when I about to get excited about it!) <BR>
I'm on V5R2. Eventhough we have V5R4 on another machine, the CRTSQLRPGI compiler is not installed. Well, so much for that.(Giving up already?) <BR>
Wondering if the STRCGISQL compiled (with LOCALETYPE(*LOCALEUTF) & TGTRLS V5R2)in your machine can be saved in a SAVF (with a V5R2 TGTRLS) and I'll try to restore it on my V5R2. <BR>
See if it works.. (Wonder if its only works on V5R4!).. <p>Thanks again RD, <p>Araman.
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 24 2006 13:02:00
Ok, Araman, that was all the information needed to identify the situation. <p> The slash is hex 2F. Looking across the DSPPFM, for example, the "40 5C 40" for example is the " * " in the "select * from". Going on across you can count the letters and get the 2F where the slash goes. <p> Looking at an EBCDIC table, a very good one provided by <a href="http://www.legacyj.com/cobol/ebcdic.html">http://www.legacyj.com/cobol/ebcdic.html</a> , I read the hex characters for "select * from araman" but the next character, / , has a standard EBCDIC code of hex 61. <p> So it's partly what I expected, different hex value for the slash than in the EBCDIC character set, but the * is the correct value, so it's not all special characters. Also period worked properly when you tried it. I don't know why just slash would not work. <p> My guess was an international EBCDIC set, such as 273. But a search for CCSID tables didn't turn up a set of tables posted on the internet. There is a set of conversion tables in QUSRSYS, but I don't have access to an AS/400 for personal use. I'll have to get back around to getting an account I checked on last year. <p> But I did find something useful. There is an interesting utility at <a href="http://www.legacyj.com/cobol/ebcdic.html">http://www.legacyj.com/cobol/ebcdic.html</a> (powered by iSockets and RPG xTools, from the web page) that gives the hex values of entered text with selected CCSID codes. I entered / and selected 273 and got the standard hex 61, so that wasn't it. <p> Then I tried 1208 and bingo, that was it. But when I had looked at 1208 earlier, I saw it was based on ASCII, and 2F did sound familiar, and sure enough, hex 2F is ASCII for /. <p> Then I realized that the announcement from IBM means they're running their HTTP Server for i5/OS in internationally standard expanded ASCII. For those that have posted that the AS/400 should run on ASCII, the web server is now, and it looks like they are providing all support necessary for CGI programs to do likewise. Just saw the one page and references to new API's in V5R4, but that seems to be the gist of it. <p> So what we have here, Araman, is incoming text being converted to standard EBCDIC but the slash remaining ASCII. Holy cow. <p> Here's a page on HTTP Server for i5/OS Compatability Considerations. <p><a href="http://www-03.ibm.com/servers/eserver/iseries/software/http/product/compatibility.html">http://www-03.ibm.com/servers/eserver/iseries/software/http/product/compatibility.html</a> <p> I don't know if you're on 5 4 yet, which is what this applies to, but if possible I would recompile the program with the LOCALETYPE(*LOCALEUTF) I mentioned before. This expands on it: <BR>
<i> <BR>
As of V5R4, third party modules must be recompiled with locale object type *LOCALEUTF. This creates an environment where locale-dependent C runtime functions assume that string data is encoded in UTF-8. APR and HTTP APIs expect data in UTF-8 and will return data in UTF-8. Note that several APIs have additional functions that allow a CCSID to be set to indicate the encoding of the parameters being passed. Conversion functions between UTF-8 and EBCDIC have been added. Be sure to review APIs used by your module to be aware of current changes. <BR>
</i> <p> If you have that option in your compile, I would give it a try. Let us know what happens! :) <p> rd
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 24 2006 00:40:00
Pardon my lack of knowledge in this area. <BR>
I guess you are right. <p>Anyway, to narrow things down, I've checked the PSCSPARM. The CCSID is 37. Tried to change it to 65535 but still not successful. <BR>
Regarding recompiling the program with CCSID 37, I didn't find any parameter in the CRTSQLRPGI or CRTPGM that has CCSID mentioned to be change. (Do correct me..) <p>But the compilation log of CRTSQLRPGI mentioned : <BR>
"Source file CCSID.........37 " <BR>
"Job CCSID.................65535 " <p>and CRTPGM mentioned : <BR>
"CCSID . . . . . . . . . . . . : 37" <p>DSPFD of PSCSPARM mentioned: <BR>
"Coded character set identifier . . . . . . : CCSID 37 " <p>I'm not good at reading the hex value (never use it for troubleshooting before). Please refer to DSPPFM. <p>Any clue? Anything else I can do? <p>Thanks RD <BR>
Araman. <p><!--mccodelink_begin--> <BR>
<!-- do not remove --> <BR>
<hr width=50 align=left><small><a href='http://www.mcpressonline.com/mc/showcode@@.6b3cdbf9/14' target='_blank'>Code</a></small> <BR>
<!--mccodelink_end-->
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 23 2006 15:00:00
It's an environment situation, Araman, not particular to this program, so any similar exercise will have the same problem with this setup. I ran across this problem several years ago, which in that situation required physical files to be CCSID 037, but it was not acceptable to recompile them. That was before IBM provided for changing CCSID attribute of an object, but they had it planned at the time, and now you can. <p> But looking at the current situation, I did some Googling. The system CCSID value of 65535 is do not convert, so it's sort of agnostic about the whole thing, but under some conditions when a CCSID is determined to be used it defaults to 037, US English EBCDIC. <p> Each job and object has a CCSID. Basically we are dealing with string literals from two environments being converted incorrectly, or more probably, not being converted, before being compared. <p> The slash is not being changed to something wrong, it's not being changed at all. Get the hex value of the slash with DSPPFM and that will allow you to identify or narrow down the CCSID of the characters being presented to the program to process. <p> If a DSPPGM and DSPFD were done on your new objects, I would expect they have the system value of 65535. Normally, I would suggest recompiling the program with CCSID 037, and if that doesn't work, the CCSID of the incoming character set once you determined it from the slash hex value. The physical file CCSID of 65535 of do not convert should be fine in that it just stores whatever bits are given to it. <p> But I also see (thanks Google, you make IBM doc almost usable) that IBM has a page on the HTTP Server for i5/OS. They say: <BR>
<i> <BR>
As of V5R4 the IBM HTTP server for iSeries is now compiled in UTF-8 (CCSID 1208). You can leverage this in your CGI programs by compiling and working with UTF-8 data. <BR>
</i> <p> So perhaps trying a program CCSID 1208 would be better in that it is inline with the web server providing the data. <p> The IBM page on HTTP Server for i5/OS goes on to talk about leveraging *LOCALEUTF and new CCSID conversion API's with a compile parm of LOCALETYPE(*LOCALEUTF), but I'm not sure if applicable here. <p> rd
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 23 2006 04:14:00
Hi RD <p>Thanks for the reply. <BR>
I agree. It is something to do with the CCSID. I've experience it before. But never become familiar with it. <BR>
Yes, you are right!, I've checked the PSCSPARM. The "/" was changed into other invalid character. <BR>
I've checked the iSeries system value, it is already 65535. <BR>
Not sure about the other CCSID (compiled, batch). Do I need to do some modification on the STRCGISQL program? (Steve?) <BR>
Is it possible that the IE or the Windows settings has to do with this? I tried on many PC, still have the same result. <BR>
(eg: Keyboard) <p>Regards <BR>
Araman
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 23 2006 03:46:00
Hi Araman, <p> Well, RPG-CGI was on my agenda to learn, and this got me started. I downloaded Steven's source to my PC and took a look. Thanks Steven. <p> It appears to me Araman that there is a mismatch somewhere in CCSID, among the interactive job CCSID, compiled program CCSID, and batch job CCSID, where one of them is not 65535 or 037. I'm guessing the interactive job CCSID is set to an international set which has different hex values for special characters than 037. <p> It looks like you can determine the exact hex value being sent in for the slash by doing a DSPPFM on file PSCSPARM and changing to hex mode. The SQL statement as entered is stored in field SQLSTM. <p> I would also make a slight modification to the program and insert into '* * * SQL SYNTAX ERROR ' + %char(SQLCOD) + ' * * *' the character format of SQLCOD. For example, it may be returning 331 Character cannot be converted error, or when you tried dot notation, perhaps a syntax error code. <p> From the SQL manual, it doesn't look like SET OPTION NAMING = *SQL can be done with prepared statements to temporarily try the dot naming. But even then that just gets around one special character. Others would not convert either if the problem is conversion for special characters between different EBCDIC CCSID code sets. <p> At least that should narrow the problem down. <p> rd
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 22 2006 21:52:00
Hi Bill <p>Thanks for the reply <p>I've tried that also, "SELECT * FROM LIBRARY.FILE" <p>Still => * * * SQL SYNTAX ERROR * * * <p>But this time the "." doesn't get changed to the box character. <p>How? <p>Regards <p>Araman
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 22 2006 12:23:00
Araman wrote:<BR>
> I've typed "select * from library/file"<BR>
> It comes out "* * * SQL SYNTAX ERROR * * *"<BR>
> And the "/" comes out as a box character<BR>
> How to settle this?<BR>
<P>
Araman,<BR>
<P>
Try using the SQL syntax instead of the System syntax: Select * from <BR>
library.file<BR>
<P>
Bill <BR>
<P>
<P>
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 21 2006 23:14:00
Hi Steve <p>I've typed "select * from library/file" <BR>
It comes out "* * * SQL SYNTAX ERROR * * *" <BR>
And the "/" comes out as a box character <BR>
How to settle this? <p>thanks
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Nov 02 2006 12:03:00
Since you are getting the prompt, the HTTP configuration is probably correct. But, the executing program should return the same URL with the result. Take a look at the URL on the 'Page Cannot be Displayed' browser and see if it matches the initial URL. If not, look at the GetURL function in the program it is not rebuilding your URL correctly. A work around is to hardcode your URL (http://yourserver/cgi-bin/strcgisql.pgm) instead of using the function and recompile. <p>Also, Make sure that the authority to the PSCSPARM file is *PUBLIC *ALL <p>Good Luck.
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Oct 31 2006 16:10:00
By default when I create a directory on the IFS, <BR>
it is created under the directory structure: <BR>
/home/PEC1234/MFGPECCGI/HTML. <BR>
Programs are in library MFGPECCGI. <BR>
How does this affect the HTTP config. <BR>
Currently when I run STRCGISQL it displays the prompt screen. <BR>
When I type a 'select * from F4101' and press Enter, I get <BR>
'Page Cannot be Displayed'. <BR>
The HTTP config: <BR>
12 ScriptAlias /cgi-bin/ /QSYS.LIB/MFGPECCGI.LIB/ <BR>
13 Alias /html/ /home/PEC1234/MFGPECCGI/html/ <BR>
Any help would be appreciated.
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Oct 27 2006 12:17:00
The problem is that IBM’s SQL can not display dates out of the range of 1940 – 2039. You can see this when you run the same select statement under the STRSQL command and the dates are displayed as “++++++”. <p>The fix involves changing the FixTheNulls subroutine (new subroutine is posted below) to update the 0001-01-01 dates to 1940-01-01. Unfortunately, your output will display 1940-01-01. <p>Good Luck, <BR>
Steve <p><!--mccodelink_begin--> <BR>
<!-- do not remove --> <BR>
<hr width=50 align=left><small><a href='http://www.mcpressonline.com/mc/showcode@@.6b3cdbf9/5' target='_blank'>Code</a></small> <BR>
<!--mccodelink_end-->
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Oct 25 2006 17:04:00
Yes, I have tried Frog, WinSQL and Toad. They are all great products, but I think you still need IBM Client Access (ODBC) to connect. STRCGISQL does not.
Make DB2 Data Downloads Easy with Start CGI SQL Session (STRCGISQL) Oct 25 2006 10:42:00
I have been using FROG for the iSeries for the past year and love it. Check it out at <a href="http://www.innovativesys.net/">http://www.innovativesys.net/</a>. No web server required. No SQL required on your AS/400 and more. It is a GREAT tool and it's free.
#120087
There are too many comments to list them all here. See the forum for the full discussion.