MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Executing SQL queries thru JCL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
mangsk
Beginner


Joined: 05 Jun 2004
Posts: 46
Topics: 18

PostPosted: Tue Sep 07, 2004 1:26 am    Post subject: Executing SQL queries thru JCL Reply with quote

Hi,
Any idea on how to execute SQL queries thru JCL? Any sample JCL would do.
I'm using the following JCL and executing the same using a utility program IKJEFT1B the source code of which I can't browse.
Code:
//STEP02   EXEC PGM=IKJEFT1B,DYNAMNBR=128,COND=(4,LT)         
 //*                                                           
 //STEPLIB  DD DSN=SYS2.GLSLIB,DISP=SHR                       
 //SYSPRINT DD DSN=GLS43D.GLSRPT.SELECT.COUNT,                 
 //            DISP=SHR                                       
 //            DISP=(NEW,CATLG,DELETE),                       
 //           DCB=(LRECL=155,RECFM=FB,BLKSIZE=0),             
 //           SPACE=(CYL,(10,5),RLSE)                         
 //SYSPUNCH DD DUMMY                                           
 //SYSTSPRT DD SYSOUT=*                                       
 //SYSUDUMP DD SYSOUT=*                                       
 //*                                                           
 //SYSTSIN  DD *                                               
  DSN SYSTEM(DSN)                                             
  RUN  PROGRAM(DSNTEP2) PLAN(DSNTEP2) -                       
       LIB('DBR000D.DB2DBA.LOAD')                             
  END                                                         
 //*                                                           
 //SYSIN   DD DSN=GLS44D.TEST.GLS.INCORE.NEW(GLSRPTA2),DISP=SHR
The control card GLSRPTA2 contains all SQL queries in the same way as we give in SPUFI.The SYSPRINT DSN contains result of the queries.
Now the prob I'm facing here is even though i create SYSPRINT DSN of LRECL =155, it gets created as 133 FB. Shocked We're not passsing any parameter to the program.
Any idea why is it doing so?
Thanks in advance.
_________________
Regards,
Mangsk
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Sep 07, 2004 5:02 am    Post subject: Reply with quote

mangsk,

The default output file LRECL of DSNTEP2 is 133. You CANNOT override that. Instead you can DSNUTILB which is a sample unload utility. Check this link for a detailed explanation of the utility

http://www.mvsforums.com/helpboards/viewtopic.php?t=640&highlight=unload

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mangsk
Beginner


Joined: 05 Jun 2004
Posts: 46
Topics: 18

PostPosted: Tue Sep 07, 2004 5:56 am    Post subject: Reply with quote

Thanks Kolusu.
Now the question here is about using DSNTIAUL. In this utility,can we have more than 1 SQL statements in SYSIN data and get the output in only one output file?
The examples on this page show 2-3 SQL statements and their outputs will go into 2-3 different files.
Embarassed
Thanks!
_________________
Regards,
Mangsk
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Sep 07, 2004 8:25 am    Post subject: Reply with quote

Mangsk,

Yes the output of each sql statement is sent to a seperate dataset. If you want it in a single file , then you need to pre-allocate the output dataset and code DISP=MOD in the unload step. However make sure that your output file has the maximum lrecl from all your queries.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group