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 

JCL needed to store the output of a query in a card

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


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Aug 11, 2005 1:49 am    Post subject: JCL needed to store the output of a query in a card Reply with quote

My requirement is that i have to execute a COBOL-DB2 program which needs the input from the run of a complex query in a card and the results of the output of the query needs to be my input dataset for the program from where my program should read data and & i am coding the JCL below ,please verify if i am correct.Morever i have to also pass the date "2005-01-01" from the JCL to the COBOL-DB2 Program.
Code:

//PROGRAM     EXEC PGM=IKJEFT01,DYNAMNBR=20                             
//SYSTSPRT    DD SYSOUT=*
//SYSPRINT    DD SYSOUT=*
//SYSABOUT    DD SYSOUT=*
//SYSOUT      DD SYSOUT=*
//INPUT       DD DSN=PROJECT.UNIT.DATA,                   
//                DISP=(,CATLG),UNIT=(SYSDA,8),                           
//                SPACE=(CYL,(10,10),RLSE),DCB=(LRECL=80,RECFM=FB)       
//SYSIN DD DSN=PROJECT.CARDS(NEWCARD),DISP=SHR
//SYSTSIN  DD *                                                     
 DSN SYSTEM(DSNP)                                                   
 RUN PROGRAM(DB2PROG) PLAN(DB2PROG) PARMS('2005-01-01/')
END                                                                 
/*                                                                   



PROJECT.CARDS(NEWCARD)
----------------------

COMPLEX DB2 QUERY

Can anybody guide me how should i go ahead with the requirement to the above said ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Aug 11, 2005 4:01 am    Post subject: Reply with quote

Quote:

My requirement is that i have to execute a COBOL-DB2 program which needs the input from the run of a complex query in a card and the results of the output of the query needs to be my input dataset for the program from where my program should read data and & i am coding the JCL below ,please verify if i am correct.


Shekar123,

There are a couple of errors in your JCL. Your JCL should have 2 steps. The first step is to unload the data by execueting your query.

Second is to use that output as input to your cobol-db2 program.

1. You had just one step that runs your program. so add the unload step.

Here is a sample unload step

Code:

//UNLOAD   EXEC PGM=IKJEFT01,DYNAMNBR=20
//SYSTSPRT DD  SYSOUT=*
//SYSTSIN  DD  *
  DSN SYSTEM(DSN)
  RUN  PROGRAM(DSNTIAUL) PLAN(DSNTIB71) PARMS('SQL') -
        LIB('DSN710.RUNLIB.LOAD')
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSREC00 DD DSN=YOUR OUTPUT FROM THE COMPLEX QUERY,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *
  your complex query here.
  ;
//*


Check this link for examples of unloading of the tables using DSNTIAUL

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/APPENDIX1.3.1?DT=20010710165542

2. You have coded disp=(,catlg) on an input dataset, which is wrong. remove that. The JCL to execuete your program should be as follows
Code:

//PROGRAM  EXEC PGM=IKJEFT01,DYNAMNBR=20                             
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//INPUT    DD DSN=PROJECT.UNIT.DATA,                   
//            DISP=SHR
//SYSTSIN  DD *                                                     
 DSN SYSTEM(DSNP)                                                   
 RUN PROGRAM(DB2PROG) PLAN(DB2PROG) PARMS('2005-01-01')
 END                                                                 
/*                   


Quote:

Morever i have to also pass the date "2005-01-01" from the JCL to the COBOL-DB2 Program.


You are already passing the date to the program ,look at your PARM in your program step. Check this link which explains the same.

http://mvsforums.com/helpboards/viewtopic.php?t=2456&highlight=parm

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
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Aug 11, 2005 7:25 am    Post subject: JCL needed to store the output of a query in a card Reply with quote

Thanks Kolusu,

I have understand you concept of trying to acheive the required results & approach and i have gone through the links provided by you which were really very very heplful.I am trying to work on those two steps given by you.Thanks & Best Regards.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Thu Aug 11, 2005 8:48 am    Post subject: Reply with quote

If your program is compiled with LE runtime modules, then you must use a slash to separate the LE runtime parameters and program parameters. Thus, with LE, your PARM will look as follows:
Code:

//SYSTSIN  DD *                                                     
 DSN SYSTEM(DSNP)                                                   
 RUN PROGRAM(DB2PROG) PLAN(DB2PROG) PARMS('2005-01-01/')
 END                                                                 
/*   


Definition in COBOL program will not change.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Thu Aug 11, 2005 8:49 am    Post subject: Reply with quote

oh!
The original poster has the slash already. I looked into Kolusu's post and the link pasted in the previous post.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Aug 17, 2005 1:50 am    Post subject: JCL NEEDED TO EXECUTE THE PROGRAM Reply with quote

I have a requirement wherin i have to do the following:

I want to pass some values to the COBOL-DB2 program which i am doing in the PARM PARAMETER,as well as pass data from the control card to the Program,as well as i want to read from the input dataset.How can i do it ? I have coded the JCL like this below.Can anybody guide me whether i am right / wrong ?

Code:

//PROGRAM  EXEC PGM=IKJEFT01,DYNAMNBR=20                             
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//INPUT    DD DSN=PROJECT.UNIT.DATA,DISP=SHR                   
//CARD     DD DSN=PROJECT.UNIT.CARDS(ABCD),DISP=SHR
//SYSTSIN  DD *                                                     
 DSN SYSTEM(DSNP)                                                   
 RUN PROGRAM(DB2PROG) PLAN(DB2PROG) PARMS('2005-08-08/')
 END                                                                 
/*     


Please also guide me how should i code in my program to accept all these conditions in my program to pass as well as read from the Parm,control card and from the input dataset ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Aug 17, 2005 8:05 am    Post subject: Reply with quote

Shekhar123,

You can pass your parms as you have shown in your JCL using the PARMS statement which can be accessed via linkage section. Also you can use SYSIN to read your CARDS job.

Code:

//PROGRAM  EXEC PGM=IKJEFT01,DYNAMNBR=20
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//INPUT    DD DSN=PROJECT.UNIT.DATA,
//            DISP=SHR
//SYSIN    DD DSN=PROJECT.UNIT.CARDS(ABCD),
//            DISP=SHR
//SYSTSIN DD *
  DSN SYSTEM(DSNP)
  RUN PROGRAM(DB2PROG) PLAN(DB2PROG) PARMS('2005-08-08/')
  END
/*


In your PGM you can simply code

Code:


01 WS-PARM-CARDS       PIC X(80).

   ACCEPT WS-PARM-CARDS     


The accept statement will read the values passed from SYSIN DD statement.

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