Can anyone let me know how to code multiple queries in one JCL. I want the output of all queries in one file.
I have codded below JCL that is working only for one query. It is not giving the output for other queries..
____________________
//STEP01 EXEC PGM=IKJEFT01,DYNAMNBR=20
//STEPLIB DD DSN=TSYS.DSNLOAD,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSOUT DD *
//SYSPRINT DD SYSOUT=*
//SYSREC00 DD DSN=T0515PJ.DB2.ADDCDB2P.DAPPLID,
// DISP=(NEW,KEEP,KEEP),
// DCB=(RECFM=FBA,LRECL=133),
// UNIT=DISK,SPACE=(CYL,(5,5),RLSE)
//SYSPUNCH DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(GRT1)
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) -
PARM('SQL') -
LIB('DB2P.RUNLIB.LOAD')
END
//SYSIN DD *
MY QUERY 1; -----> Giving output for this
MY QUERY 2;-------> Not giving Output for this and other query below this
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Poonam Jain,
This is what I found in the DB2 Utilities manual here.
Quote:
SYSRECnn
Output data sets. The value nn ranges from 00 to 99. You can have a maximum of 100 output data sets for a single execution of DSNTIAUL.Each data set contains the data that is unloaded when DSNTIAUL processes a SELECT statement from the input data set. Therefore, the number of output data sets must match the number of SELECT statements (if you specify parameter SQL) or table specifications in your input data set.
You'll have to use multiple output datasets as SYSREC00,SYSREC01, etc in the same step corresponding to each SELECT statement in your SYSIN card.
Thnx all, Now it is working. I have codded JCL as below. May be it will help other.
Note : LRECL should be max ( and same every where ) depending on the query which is givning highest output record.
e. g
Query 1 -- 80
Query2 -- 133 --> use this one everywhere
query 3-- 80
-----------------------------------------------------------------------