View previous topic :: View next topic
|
Author |
Message |
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
Hello!
I have a PS file in which 'N' number of queries can be written. The layout of the file is this:
Code: |
update
TABLE-NAME1
set
COL-NAME1 = NEW VALUE1
where
PREDICATES1
update
TABLE-NAME2
set
COL-NAME2 = NEW VALUE2
where
PREDICATES2 |
I need to run all these queries through set of JCLs and COBOL modules. I can use set of JCL and COBOL programs only but not run through SPUFI.
Can you please suggest the approach. Please help.
MY APPROACH:
Step 1: Splitting the file into N files, with each file containing one query.
Step 2 : Using each split files content as instream data to run a JCL.
Please suggest any alternative approach if u can think of. |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
Can I use a dynamic query?
Foe examople, i read the file and extract one query
therafter i simple run the query dynamically?
Can that be done? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
One way to get what you want is to red this "query" file and generate the JCL and other control statements to run the query in batch. Then SUBMIT each new query job thru the Internal Reader. |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
Thanks Dick!
But I read in this forum itself that it is not recommended to run a job through COBOL.
In any case,can you please share some documnet as to how to achive this technically. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
nikhil_bansal04 wrote: |
I need to run all these queries through set of JCLs and COBOL modules. I can use set of JCL and COBOL programs only but not run through SPUFI. |
If the queries are already in a file just ISPF cut/paste should suffice you to copy them to a COBOL program, no?
Second, if the file gets updates everyday ( basically you don't have control on the contents of it) but you're sure they will always be DB2 queris and nothing; probably you can define your file as a copybook member and copy that copy in your program? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
what's wrong with DSNTIAD ?
DB2 for z/OS Utility Guide and Reference wrote: |
Use the DSNTIAD program to execute SQL statements other than SELECT statements dynamically. |
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
well ... the buzzword is COBOL,
even if I do not understand the topic at all
if the COBOL program is an existing one... it should be modified to suit the requirement
if it does not exist...
the requirement should be reviewed to check if an already available/existing solution/program/utility can be used |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
hello everyone,
the problem is in extracting one query at a time from the ps file and executing it.
Is there a way in which we can run multiple queries present in PS file via a JCL or COBOL module? means i get an input file with N queries which i want to execute... |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Quote: |
DSNTIAD Input data set. In this data set, you can enter any number of non-SELECT SQL statements, each terminated with a semicolon. A statement can span multiple lines, but DSNTIAD reads only the first 72 bytes of each line. |
|
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
Thanks a lot GuyC. DSNTIAD is reaaly helpful but
Is there any way i can run multiple Non-selects which span more than 72 characters? |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
THANKS A LOT GUYS for your help.
this is what i will be doing:
using dsntiad utility to execute multiple non-selects as instream data!
Have a great day! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Quote: |
Thanks Dick!
But I read in this forum itself that it is not recommended to run a job through COBOL.
In any case,can you please share some documnet as to how to achive this technically. |
You're welcome
I do believe i'd use GuyC's suggestion over mine.
However - where is it posted that it is not recommended to run a job thru COBOL? I believe there is some misunderstanding here that can be improved. |
|
Back to top |
|
|
|