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
LATEST COMMENTS
MC Press Online