View previous topic :: View next topic
|
Author |
Message |
to_sreeni
New User
Joined: 08 Jul 2009 Posts: 17 Location: bangalore
|
|
|
|
Hi,
I have a requirement to sum the hexadecimal fields of an input file and write the totals out.
We have SYNCSORT FOR Z/OS 1.4.0.0.
The input file is VB, REC Length = 250
Sample input is
Code: |
----+----1----+----2----+----3----+----4----+----5
DAPADAW.....bbP.W.Ã....IP.D.......................
CCDCCCE0000088D2E161000CD2C00000120000000000120012
4171416000002271606A000971400000E400000064008000E4
-------------------------------------------------
DAPADAW.....iOP.W.1ê...IP.D......w...........Î...w
CCDCCCE000008DD2E0F5000CD2C000000A000000030007000A
41714160000096716512000971400000560000002000360056
|
Expected Output is:
W 2100
Sort by column 7 (+4 for VB), length 1.
Sum starting colum 39 (+4 for VB), length 4.
Please can somebody help.
Thanks,
Sreeni
No need to use the CODE tags, someone else will do it for you |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What have you tried so far and what were the results ?
And please learn to use the CODE tage |
|
Back to top |
|
|
to_sreeni
New User
Joined: 08 Jul 2009 Posts: 17 Location: bangalore
|
|
|
|
Hi,
I tried the below SYSIN cards.
Code: |
//SYSIN DD *
OPTION ZDPRINT
SORT FIELDS=(11,1,CH,A)
SUM FIELDS=(43,4,BI)
/* |
Please can you suggest if this is correct or not.
Thanks
Sreeni |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
If you got the correct output then they are correct. If you did not then they are incorrect. |
|
Back to top |
|
|
to_sreeni
New User
Joined: 08 Jul 2009 Posts: 17 Location: bangalore
|
|
|
|
Hi Nic,
I have not got the expected output.
I have not go the totals for distinct values in column 11.
It was showing many rows with the column 11 data, e.g. 'W' in column 11 with many rows.
I am not sure where the problem is.
Any suggestion is greatly appreciated.
Thanks
Sreeni |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Well, in your 'sample' input in col 11, for 1 byte, both records have x'00'. are you trying to sort on col 15 ('P') perhaps? And similar error elsewhere. |
|
Back to top |
|
|
to_sreeni
New User
Joined: 08 Jul 2009 Posts: 17 Location: bangalore
|
|
|
|
It is actually 7th character. Since the input file format is VB, I have added another 4 bytes for RDW. I was lokking for 'W' in the sample records (after PADA).
Hope this will help. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
OK - because you did not use the code tags your sample is all skew-wiff. Can someone a) remove the leading blank on line 1 and b) remove the and on both lines so that we have a clearer picture, please? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Here's the sample data revised:
Sample input is
Code: |
----+----1----+----2----+----3----+----4----+----5
DAPADAW.....bbP.W.Ã....IP.D.......................
CCDCCCE0000088D2E161000CD2C00000120000000000120012
4171416000002271606A000971400000E400000064008000E4
-------------------------------------------------
DAPADAW.....iOP.W.1ê...IP.D......w...........Î...w
CCDCCCE000008DD2E0F5000CD2C000000A000000030007000A
41714160000096716512000971400000560000002000360056 |
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Thanks, Dick. Looks like my preview button isn't missing either as the bold/unbold tags did not display but bolded the 'and'. Brain-fade on my part! |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
to_sreeni wrote: |
Hi,
I tried the below SYSIN cards.
Code: |
//SYSIN DD *
OPTION ZDPRINT
SORT FIELDS=(11,1,CH,A)
SUM FIELDS=(43,4,BI)
/* |
Please can you suggest if this is correct or not. |
You recognize that OPTION ZDPRINT will not cause the binary field to be converted to zoned decimal, yes? Otherwise your control cards seem to be working as intended. |
|
Back to top |
|
|
to_sreeni
New User
Joined: 08 Jul 2009 Posts: 17 Location: bangalore
|
|
|
|
I tried without OPTION ZDPRINT. But i was not getting the expected output. I do not mind if the output is in hexadecimal format, i will convert that to decimal format manually as i am expecting only 15 distinct sums (from the original input file).
My Input file has 15 distinct values in column 11. But in the output i was getting more than 15 sums.
Can somebody help? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Then in your output data set, you must have at least one key duplicated, no? What are those duplicates? |
|
Back to top |
|
|
to_sreeni
New User
Joined: 08 Jul 2009 Posts: 17 Location: bangalore
|
|
|
|
In the input file, I have nearly 650K records. But there are only 15 distinct values in character 11. But the output file has displayed 383 records, which i could not understand. I can't provide the complete input file due to Data protection Act.
I could not understand the reason for duplicate output records. can anybody think of any reason for this? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Unfortunately, I can give you no hope save to work with your shop's senpai, as no solution is possible without examining the data. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Well, try VIEWing the file and edit it as follows:
and repeat until you have done all 15 values. If you have lines left displayed then you have more than the 15 values that you think you have or the records do not match the format you think you have. |
|
Back to top |
|
|
|