|
View previous topic :: View next topic
|
| Author |
Message |
raak
Active User

Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
I have an SQL query and I want to run it using JCL..
I dont want to write a cobol program and then use a JCL to execute that..
Can a simple JCL submit a query??
The idea is to submit the query so that it should run in the background. Is there any way out??? |
|
| Back to top |
|
 |
dinucpaul
New User
Joined: 11 Jan 2008 Posts: 3 Location: Bangalore
|
|
|
|
yes , you can do it using DSNTEP2 pgm in your JCL. plz find the exp
//STEP01 EXEC DB2CPROC,
// DB2SYS=Db2n
//SYSTSIN DD *
RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2)
END
/*
//SYSIN DD *
select * from table1 |
|
| Back to top |
|
 |
raak
Active User

Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
what is this DB2PROC and DSNTEP2.
I am getting a JEM message as " procedure DB2PROC not found".
Is that shop specific?? |
|
| Back to top |
|
 |
raak
Active User

Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
I tried to use the Unload utility to do this.
But my SQL contains a JOIN and the the columns are given as Tablename.column in the SELECT statement.
So the Unload JCL is abending saying that "." symbol is invalid.
Is there any other way I can do it?? |
|
| Back to top |
|
 |
stodolas
Active Member

Joined: 13 Jun 2007 Posts: 631 Location: Wisconsin
|
|
|
|
| There is a simple way to do this from a JCL step. I'll post it when I get to work and get on a system. |
|
| Back to top |
|
 |
raak
Active User

Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
k stodolas... waiting 4 it.....  |
|
| Back to top |
|
 |
stodolas
Active Member

Joined: 13 Jun 2007 Posts: 631 Location: Wisconsin
|
|
|
|
| Code: |
//JS02 EXEC DSNTEP2,DB2=DB2T,COND=(4,LT)
//DYNSQL.SYSPRINT DD SYSOUT=*
//SYSIN DD *
INSERT INTO OWNER.TABLE (COL1, COL2)
SELECT MAX(COLA), COLB
FROM OWNER.TABLE2
GROUP BY COLB;
COMMIT;
/*
|
|
|
| Back to top |
|
 |
|
|