Author: Sushant Garje
Subject: Add PD field from 2nd file to PD in 1st
Posted: Thu Dec 01, 2016 4:32 pm (GMT 5.5)
Hi,
I have two files of 30 bytes as below
File 1
File 2
Both files are in the same format.
The positions 17 to 24 contain the Amount in Packed Decimal format.
Query: My ask is to have an output file where Amounts from both files are added based on the key in positions 1 to 15 (name) & 28 to 30 (Currency) and the output file should be in the same format as the File 1.
Note:
- The File 1 is the driver file.
- File 2 may not contain all names from File 1.
- When above such scenario occurs, the record from File 1 should be written to output as it is. (i.e. adding a zero to the amount field).
I think I should use SORT JOIN to match the two files and SUM FIELDS for adding the Amounts but not sure how.
Can someone help me with the JCL SORT card?
_________________
Sushant G
Subject: Add PD field from 2nd file to PD in 1st
Posted: Thu Dec 01, 2016 4:32 pm (GMT 5.5)
Hi,
I have two files of 30 bytes as below
File 1
Code: |
----+----1----+----2----+----3 ABCDANT XYZJE .....à é. HKD ABCDANT XYZJE ....r..@ USD EFGHK UVWNDAK .....Ã.% USD EFGHK UVWNDAK ........ YEN IJKLAM RSTKUR ....è... HKD MNOPN OPQANI ...gÃä.. AUD |
File 2
Code: |
----+----1----+----2----+----3 ABCDANT XYZJE ........ HKD ABCDANT XYZJE .......< USD EFGHK UVWNDAK .......% USD IJKLAM RSTKUR ........ HKD MNOPN OPQANI .....à ñ. AUD MNOPN OPQANI .....Ãé. INR |
Both files are in the same format.
The positions 17 to 24 contain the Amount in Packed Decimal format.
Code: |
--------- FIELD LEVEL/NAME ---------- -PICTURE- -NUMBER START END LENGTH SUM-TEST-INPUT 1 30 30 10 TEST-NAME X(15) 1 1 15 15 10 F1 X 2 16 16 1 10 TEST-AMT S9(13)V99 3 17 24 8 10 F2 XXX 4 25 27 3 10 TEST-CRNCY XXX 5 28 30 3 |
Query: My ask is to have an output file where Amounts from both files are added based on the key in positions 1 to 15 (name) & 28 to 30 (Currency) and the output file should be in the same format as the File 1.
Note:
- The File 1 is the driver file.
- File 2 may not contain all names from File 1.
- When above such scenario occurs, the record from File 1 should be written to output as it is. (i.e. adding a zero to the amount field).
I think I should use SORT JOIN to match the two files and SUM FIELDS for adding the Amounts but not sure how.
Can someone help me with the JCL SORT card?
_________________
Sushant G