By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
If you use STRSQL to develop and run SQL statements, you can save all SQL commands that you ran in a source file, and run them again. Press F13 in the interactive SQL session, option 4 allows you to save the session to a file.
You can reapply the SQL statements with the RUNSQLSTM command. You must have one (1) statement per member to run this command, so some editing of the original saved session is imminent.
Alternately, save the session as a REXX source member, add some REXX statements (see sample code), and use STRREXPRC to execute.
/* Example of running multiple SQL statements from a REXX script */ /* The "ADDRESS EXECSQL" line signals that these are SQL statements and not AS400 commands */ /* All SQL statements start with "EXECSQL" */ /* Use comma to indicate multiple line statements */ ADDRESS EXECSQL 'EXECSQL delete from cmf where cfcset=88 ' 'EXECSQL ', 'INSERT INTO V604MMF/CMF SELECT CFID, CFPROD, CFFAC, 88 , CFCBKT, ', 'CFTLVL, CFPLVL FROM cmf WHERE cfcset=02' 'EXECSQL ', 'CREATE TABLE QTEMP/QCPYDLMHDR (QLINE CHAR (32766) NOT NULL WITH ' , 'DEFAULT) ' 'EXECSQL ', 'DROP TABLE QTEMP/QCPYDLMHDR CASCADE' 'EXECSQL ', 'INSERT INTO V604MMF/QTR (TRID, TRLOT, TRPROD, TRMFGR, TRQTY, ', 'TRCNTR, TRRDTE, TRSTAT, TRTIME, TRFAC, TRSHOP) SELECT ''TR'', LLOT, ', 'LPROD, LNMFGR, LRCPT+ LADJT- LISS, LNCNTR, LRDT, LMRB, LNLRTM, ''F3'' ', ', LMSC FROM ilnl01 WHERE lprod=''XYZ0007'' ' 'EXECSQL ', 'UPDATE MEDBPCSF/ITHC SET TCID = ''TH'' ' 'EXECSQL ', 'DELETE FROM FSO WHERE srdte < 19990101 '
- Shalom wrote: You must have one (1) statement per member to run this command, so some editing of the original saved session is required. This is incorrect. Multiple SQL statements can be run in a member just end each statement with a ";". Now you really have the power. —David R. Hoodenpyle