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

execute SQL in JCL


IBM Mainframe Forums -> Compuware & Other Tools
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jayanta_nit

New User


Joined: 13 Apr 2006
Posts: 22
Location: hyderabad

PostPosted: Mon May 01, 2006 9:48 pm
Reply with quote

hi, can anyone tell me how i can execute an SQL statement through JCL directly?mean i will write query in jcl and i want the output of that query.
............jayanta kr. mondal
Hyderabad.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon May 01, 2006 11:36 pm
Reply with quote

jayanta_nit,

Code:

//UPDATE  EXEC PGM=IKJEFT1B,REGION=4096K             
//STEPLIB  DD  DSN=Your.DB2.Loadlib,DISP=SHR           
//SYSTSPRT DD  SYSOUT=*                             
//SYSPRINT DD  SYSOUT=*                             
//SYSUDUMP DD  SYSOUT=*                             
//SYSTSIN  DD  *                                     
 DSN SYSTEM(????)                                   
 RUN  PROGRAM(DSNTEP2)                               
 END                                                 
/*                                                   
//SYSIN   DD *
  SELECT COUNT(*)
    FROM DB2.YOUR_TABLE
  ;
/*
//


Dave
Back to top
View user's profile Send private message
swayam

New User


Joined: 30 Apr 2006
Posts: 1

PostPosted: Wed May 03, 2006 8:37 pm
Reply with quote

WORKING-STORAGE.
01 WS-SQL.
02 WS-LEN PIC S9(4) COMP VALUE +120.
02 WS-SQL-STMT PIC X(120).
PROCEDURE DIVISION.
ACCEPT WS-SQL-STMT.
EXEC SQL
EXECUTE IMMEDIATE :WS-SQL-STMT
END-EXEC
STOP RUN.

JCL coding convention
//GO.SYSIN *
write SQL stmt here
/*
u can also use prepare and exeute for the same.
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 -> Compuware & Other Tools

 


Similar Topics
Topic Forum Replies
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Fetch data from programs execute (dat... DB2 3
This topic is locked: you cannot edit posts or make replies. How To Write, Compile and Execute Cob... COBOL Programming 5
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
No new posts Execute REXX on logon with ISPF CLIST & REXX 3
Search our Forums:

Back to Top