105 pts.
 Need help executing MULTIPLE SQL extracts from a JCL
GREYBEARD52: Thanks again for the info, BUT I'm not sure if a CL command can be used with a JCL. Can it? ALSO, my JCL uses the SELECT command, so it appears that the RUNSQLSTM command won't help - it doesn't support SELECT. Are there ANY OTHER ALTERNATIVES or a way to tweek this command to 1. Run in an JCL and 2. Execute SQL SELECT statements. FYI. My SQL statements are performing DB extracts with JOINs. Can ANYONE offer assistance?

Software/Hardware used:
ASKED: June 3, 2008  6:57 PM
UPDATED: January 27, 2010  4:14 PM

Answer Wiki:
Sorry, I wasn't reading closely. RUNSQLSTM is not a JCL command, I was thinking CL. --------- JCL & SQL & DB2 - are we talking MVS? To exec dynamic DB2 SQL statements in a batch job (JCL); try using DSNTEP2 : <pre> 001720 //** 001800 //STEP1 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=EVEN 001810 //SYSPRINT DD SYSOUT=* 001900 //SYSTSPRT DD SYSOUT=* 002000 //SYSTSIN DD * 002100 DSN SYSTEM(DSNT) 002200 RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) LIB('DB22.RUNLIB.LOAD') 002300 END 002310 /* 002320 //SYSIN DD DISP=SHR,DSN=DB2T.CMN.SPUFIIN(WORK) 002400 //**//SYSIN DD * 002410 //** SELECT * FROM ISPDBA.SUBSYS; 002510 //** </pre> Note how SYSIN which is the SQL statements can be a dataset or in line. At your installation, DSNTEP2 might have a different PLANNAME (e.g. DSNTEP81 or DSNTEP91) and most definately will come from a different library. Steve
Last Wiki Answer Submitted:  January 27, 2010  4:14 pm  by  graybeard52   3,115 pts.
All Answer Wiki Contributors:  graybeard52   3,115 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _