IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Executing SQL Query Through JCL.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
subdalal

New User


Joined: 27 Sep 2010
Posts: 21
Location: Boudh

PostPosted: Fri Jun 06, 2014 4:04 pm
Reply with quote

RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) ---> The o/p gets printed in SYSPRINT.
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARMS('SQL') ---> The o/p can be moved to a PS file. need to give the PS file name in DD name SYSREC00


For moving the output to a PS File:

//JOBCARD
//PS000 EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//SYSREC00 DD DSN=<PSFile_Name>,
// DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSPUNCH DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(<System_Name>)
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARMS('SQL')
/*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
<SQL Query>
/*


To have the output in Sysprint:

//JOBCARD
//PS000 EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSPUNCH DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(<System_Name>)
RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2)
LIB (<Library_Name>)
END
/*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
<SQL Query>
/*
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Jun 06, 2014 4:47 pm
Reply with quote

Are you giving a sample or stating a problem?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Jun 06, 2014 5:32 pm
Reply with quote

they look like hints ...

but ...

- use the code tags to make the code snippets more readable

- and ...
since You want to look like an expert refrain from using invalid terminology

You do not run a query thru jcl ...
jcl is just the weird language used to in tell the system to run some program

so You might be better off talking about ...

DB2/SQL utilities that can be used to execute a query without having to write a program

and show the JCL used to invoke that utility
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue Jun 10, 2014 8:03 pm
Reply with quote

But , What is the issue here or is it just a fyi? icon_confused.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts executing XCTL command in COBOL witho... CICS 10
Search our Forums:

Back to Top