Run SQL Statements Without SQL/400

SQL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Our corporate system is a D60 AS/400 with QUERY/400, RPG/400, SQL/400 and other licensed programs installed. At other company sites in town, we have two C04s, a B10 and a C10. These smaller boxes are used for an Incentive Payroll and Production Tracking system. Although these machines are loaded with QUERY/400, none have RPG/400 or SQL/400.

I constantly use interactive SQL for debugging and for general query of database files. When signed on to the small systems without SQL/400, I wanted the ability to access files with the same methods. 1 contains a CL program to accomplish this. Since Query Management is used, you do not need SQL/400. The program does require SEU during execution. As of V2R3, SEU is available as a separate licensed program.

I constantly use interactive SQL for debugging and for general query of database files. When signed on to the small systems without SQL/400, I wanted the ability to access files with the same methods. Figure 1 contains a CL program to accomplish this. Since Query Management is used, you do not need SQL/400. The program does require SEU during execution. As of V2R3, SEU is available as a separate licensed program.

The program, as coded, probably falls far short of perfection. Error handling and other bells and whistles can be added.


Run SQL Statements Without SQL/400

Figure 1 CL Program SQL002CL

 /*===============================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/SQL002CL) SRCFILE(XXX/QCLSRC) */ /* */ /*===============================================================*/ PGM DCL VAR(&NBRRECS) TYPE(*DEC) LEN(10) VALUE(0) CRTSRCPF FILE(QTEMP/QQMQRYSRC) TEXT('Temporary query management + source file') ADDPFM FILE(QTEMP/QQMQRYSRC) MBR(TMPSQL) TEXT('Temporary query + management source member') STRSEU SRCFILE(QTEMP/QQMQRYSRC) SRCMBR(TMPSQL) TYPE(QMQRY) + OPTION(2) RTVMBRD FILE(QTEMP/QQMQRYSRC) MBR(TMPSQL) NBRCURRCD(&NBRRECS) IF COND(&NBRRECS > 0) THEN(DO) CRTQMQRY QMQRY(QTEMP/TMPSQL) SRCFILE(QTEMP/QQMQRYSRC) ? STRQMQRY QMQRY(QTEMP/TMPSQL) DLTQMQRY QMQRY(QTEMP/TMPSQL) ENDDO RMVM FILE(QTEMP/QQMQRYSRC) MBR(TMPSQL) DLTF FILE(QTEMP/QQMQRYSRC) ENDPGM 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: