You are on page 1of 3

 

Figure 19: Here's an example of syntax error.

Note the syntax error: The nal semicolon (;) is not supported.

The classic error message shown in Figure 20 is followed by the explanation in Figure 21.

Figure 20: Yes, continue!

Figure 21: Excel shows the syntax error.

These constraints should encourage you to prepare your application analysis in batch at night
and leave the bare minimum SQL in Excel.

But the night batch, with an output le, brings a new constraint: The recursive SQL is a powerful
tool based on the common table expression (CTE). But the use of CTE is prohibited in a CREATE
AS (SELECT clause) or in an INSERT INTO (SELECT clause). That forbids us from using most
tools capable of executing SQL statements here because we want an output le. The only native
tools capable of providing output to a le without going through the SQL clauses CREATE AS or
INSERT INTO are STRSQL in interactive and STRQMQRY in batch mode.

 
For example, let's consider the SQL Called to Caller. The QMQRY for the caller list and the called
list is available in my toolbox at http://jplamontre.free.fr/jpltools.htm#Index. Follow "The savf
with all the sources." Compile with CRTQMQRY:

CRTQMQRY QMQRY(JPLTOOLS/ANZAPCALED) SRCFILE(JPLTOOLS/JPLTOOLS)

Then run it:

STRQMQRY QMQRY(JPLTOOLS/ANZAPCALED) OUTPUT(*OUTFILE)


OUTFILE(JPLTOOLS/CALLEDPGM)
NAMING(*SQL)

Then, in Excel, just do this:

Select * from jpltools.calledpgm

Figure 22: The simpli ed SQL goes into Excel.

Presentation is improved. The line order is correct, the called object appears only when changed,
and the caller is indented depending on level of deepness.

Note: To be able to use QMQRY with *SQL naming, I had to explicitly qualify the name of the *FILE
object. It works. I have found the parameter RDB(*NONE) to specify "use the local database" but
nothing to specify "use the current schema."

You now have a complete overview of the opportunities available to you, ranging from the need
for response time, which encourages us to prepare the analysis by night, and the need for
exibility, which encourages us to do analysis at the last minute. In our case, knowing that
DSPPGMREF is much more e cient when analyzing a library rather than one program at a time,
analysis is needed by night.

You have seen how—from system commands DSPOBJD, DSPPGMREF, and DSPFD—it is possible
to draw an accurate picture of an application.

In these two articles of this series, you also noticed that some information that could have been
provided by DSPPGM remains missing because DSPPGM does not offer OUTPUT (*FILE). In the
third article, you will nd a program, based on several APIs, that can ll the gap.

Jean-Paul Lamontre
Email
Jean-Paul Lamontre has been working on IBM machines since 1976. His rst
was a 3/15 with 128K RAM (the biggest machine of the county). His rst
program was an RPG program, no more than 15 lines. It never compiled, and
nobody ever understood why.

Currently, Jean-Paul divides has work time between two companies.

For Cilasoft, which offers the Cilasoft Audit and Security suite, he is the director of development.
The Cilasoft suite is a cornerstore to any company's compliance process.

For Resolution, which offers Xcase, a database engineering suite, he is the CTO of the IBM i
department. Xcase allows developers to modernize a DDS database to DDL, discover and
implement implicit relationships, and manage SQL databases using an advanced GUI.

Jean-Paul also publishes some free tools on his personal Web site. Most popular are SQL2XLS,
SPLF2PDF, and MAIL.
ALSO ON MC PRESS ONLINE

2 years ago • 2 comments 4 months ago • 4 comments 9 months ago


SQL 101: Killing TechTip: Top 3 SQL 10
Open Query File Reasons to Definiti
… Avoid … Langua

0 Comments MC Press Online 🔒 


1 Login

 Recommend t Tweet f Share Sort by Newest

Start the discussion…

LOG IN WITH
OR SIGN UP WITH DISQUS ?

Name

Be the first to comment.

✉ Subscribe d Add Disqus to your siteAdd DisqusAdd


⚠ Do Not Sell My Data
BLOG COMMENTS POWERED BY DISQUS

You might also like