Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sum the hexadecimal input and diplay the totals

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sum the hexadecimal input and diplay the totals
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jul 10, 2013 6:09 pm    Post subject:
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    Post subject:
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: 1715
Location: UK

PostPosted: Wed Jul 10, 2013 7:40 pm    Post subject:
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    Post subject:
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: 1715
Location: UK

PostPosted: Wed Jul 10, 2013 8:04 pm    Post subject:
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    Post subject:
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: 1715
Location: UK

PostPosted: Wed Jul 10, 2013 8:28 pm    Post subject:
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

Site Director


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

PostPosted: Wed Jul 10, 2013 8:57 pm    Post subject:
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: 1715
Location: UK

PostPosted: Wed Jul 10, 2013 9:10 pm    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Wed Jul 10, 2013 10:01 pm    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Thu Jul 11, 2013 4:01 pm    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Thu Jul 11, 2013 5:17 pm    Post subject:
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: 1715
Location: UK

PostPosted: Thu Jul 11, 2013 5:54 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 22 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts How to copy PDS using dataset as input Ayodhya prasad JCL & VSAM 5 Wed Jun 01, 2016 6:02 pm
No new posts Convert Decimal to hexadecimal Steve Ironmonger DFSORT/ICETOOL 5 Fri May 27, 2016 4:19 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us