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

Batch SQL ececution with File input


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

New User


Joined: 12 Aug 2005
Posts: 53
Location: USA

PostPosted: Sun Mar 04, 2007 9:47 am
Reply with quote

Hi

Here is my requirement..

i have some set of SSN numbers in the i/p files and i want to delete all the records from the production table for those SSN. is there any way to do that thru Batch JCL? please help me out on this. and this is urgent.
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: Sun Mar 04, 2007 10:37 am
Reply with quote

Hello,

It is about a 10 minute program. . .

Read "the file"
Delete from table where the ssns are equal.

Very small bit of code icon_smile.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sun Mar 04, 2007 11:50 am
Reply with quote

Quote:
Is there any way to do that thru Batch JCL?

Yes. Execute an SQL Query deleting records for the specific condition thru a Batch JCL Step.
Back to top
View user's profile Send private message
ykishore

New User


Joined: 12 Aug 2005
Posts: 53
Location: USA

PostPosted: Sun Mar 04, 2007 12:19 pm
Reply with quote

Hi

Thanks for info!! But i want to get do it thru JCL? pls let me know ..
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sun Mar 04, 2007 12:31 pm
Reply with quote

Quote:
Thanks for info!! But i want to get do it thru JCL?

What else did I talk about above ??? icon_mad.gif

Go thru this link that tells you executing SQL Queries in a Batch Job.
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: Mon Mar 05, 2007 2:46 am
Reply with quote

Hello,

If you want to solve your requirement quickly (by your post this was "urgent"), do the simple thing - not wait for "what you want".

If you just want to find (wait for) a particular solution, it cannot be urgent. That urgency is artificial. Urgency would not include multiple days looking for a solution.

If you wanted another type of jcl fix you could always close and backup the databasae, unload the table, match the ssn file with the employee file using sort and eliminate the "matches" from the output file. Then, reload the employee table. That would need no DB2 query and no program - not a very good choice (IMHO) but does do the task "thru JCL". Of course a major drawback of that solution is that the deletes would not be recorded in the DB2 logs.

Have the ssns been deleted?
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Tue Mar 06, 2007 3:42 pm
Reply with quote

How many SSN's are there by the way...? If they are pretty less, you could write the SQL query to delete all records in a single query or an indivual query which ever is easy for you and execute it in SPUFI.

Thanks for info!! But i want to get do it thru JCL?

If you want that to happen through JCL, code the queries and execute it using one of the productivity aid sample programs like DSNTIAUL, DSNTEP2 or DSNTIAD etc. You could find multiple ways to execute the SQL dynamically. Let me know if this did not help you..!
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 2
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top