Need help executing MULTIPLE SQL extracts from a JCL

105 pts.
Tags:
IBM DB2
JCL
SELECT statement
SQL
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?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following