IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sum the hexadecimal input and diplay the totals


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
to_sreeni

New User


Joined: 08 Jul 2009
Posts: 17
Location: bangalore

PostPosted: Wed Jul 10, 2013 5:34 pm
Reply with quote

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 icon_evil.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jul 10, 2013 6:09 pm
Reply with quote

What have you tried so far and what were the results ?

And please learn to use the CODE tage
Back to top
View user's profile Send private message
to_sreeni

New User


Joined: 08 Jul 2009
Posts: 17
Location: bangalore

PostPosted: Wed Jul 10, 2013 7:34 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 10, 2013 7:40 pm
Reply with quote

If you got the correct output then they are correct. If you did not then they are incorrect.
Back to top
View user's profile Send private message
to_sreeni

New User


Joined: 08 Jul 2009
Posts: 17
Location: bangalore

PostPosted: Wed Jul 10, 2013 7:56 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 10, 2013 8:04 pm
Reply with quote

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
View user's profile Send private message
to_sreeni

New User


Joined: 08 Jul 2009
Posts: 17
Location: bangalore

PostPosted: Wed Jul 10, 2013 8:14 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 10, 2013 8:28 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jul 10, 2013 8:57 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 10, 2013 9:10 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jul 10, 2013 10:01 pm
Reply with quote

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
View user's profile Send private message
to_sreeni

New User


Joined: 08 Jul 2009
Posts: 17
Location: bangalore

PostPosted: Thu Jul 11, 2013 2:51 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Jul 11, 2013 4:01 pm
Reply with quote

Then in your output data set, you must have at least one key duplicated, no? What are those duplicates?
Back to top
View user's profile Send private message
to_sreeni

New User


Joined: 08 Jul 2009
Posts: 17
Location: bangalore

PostPosted: Thu Jul 11, 2013 4:44 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Jul 11, 2013 5:17 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Jul 11, 2013 5:54 pm
Reply with quote

Well, try VIEWing the file and edit it as follows:
Code:
X all 'A' 7

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts force tablespace using LISTDEF input DB2 1
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Use input file with OMIT rcd keys? DFSORT/ICETOOL 15
Search our Forums:

Back to Top