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
 

 

Batch SQL ececution with File input

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Batch SQL ececution with File input
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

Site Director


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

PostPosted: Sun Mar 04, 2007 10:37 am    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Sun Mar 04, 2007 11:50 am    Post subject: Re: Batch SQL ececution with File input
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    Post subject: Re: Batch SQL ececution with File input
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: 1452
Location: Chicago, IL

PostPosted: Sun Mar 04, 2007 12:31 pm    Post subject: Re: Batch SQL ececution with File input
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

Site Director


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

PostPosted: Mon Mar 05, 2007 2:46 am    Post subject:
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    Post subject:
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    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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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