Hi,
I have a requirement as below.
INPUT:
ABCDL<DATE>00000XYZ900001 M900001 1234EFGH2 000200000000 1A3G 5678
ABCDX<DATE>00000XYZ900002 M900002 1234EFGH2 000200000000 1234 8765
ABCDL<DATE>00000XYZ900003 M900003 1234EFGH2 000300000000 1A3G 5678
ABCDX<DATE>00000XYZ900004 M900004 1234EFGH2 000300000000 1234 8765
OUTPUT:
My requirement is that i need to sum both values(000200000000 and 000300000000) and write it as a single L,X record as below.
ABCDL<DATE>00000XYZ900001 M900001 1234EFGH2 000500000000 1A3G 5678
ABCDX<DATE>00000XYZ900002 M900002 1234EFGH2 000500000000 1234 8765
If the value is greater than 50 mn,then i have to write as two separate records as below.
INPUT:
ABCDL<DATE>00000XYZ900001 M900001 1234EFGH2 000400000000 1A3G 5678
ABCDX<DATE>00000XYZ900002 M900002 1234EFGH2 000400000000 1234 8765
ABCDL<DATE>00000XYZ900003 M900003 1234EFGH2 000300000000 1A3G 5678
ABCDX<DATE>00000XYZ900004 M900004 1234EFGH2 000300000000 1234 8765
Output:
ABCDL<DATE>00000XYZ900001 M900001 1234EFGH2 000500000000 1A3G 5678
ABCDX<DATE>00000XYZ900002 M900002 1234EFGH2 000500000000 1234 8765
ABCDL<DATE>00000XYZ900003 M900003 1234EFGH2 000200000000 1A3G 5678
ABCDX<DATE>00000XYZ900004 M900004 1234EFGH2 000200000000 1234 8765
If the input is X,L(FIFTH CHARACTER IN INPUT FILE) then i need to subtract the values.
INPUT:
ABCDL<DATE>00000XYZ900001 M900001 1234EFGH2 000200000000 1A3G 5678
ABCDX<DATE>00000XYZ900002 M900002 1234EFGH2 000200000000 1234 8765
ABCDX<DATE>00000XYZ900003 M900003 1234EFGH2 000300000000 1A3G 5678
ABCDL<DATE>00000XYZ900004 M900004 1234EFGH2 000300000000 1234 8765
OUTPUT:(note that 4th character of first record is X)(20-30=-10). - indicates X record.
ABCDX<DATE>00000XYZ900001 M900001 1234EFGH2 000100000000 1A3G 5678
ABCDL<DATE>00000XYZ900002 M900002 1234EFGH2 000100000000 1234 8765
Also,i need to update the tables(db2),for the values(900003,900004)with 900001.
LOGIC:
how can i store the numbers(900001) in internal table and update the values in db2.