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
 

 

Can we calculate the sum of alphanumeric character.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sadashiv.a.bhosure

New User


Joined: 01 Feb 2007
Posts: 15
Location: india

PostPosted: Thu Feb 22, 2007 1:13 pm    Post subject: Can we calculate the sum of alphanumeric character.
Reply with quote

Hi,

suppose file contain number in alpahnumeric format(left align). I want to treat this alphanumeric data as a number and find out the total.
I/p file ---> data in alphanumeric format

Code:

data            data type
1               alphanumeric
1               alphanumeric
2               alphanumeric
1               alphanumeric


I want to treat this data as number and o/p as sum of this record= 5

Thank you.

Regards
Sadashiv
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Feb 22, 2007 1:17 pm    Post subject:
Reply with quote

Hi There,
Please show us an example including i/p & o/p
Back to top
View user's profile Send private message
sadashiv.a.bhosure

New User


Joined: 01 Feb 2007
Posts: 15
Location: india

PostPosted: Thu Feb 22, 2007 1:44 pm    Post subject: Re: Can we calculate the sum of alphanumeric character.
Reply with quote

here is the i/p file

-------------------------------------------
Name(1-10) count(11-20)
alphabetic alphanumeric
-------------------------------------------
aaaa 1 ----> left align alphnumeric data
bbbb 1
aaaa 2
bbbb 4

I want output as
o/p=>
aaaa 3
bbbb 5

I have tried following, it gives SOC7 error
SORT FIELDS=(1,10,CH,A)
SUM FIELDS=(11,20,ZD)

I have also tried
SORT FIELDS=(1,10,CH,A)
SUM FIELDS=(11,20,UFF)

but it doesn't work.

Could you please tell me is there are any other option available in JCL?

Thank you so much.

Regards,
Sadashiv.
Back to top
View user's profile Send private message
sadashiv.a.bhosure

New User


Joined: 01 Feb 2007
Posts: 15
Location: india

PostPosted: Thu Feb 22, 2007 4:30 pm    Post subject: Re: Can we calculate the sum of alphanumeric character.
Reply with quote

Is there any other option available in JCL or whether I have to write a program for changing alphanumeric field to numeric field and then calculate the total.

waiting for your precious reply.

thanks in advance,

Regards,
Sadashiv.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Feb 22, 2007 9:56 pm    Post subject:
Reply with quote

You need to use UFF format to convert the values to ZD, SUM the ZD values and then convert them back to the form you want. If you want the values left justified, you need to use JFY.

Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's JFY function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/


Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
aaaa      100
bbbb      10
aaaa      2
bbbb      4
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION ZDPRINT
  INREC BUILD=(1,10,11,10,UFF,TO=ZD,LENGTH=10)
  SORT FIELDS=(1,10,CH,A)
  SUM FIELDS=(11,10,ZD)
  OUTREC OVERLAY=(11:11,10,ZD,M10,LENGTH=10,
    11:11,10,JFY=(SHIFT=LEFT))
/*


SORTOUT would have:

Code:

aaaa      102 
bbbb      14   
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts Continuation Character ballaswaroop SYNCSORT 8 Thu Aug 25, 2016 4:46 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm


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