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

Can we calculate the sum of alphanumeric character.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1208
Location: Bangalore,India

PostPosted: Thu Feb 22, 2007 1:17 pm
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
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
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 Developer


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

PostPosted: Thu Feb 22, 2007 9:56 pm
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:

Use [URL] BBCode for External Links


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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
No new posts Panvalet - 9 Character name - Issue c... CA Products 6
No new posts String has hex character need to conv... COBOL Programming 3
No new posts Output LREC based on specific character DFSORT/ICETOOL 22
Search our Forums:

Back to Top