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

Can i execute a select querry in JCL?


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

New User


Joined: 01 Feb 2008
Posts: 22
Location: chennai

PostPosted: Thu Aug 14, 2008 7:40 pm
Reply with quote

My requirement is, i need to get a value from a DB2 table, and fetched value i need to pass to next steps in jcl.

i.e. select A into :&DSN1 from Table1 S where S.B='2' ;
can we execute above query in JCL?
If any one knows how to execute please guide me.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Aug 14, 2008 11:54 pm
Reply with quote

Hello,

You can run SPUFI in batch. . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 15, 2008 11:16 am
Reply with quote

you could also do an unload with the select query.
Back to top
View user's profile Send private message
vch

New User


Joined: 01 Feb 2008
Posts: 22
Location: chennai

PostPosted: Fri Aug 15, 2008 12:15 pm
Reply with quote

i can do unload but..unloaded data is available in output file. but my doubt is can i put this data in JCL parmarameters..inorder to use that in next steps...
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Fri Aug 15, 2008 12:37 pm
Reply with quote

?? The output of a certain step can be the input of the next step.

Billions of time that happens in IT !!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 15, 2008 7:28 pm
Reply with quote

Hello,

Quote:
but my doubt is can i put this data in JCL parmarameters..inorder to use that in next steps...
Have you tried this?

Did you encounter some problem?
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Sat Aug 16, 2008 12:46 am
Reply with quote

If you need the value passed as PARM= on a following EXEC card, you're out of luck.

Can you convert the pgm to read a file passed from SPUFI step?
Back to top
View user's profile Send private message
satyender

New User


Joined: 05 Jan 2008
Posts: 50
Location: Olympia, WA, USA

PostPosted: Sat Aug 16, 2008 10:25 pm
Reply with quote

The other day i too was looking similar like this only about instering rows using jcl, herein the jcl i wrote thru which we can execute the SQL statements.


//STEPDE01 EXEC PGM=IEFBR14
//SYSPUNCH DD DSN=T0J0AJ7.ALTER.SYSPUNCH,
// DISP=(MOD,DELETE,DELETE),
// SPACE=(TRK,(1,1),RLSE)
//SYSREC00 DD DSN=T0J0AJ7.ALTER.SYSREC,
// DISP=(MOD,DELETE,DELETE),
// SPACE=(TRK,(1,1),RLSE)
//*
//*---------------------------------------------------------------*
//STEPAL01 EXEC PGM=IKJEFT01
//PRINTS INCLUDE MEMBER=CEEDUMP
//SYSPUNCH DD DSN=T0J0AJ7.ALTER.SYSPUNCH,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(5,1),RLSE)
//SYSREC00 DD DSN=T0J0AJ7.ALTER.SYSREC,
// DISP=(NEW,CATLG,DELETE),
// UNIT=(SYSDA,9),
// SPACE=(CYL,(50,10),RLSE)
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DSN=PROD.CNTRLIB(PDB2),DISP=SHR
// DD DSN=PROD.CNTRLIB(DSNTISQL),DISP=SHR
//*SYSTSIN DD DSN=PROD.CNTRLIB(&DB2RGN),DISP=SHR
//* DD DSN=PROD.CNTRLIB(DSNTISQL),DISP=SHR
//SYSIN DD DSN=T0J0AJ7.ALTER.INDEX.TLCS005(ALTER),DISP=SHR


In the SYSIN control card use your dataset and the member in which the SQL query should be written.
In the SYSTSIN card use the statements like this changing the subsystem parameters according to your shop.

first dataser:

DSN SYSTEM (PDB2) RETRY(120)
DD DSN=PROD.CNTRLIB(DSNTISQL),DISP=SHR

second dataset
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARMS('SQL')
END


Hope this helps you.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Aug 18, 2008 11:28 am
Reply with quote

Hi vch,

Probably you got the answer, however, I think there are some similar threads in the forum which can be helpful -

www.ibmmainframes.com/viewtopic.php?t=23249&highlight=ikjeft01
www.ibmmainframes.com/viewtopic.php?t=27071&highlight=ikjeft01

You can read more about the sample programs in the fine manual.
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 Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Dynamically pass table name to a sele... DB2 2
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 SELECT from data change table DB2 5
Search our Forums:

Back to Top