Sponsored Content
Top Forums Shell Programming and Scripting shell script for archive purge Post 302246808 by regnumber on Tuesday 14th of October 2008 12:25:36 PM
Old 10-14-2008
Johnson,

The script that you have given works fine. But in my case it is a different one.

I have given the sample what I am working now. Let me give you the exact one what i am working currently.

following is the data in a text file.(db2 "SELECT TRACKING_NUM, TRACKING_NUM_SUFFIX, ERROR_SRC_CD, MSG_NUM, MSG_ID, MSG_TYP, MSG_TEXT, TIMESTAMP_UPDATED, USER_UPDATED FROM ZB_RCBL_ERROR_MSG_MIG WITH UR" >> $monlog1)

Quote:
12345 10 E-123 - - - Hello - -
12345 10 E - - - Hello - -
12345 10 A - - - Hello - -
12345 10 T - - - Hello - -
1234 15 - - - - ERROR - -
123456 10 - - - - ERRORS - -
123456 10 - - - - ERRORS - -
255678 200 - - - - ERRORCORRECTION - -
255678 200 - - - - ERRORCORRECTION - -
1111111111 10 - - - - - - -
7890 10 ERRORMSG 90 78 E ERROR 2008-08-11-06.53.12.924263 R2P
12345 11 eadf j123 10 E this is emsg 2008-08-11-14.05.11.745265 -
12345 11 eadf j123 10 E this is emsg 2008-08-12-09.39.38.886385 -
12345 11 eadf j123 10 E this is emsg 2008-08-12-09.42.21.223536 -
12345 11 eadf j123 10 E this is emsg 2008-08-12-09.48.57.911702 -
12345 11 eadf j123 10 E this is emsg 2008-08-12-09.49.59.296360 -
22345 11 error j123 10 E this is an emsg 2008-08-12-10.08.33.843147 hello
255679 25 - - - - - - -
BEYJYWG83L 0 R 902 - B System Exception Occured, please refer to BMW_EXCEPTION_LOG table 2008-09-10-00.41.32.787352
BEYJYXMT4K 0 R 902 - B System Exception Occured, please refer to BMW_EXCEPTION_LOG table 2008-09-11-19.01.23.878551
BEYEHF93QY 0 R 003 B No message exists in ZBV_BILL_REJCT_RSN table 2008-08-28-16.31.01.881717
BEYJYTT8FQ 0 R 013 B Invalid Transaction Code 2008-09-04-17.39.04.005237
BEYJYTT8FQ 0 R 016 B Invalid Fee Code 2008-09-04-17.39.04.008137
BEYJYTT8FQ 0 R 016 B Invalid Fee Code 2008-09-04-17.39.04.011939
BEYJYTT8FQ 0 R 016 B Invalid Fee Code 2008-09-04-17.39.04.012851
BEYJY2SZVL 0 R 003 B Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG 2008-09-16-09.22.29.120192
BEYJY2SXNG 0 R 003 B Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG 2008-09-16-09.19.33.868772
BEYJY2SMS3 0 R 003 B Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG 2008-09-16-08.53.07.872138
BEYJY2SMJD 0 R 003 B Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG 2008-09-16-08.50.17.307262
BEYJY2EG2K 0 R 003 B Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG 2008-09-17-15.56.03.418917
002211556 0 R 001 B Identical Receivable transaction has already posted for this policy. 2008-09-19-01.41.01.454234
002211556 0 R 002 B One or more uncleared errored receivables for the policy 2008-09-23-01.36.07.982876
002211556 0 R 002 B One or more uncleared errored receivables for the policy 2008-09-23-01.38.44.515880
002211556 0 R 001 B Identical Receivable transaction has already posted for this policy. 2008-09-23-16.32.20.565704
6634583444 0 R 902 - J System Exception Occured, please refer to BMW_EXCEPTION_LOG table 2008-09-15-12.44.09.383234

If I give the following script.

Quote:
while read TRACKING_NUM TRACKING_NUM_SUFFIX ERROR_SRC_CD MSG_NUM MSG_ID MSG_TYP MSG_TEXT TIMESTAMP_UPDATED USER_UPDATED
do

