Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can i execute a select querry in JCL?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Can i execute a select querry in JCL?
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

Site Director


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

PostPosted: Thu Aug 14, 2008 11:54 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Fri Aug 15, 2008 11:16 am    Post subject:
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    Post subject:
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: 456
Location: Belgium

PostPosted: Fri Aug 15, 2008 12:37 pm    Post subject:
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

Site Director


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

PostPosted: Fri Aug 15, 2008 7:28 pm    Post subject:
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    Post subject:
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    Post subject: Herein is the JCL to execute the SQL statements
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

Senior Member


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

PostPosted: Mon Aug 18, 2008 11:28 am    Post subject:
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 -

http://www.ibmmainframes.com/viewtopic.php?t=23249&highlight=ikjeft01
http://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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts execute APP if they are not ADDRESS T... italo_pm CLIST & REXX 3 Fri Aug 12, 2016 2:15 am
No new posts Execute multiple DB2 Load commands in... faizm DB2 4 Wed Aug 03, 2016 12:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us