MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DIVIDE option in SORT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
tempuser
Beginner


Joined: 05 Oct 2005
Posts: 28
Topics: 20
Location: INDORE

PostPosted: Fri Mar 14, 2008 1:31 pm    Post subject: DIVIDE option in SORT Reply with quote

Hi,
I need to divide a number with 100 and put the value in the o/p file.
The input file is of FB with 80 in length.

Code:


Input:

ABCD 123456
CDEF 577891

output:

ABCD 1234.56
CDEF 5778.91



I tried with DIVIDE command and the o/p is getting only

Code:


ABCD0012.34
CDEF0057.78

sort card used :

SORT FIELDS=COPY                         
OUTREC FIELDS=(1,6,ZD,DIV,+100,EDIT=(TTTT.TT),80:X)



then I tried DIVIDE and MOD to get the value.But I am getting
blanks in beween the o/p .

Code:


o/p :

ABCD1234             56
CDEF5778             91

SORT card used :

OUTREC FIELDS=(1,6,ZD,DIV,+100,EDIT=(TTTT),1,6,ZD,MOD,+100,80:X).



I got the final solution by just placing a . with C'.' ,but want to know what
I am doing wrong in the first and second options.

Regards
Tempuser
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Mar 14, 2008 2:33 pm    Post subject: Reply with quote

I don't understand what result you're trying to get in the output.

123456/100 = 1234 so EDIT=(TTTT.TT) would give you 0012.34 which is what you got.

What output do you want?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Fri Mar 14, 2008 6:51 pm    Post subject: Reply with quote

I think all he wants to do is put a decimal point in his data.

What about using
OUTREC FIELDS=(1,6,ZD,EDIT=(TTTT.TT),80:X)
Back to top
View user's profile Send private message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Fri Mar 14, 2008 11:06 pm    Post subject: Reply with quote

Thanks for the resonce.My question is when I use DIVIDE option on a number(123456) by 100,I need to get the o/p as 1234.56.How can I achive by using DIVIDE option.

123456 /100 = 1234.56

Regards
Tempuser
_________________
----------------
Thanks&Regards
Bprasanna
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Sat Mar 15, 2008 11:23 am    Post subject: Reply with quote

bprasanna wrote:
Thanks for the resonce.My question is when I use DIVIDE option on a number(123456) by 100,I need to get the o/p as 1234.56.How can I achive by using DIVIDE option.

123456 /100 = 1234.56

Regards
Tempuser


What is the difference between that and
Quote:
I think all he wants to do is put a decimal point in his data.

What about using
OUTREC FIELDS=(1,6,ZD,EDIT=(TTTT.TT),80:X)


Files on the mainframe do not normally have explicit decimal points. The decimal position is determined by the definition of the field in the program using it.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Mar 15, 2008 3:23 pm    Post subject: Reply with quote

Quote:
My question is when I use DIVIDE option on a number(123456) by 100,I need to get the o/p as 1234.56.How can I achive by using DIVIDE option.


Tempuser,

What you're saying makes no sense. You can't divide the number by 100 and still retain all of the digits. Dividing by 100 removes the last two digits. You don't want to divide by 100. You just want to edit the existing value to have a decimal point.
Craig already showed you how to do that.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group