Reconcilations script between Source and Target


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reconcilations script between Source and Target
# 1  
Old 05-13-2014
Reconcilations script between Source and Target

Hi,

I am new to DB2 and in need of urgent help.
Here we have about 100 queries (SQL) that have been manually executed to retrieve totals from different tables
and post it to Excel spreadsheet. Is there any way I can create a shell script as a wrapper and execute
these queries and create a report in excel ? Any help is appreciated.

Here are some sample queries that I would like to use in unix script:

Code:
 
SELECT MSR_PRD_ID , COUNT(*) COUNT, SUM(SHDW_BAL) SHDW_BAL 
FROM RDR.AR_TVR_PRFL WHERE SRC_STM_ID=7 GROUP BY MSR_PRD_ID
 
SELECT count(*), a.src_stm_id, SUM(SHD_AMT) SUM_SHD_AMT FROM 
RDR.AR_AVY_SCHD A, RDR.AR B WHERE a.src_stm_id=7 and
A.AR_ID=B.AR_ID
AND AR_LCS_TP_ID<>(select cl_id from rdr.cl where src_stm_id=7 and cl_code = 'PURGED')
group by a.src_stm_id;
 
SELECT MSR_PRD_ID, SUM(COFF_AMT) SUM_COFF_AMT,COUNT(*) COUNT 
FROM RDR.AR_DLQ_PRFL WHERE SRC_STM_ID=7 GROUP BY MSR_PRD_ID

Thanks in advance

Last edited by Scrutinizer; 05-13-2014 at 07:33 AM.. Reason: icode -> code tags
# 2  
Old 05-13-2014
You can use db2 command line processor to connect to database and execute queries.
Search for similar threads with in the forums e.g. This
# 3  
Old 05-13-2014
Hi

Thanks for reply

But my main concern is i have generate my report in the excel sheet like below format
i am not getting any idea how to place data in cell wise

Code:
 
SOURCE ROW COUNT TARGET ROW COUNT
AAA 100 cdc 100
BBB 20 xxx 20
CCC 1012 ds 1012

i have to insert the data in the cell wise

Last edited by Scrutinizer; 05-13-2014 at 10:27 AM.. Reason: change ICODE tags to CODE tags
# 4  
Old 05-13-2014
What does your input data look like?
# 5  
Old 05-14-2014
hi

in the defining the all to queries to variables finally i have to place the result in to respective cells

here main point how can i place data in to excel sheet cell


Thanks in advance
# 6  
Old 05-14-2014
Excel can read many forms of text natively, little to no conversion is needed. Just make sure the lines end in a carriage-return and linefeed, and have consistent delimiters. Tabs work well.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Move multiple files 4rm Source to different target folders based on a series num in the file content

Dear Experts my scenario is as follows... I have one source folder "Source" and 2 target folders "Target_123456" & "Target_789101". I have 2 series of files. 123456 series and 789101 series. Each series has got 3 types of fiels "Debit", "Refund", "Claims". All files are getting... (17 Replies)
Discussion started by: phani333
17 Replies

2. UNIX for Dummies Questions & Answers

How to count number files successfully copied from source to target location?

Hi Guys, how to count number of files successfully copied while coping files from source to destination path ex:10 files from source to target location copying if 8 files copied successfully then echo successfully copied=8 failure=2 files if two files get error to coping files... (2 Replies)
Discussion started by: sravanreddy
2 Replies

3. Post Here to Contact Site Administrators and Moderators

How to count successfully copy files source to target location with check directory in Linux?

Hi guys...please any one help me .... how to copy files from source to target location if 5 files copied successfully out of 10 files then implement success=10 and if remaining 5 files not copied successfully then count error=5 how to implement this condition with in loop i need code linux... (0 Replies)
Discussion started by: sravanreddy
0 Replies

4. Shell Programming and Scripting

Connect to target host from Source host.

Hi All, Need to connect to target host and execute a command and connect back to source host to continue with next set of command execution. Is there a utility/command using which we can connect to target host ? Please suggest. Note: Netezza database is instaled on Linux server. ... (4 Replies)
Discussion started by: Nagaraja Akkiva
4 Replies

5. HP-UX

After adding new iscsi target port, still the session state of that target port is showing offline

Hi, I wanted to configure new iscsi port on HPUX system, i added the target port address and configured it, once done, went to array side and searched for that host iqn number , but was nt able to find the same, came to host, then when i ran "iscsiutil -pVS" command it gave me below result ... (0 Replies)
Discussion started by: Vinay Kumar D
0 Replies

6. UNIX for Advanced & Expert Users

sudo needs to source target user's .shrc

I'm configuring a sudo Runas_Alias in the sudoers file on a hp-ux 11.31 system. The goal is to allow some hp-ux accounts to sudo to a service account and run commands as that user. Here's the related sudoers entries: User_Alias DMSTAFF = %dmstaff Runas_Alias DMALIAS = dmadmin DMSTAFF ... (2 Replies)
Discussion started by: mp5802
2 Replies

7. Shell Programming and Scripting

Shell script to transfer the files from source to target server.

I need to write a shell script to transfer the files every hour from source - target server. The cron job should be running every hour and shouldn't copy already copied files to the remote server ? I was able to write intial script but not able to get the logic for (in the next run it should... (12 Replies)
Discussion started by: radhirk
12 Replies

8. Shell Programming and Scripting

Source and Target count checking

Hi My source database is seibel and the target is oracle. I need to check the count for source query and target query. if it is equal then i need to send and success mail to an email id. If it is not equal need to send an failure mail to an email id. pl let me know about the script in ksh. ... (2 Replies)
Discussion started by: ksmbabu
2 Replies

9. UNIX for Dummies Questions & Answers

vi, c/source/target g?

hi in vi, i have a file and i wanted to replace all wnix to unix. is the below correct. c/wnix/unix g... i have tried , and the above is not right... help? (7 Replies)
Discussion started by: yls177
7 Replies
Login or Register to Ask a Question