Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

DFSORT/ICETOOL :: Add PD field from 2nd file to PD in 1st

$
0
0
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
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


Viewing all articles
Browse latest Browse all 8500

Trending Articles