MAEAED05598023190P8900024 SHOP BONUS MILES DMU000016GAEDCAD2000231557
MAEAED05598023190P8900024 SHOP BONUS MILES HHA000016GAEDCAD2000231558
MAEAED05598023190P8900024 SHOP BONUS MILES IOL000016GAEDCAD2000231559
MAEAED09418241200P8900024 SHOP BONUS MILES DMU000016GAEDCAD2000231560
MAEAED09418241200P8900024 SHOP BONUS MILES HHA000016GAEDCAD2000231561
MAEAED09418241200P8900024 SHOP BONUS MILES IOL000016GAEDCAD2000231562
Structure
X(1,43) - Key to identify the group
X(44,3) - partner code
X(47,7) - PIC S9(7)- amount
X(54,19) - other fileds
Expected output file
MAEAED05598023190P8900024 SHOP BONUS MILES DMU000100BAEDCAD2000231557
MAEAED09418241200P8900024 SHOP BONUS MILES DMU000100BAEDCAD2000231560
Explaination:
If you see the input file carefully, there are two groups based on the first 43 digits. and I need only the first record per group in the o/p file.
But i need the amount field(X(54,19) to contain sum of all group records and rest of the fields remains unchanged.
Like in above case each record of first group(of 3) in input file has 167(or 000016G in S9(7) format) as amount(X(47,7)) and in o/p file it should have 1002(167+167+167) and same for second group of records.
There could be 1 or more records in one group.
This would be a very complex logic for me as I am bit new to DFsort. I would really appreciate your help in above matter.
Note: Few commands like IF and WHEN are not supported by our maiframe system but rest all commands are supported.[img][/img][img][/img][img][/img]
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Last I looked, 167+167+167 equals 501, not 1002. I assume this was just a mistake on your part. If not, please explain.
You can use these DFSORT statements to do what you asked for:
Code:
OPTION NZDPRINT
SORT FIELDS=(1,43,CH,A)
SUM FIELDS=(47,7,ZD)
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Yes, it was by mistake. It should be 501 in o/p file.
I will try the code given by you tomorrow.
Thanks for quick reply.
Sanjay
Frank Yaeger wrote:
Last I looked, 167+167+167 equals 501, not 1002. I assume this was just a mistake on your part. If not, please explain.
You can use these DFSORT statements to do what you asked for:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
I am trying to go through DFSORT PDF but still facing challenges in getting required output.
I tried using the statements you specified but it seems giving the same o/p file as i/p after running the job.
could you please provide me another solution as quick fix for now and meanwhile I will continue going through the PDFs for future assignments.
Thanks,
Sanjay
skgupta81 wrote:
Hi,
Yes, it was by mistake. It should be 501 in o/p file.
I will try the code given by you tomorrow.
Thanks for quick reply.
Sanjay
Frank Yaeger wrote:
Last I looked, 167+167+167 equals 501, not 1002. I assume this was just a mistake on your part. If not, please explain.
You can use these DFSORT statements to do what you asked for:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Post the exact jcl and sort control statements submitted (use copy/paste and the Code tag - do not re-key. If you need to "hide" the real dataset names, fine.
Post all of the informational messages generated by the run including the message ids.
ICE054I 0 RECORDS - IN: 6, OUT: 6
ICE134I 0 NUMBER OF BYTES SORTED: 660
ICE165I 0 TOTAL WORK DATA SET TRACKS ALLOCATED: 600 , TRACKS USED: 0
ICE199I 0 MEMORY OBJECT STORAGE USED = 0M BYTES
ICE180I 0 HIPERSPACE STORAGE USED = 0K BYTES
ICE188I 0 DATA SPACE STORAGE USED = 0K BYTES
ICE026I 1 SMF RECORD NOT WRITTEN TO THE SMF DATA SET(RC=20)
ICE052I 0 END OF DFSORT
The o/p file is same as i/p file after running above code.
Thanks,
Sanjay
dick scherrer wrote:
Hello,
Post the exact jcl and sort control statements submitted (use copy/paste and the Code tag - do not re-key. If you need to "hide" the real dataset names, fine.
Post all of the informational messages generated by the run including the message ids.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You would only get the same output as input in two cases I can think of:
1) You DO NOT have any duplicates in positions 1-43. It's difficult to tell exactly what your data looks like from your example. Do you actually have records with the same values in 1-43? What are those values for the 6 records you show?
2) All of your summed fields overflowed (which does not appear to be the case for the input data you showed but it's difficult to tell).
I would need to see your ACTUAL input records to tell you what's happening. Perhaps you could send it to me offline (yaeger@us.ibm.com) as a .txt file?
Also, what is the RECFM and LRECL of your input file?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
What you sent me offline had different positions then what you stated here. I used your input file with these DFSORT control statements and got two output records from your six input records:
Code:
OPTION NZDPRINT
SORT FIELDS=(1,135,CH,A)
SUM FIELDS=(139,7,ZD)