----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
Sample report for system
WWW 999,999.99hard core 2016021720160218values WWW
ZZZ 9,999.99hard code 2016021720160218values ZZZ
Condition to create:
1) It will have the header records written in the file as "Sample report for system".
2) It will look in file-2, and pull the values from it only when the value in position 10 to 14 are either (WWW) or (ZZZ).
3) For both the scenario:first three bytes as www or zzz.
4) Starting from 5th byte, the amount field will be pulled from file 2 position 40 to 50.
5) Constant "hard core " value will be populated from 15 to 25.
6) for date it will look into the file 1. for position 26 to 33 it will use the value from 21 to 30 from file 1. In file 1 the dates are in MM/DD/YYYY but in the output file it should be in YYYYMMDD.
7) for position 34 to 41, it will use the file 1 from 31 to 40.
8) Again hard code values needs to be populated.
On the first glance I could think of this approach
1) Remove unnecessary records from File 2
2) Add some dummy keys in front of file 1 and 2
3) Use Joinkeys and concatenate both File1 and file 2
4) Now you have both file 1 and file 2 in one line, you can reformat the line in the way you desire.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Lakshmi Prakash,
That approach would work, but JOINKEYS uses more resources.
Better would be a two-step approach. First step generates a DFSORT symbol/SMNAMES for the static data from the single-record file.
Then it is the INCLUDE COND=(what you want), do the necessary formatting, using the symbol where required. Use OUTFIL with REMOVECC and HEADER1 to get the heading.