![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| converting a tabular format data to comma seperated data in KSH | Hemamalini | UNIX for Dummies Questions & Answers | 2 | 06-16-2008 05:37 AM |
| How to type the Omega symbol Ω in unix shell script | NagaMurugesan | Shell Programming and Scripting | 1 | 05-15-2008 01:23 PM |
| Converting Shell Script to HTML | davwel | Shell Programming and Scripting | 3 | 10-25-2007 11:25 PM |
| How to extract data using UNIX shell script? | desiondarun | Shell Programming and Scripting | 3 | 08-09-2006 09:14 AM |
| Converting Shell script to Dos batch files | darwinkna | Shell Programming and Scripting | 1 | 05-12-2006 12:01 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
converting the data type in unix shell script
I am writing a unix shell script that will extract records from table and write into a file. Code:
====================================== #! /bin/ksh ############################ # AFI Monitor Script ############################ . /db2/uszlad48/sqllib/db2profile export mondir=/home/bmwdev1/script/krishna/arc export monlog=$mondir/r1.log # connect to DB db2 connect to r2pdev user bmwdevup using summer08 # extract the records from the table ZB_RCBL_ERROR_MSG_MIG db2 -x "SELECT A.LINE_OF_BUSINESS, A.USER_UPDATED, A.ERROR_STATUS_CD, A.STATE_CD, A.AGENT_DIST, A.AGENT_ID, A.COMPANY_CD, A.REGION_CD, A.PLCY_CONTRACT_NUM, A.EFF_DT, A.BILLING_ACCT_NUM, A.PREMIUM_AMT, B.MSG_NUM, B.MSG_ID, B.MSG_TYP, B.MSG_TEXT FROM BMWDEV1.ZB_RCBL_ERROR A, BMWDEV1.ZB_RCBL_ERROR_MSG B WHERE A.TRACKING_NUM = B.TRACKING_NUM AND A.TRACKING_NUM_SUFFIX = B.TRACKING_NUM_SUFFIX AND A.TIMESTAMP_UPDATED >= '2008-10-01-00.00.00.000000' AND A.TIMESTAMP_UPDATED < '2008-10-05-00.00.00.000000' WITH UR" >> $monlog # disconnect from DB2 db2 terminate exit 0 ====================================== Following is the output I have got by executing this script Code:
F R2P E 22 02 102 B21 08 929460723 10/07/2008 M866516384 -1669.46 002 I One or more uncleared errored receivables for the policy A R2P E 22 02 102 B01 08 175056956 09/22/2008 M277377095 237.60 003 I Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG F R2P E 22 02 330 B21 08 929460103 09/29/2008 M275350821 1772.29 038 >4 I Enter an amount F R2P E 22 02 330 B21 08 929460103 09/29/2008 M275350821 1150.00 002 I One or more uncleared errored receivables for the policy F R2P E 36 35 330 B21 02 929460739 10/08/2008 P897680301 1824.93 003 I Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG The problem what i am facing is the field Premium_amt is available in the file in character format. I going to FTP this text file to mainframe. There they will format the data. While formatting they have to add the premium amount. If it is available character format we will not be able to sum all the premium amount. If it is avilable in packed decimal we will convert into decimal and will sum it up. Can anyone help me to fix this problem. Krishnakanth |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|