how to change dates in bash script running db2 commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jvsplice
    New Member
    • Oct 2015
    • 1

    how to change dates in bash script running db2 commands

    hi

    i have a bash script that runs a report from db. then mails it to me. my question is the dates in the script must change every month. how can i add a variable to this?

    Code:
    #!/bin/ksh
    
    db2 connect to ***** user ***** using ****
    
    db2 "SELECT ESB_DATE_PRCSD, UNIQ_INSTC_ID, ACC_N, REF_N, TRANS_CODE, DR_CR_I, TRANS_AMT, TRANS_DATE, TRANS_TIME, EFCTV_DATE, BANK_NAME, BRCH_CODE, CHEQ_N FROM PAYMTNTFTN_AUDIT_LOG where ACC_N IN ('******') and ESB_DATE_PRCSD >= '2015-09-01' and ESB_DATE_PRCSD <= '2015-09-30' and HTTP_STTS = 'REQUEST'" > filename_$date
    it runs fine when i run it manual, even mmails the report to me.

    how to i set a variable to cahnge 2015-09--1 and 2015-09-31. wanto set up a cron job to do this monthly.

    thanks jacques
    Last edited by Rabbit; Oct 19 '15, 05:23 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...