db2 "SELECT TRACKING_NUM, TRACKING_NUM_SUFFIX, ERROR_SRC_CD, MSG_NUM, MSG_ID, MSG_TYP, MSG_TEXT, TIMESTAMP_UPDATED, USER_UPDATED FROM ZB_RCBL_ERROR_MSG_MIG WHERE TRACKING_NUM = $TRACKING_NUM AND TRACKING_NUM_SUFFIX = $TRACKING_NUM_SUFFIX AND TIMESTAMP_UPDATED = $TIMESTAMP_UPDATED WITH UR" >> $monlog2

done < "$FILE"
The script that you have given is not working in this case. Bacause the value of the field MSG_TEXT is like "Identical Receivable transaction has already posted for this policy." 73 bytes long.

Please let me know how to proceed furthur.

Krishnakanth
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read from file then purge or archive.

Hi All, I have a root directory /tmp and I want to purge files or archive files in its subsequent subfolders.I listed the path of files I want to purge(archive) and the #of days. (purge) DAYS PATH 7 /tmp/arsenal/* 5 /tmp/chelsea/* (archive? the same as above but different folders... (15 Replies)
Discussion started by: kayarsenal
15 Replies

2. Shell Programming and Scripting

Generic Shell Script to Archive a file

Would appreciate if any one can paste a generic schell script to archive a file with date stamp by passing the file with fullpath as parameter For Eg. /apps/scripts/Archive_File.sh /data_home/project_home/file.txt this should place the file in the following directory ... (8 Replies)
Discussion started by: mak1600
8 Replies

3. Shell Programming and Scripting

script to archive and purge

Hi, I am writing a shell script for archive data from a table. The design is as follows. Step 1: Execute the select query and extract the data into a text file. Step 2: The primary key for this table is TRACKING_NUM, TRACKING_NUM_SUFFIX, TIMESTAMP_UPDATED. So These three fields will be read... (1 Reply)
Discussion started by: kmanivan82
1 Replies

4. Shell Programming and Scripting

shell script for primary and standby DB archive log check

Hi All, OS:AIX 5.3 64 bits I would like the below script to send alert mail with the message - "Standby logs falling behind Primary" to xyz@yahoo.com Script ===== #!/usr/bin/ksh #----------------------------------------------------------------------------- # Use SQL*Plus to query... (1 Reply)
Discussion started by: a1_win
1 Replies

5. Shell Programming and Scripting

Shell script to check the files hourly and purge

I'm new to shell scripting... i have been given a task.. can any one help in this regard.... 1) Check hourly for files in <destination-path><destination-file-template><destination-file-suffix> for files older than <destination-file-retention> days and purge. It should then check... (1 Reply)
Discussion started by: satishpabba
1 Replies

6. Shell Programming and Scripting

ftp, archive, email and delete from shell script

Hello, I found the forum’s information very helpful and informative. I am relatively new to UNIX programming. I am researching how to write a UNIX shell script to ftp all files from specific host folder to a client server. Also need to archive all transferred files, send a message (email) if any... (4 Replies)
Discussion started by: Lenora2009
4 Replies

7. Shell Programming and Scripting

Purge files and archive

Hi Friends, I have an urgent requirement. I have many files huge in size which has occupied almost the entire disk space. The files are not being moved to the archived folder. But at present I need to purge those files, new to shell scripting, not sure how to proceed. Eg. Directory... (3 Replies)
Discussion started by: unx100
3 Replies

8. Shell Programming and Scripting

Archive shell script

Hi, I'm new to Unix shell scripting and my first task is proving to be tricky. Please help where you can with pointers, tips, or examples of script. I'm self learning from the internet. I need to archive off files to another write protected directory according to the file names. ex.... (0 Replies)
Discussion started by: gorses
0 Replies

9. Homework & Coursework Questions

Archive and purge the log file

Hi Unix Experts, I am new in this filed. I have assignment to Archive and purge the log file using shell scripts I tried I could not get the result please help me this. Ex: test.log requirement : using shell script I need to archive the log file and nil and the content of (test.log)... (1 Reply)
Discussion started by: johney1981
1 Replies

10. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies
All times are GMT -4. The time now is 01:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy