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 

Taking the max value and place in two separate files

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


Joined: 28 Jul 2006
Posts: 17
Topics: 9

PostPosted: Mon Sep 11, 2006 9:08 am    Post subject: Taking the max value and place in two separate files Reply with quote

Hi

i want to find a max of two fields in the record and place it in two separate files.

EX:

pol23454920
pol23564930
pol23754940
pol23964510
pol24454960
qte25564970
pol26454980
pol37564410
pol24455910
pol25565710
qte25568910
qte28563910
qte29566910

i want the fields from position 4 to 7 and 8 to 11 with maximum value written to two separate files

file1 :3756
file2: 8910

can you just help me using sort utility

Regards
vijay
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Sep 11, 2006 9:30 am    Post subject: Reply with quote

vijayakumar,

Try this job

Code:

//STEP0100 EXEC PGM=SORT                 
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD *                           
POL23454920                               
POL23564930                               
POL23754940                               
POL23964510                               
POL24454960                               
QTE25564970                               
POL26454980                               
POL37564410                               
POL24455910                               
POL25565710                               
QTE25568910                               
QTE28563910                               
QTE29566910                               
//FILE1    DD SYSOUT=*                   
//FILE2    DD SYSOUT=*                   
//SYSIN    DD *                           
  SORT FIELDS=COPY                       
  OUTFIL FNAMES=FILE1,REMOVECC,NODETAIL, 
  TRAILER1=(MAX=(4,4,ZD,M11))             
  OUTFIL FNAMES=FILE2,REMOVECC,NODETAIL, 
  TRAILER1=(MAX=(8,4,ZD,M11))             
/*                                                                     


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vijayakumar
Beginner


Joined: 28 Jul 2006
Posts: 17
Topics: 9

PostPosted: Mon Sep 11, 2006 10:13 pm    Post subject: Reply with quote

hi kolusu

The sort job works fine .

Regards & Thanks

vijay
Back to top
View user's profile Send private message Send e-mail
vijayakumar
Beginner


Joined: 28 Jul 2006
Posts: 17
Topics: 9

PostPosted: Mon Sep 11, 2006 11:43 pm    Post subject: Reply with quote

hi

This sort works good for zd but for binary with 4 bytes i changed the zd to BI but it gives error whether any modification is to be made for existing.

Regards
vijay
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Sep 12, 2006 1:46 am    Post subject: Reply with quote

Quote:
This sort works good for zd but for binary with 4 bytes i changed the zd to BI


post the complete error messages so that we can see what is wrong with the job.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kirank
Beginner


Joined: 21 Apr 2004
Posts: 61
Topics: 33
Location: hyderabad

PostPosted: Thu Sep 14, 2006 7:12 am    Post subject: Reply with quote

Hi,

SORT FIELDS=COPY
OUTFIL FNAMES=FILE1,REMOVECC,NODETAIL,
TRAILER1=(MAX=(4,4,ZD,M11))
OUTFIL FNAMES=FILE2,REMOVECC,NODETAIL,
TRAILER1=(MAX=(8,4,ZD,M11))

in the above statements i've few doubts. Could you pls clarify the following:

1) What is REMOVECC,NODETAIL
2) What is M11 in the TRAILER1=(MAX=(4,4,ZD,M11))

Thanks,
Kirank.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Sep 14, 2006 7:20 am    Post subject: Reply with quote

Quote:

in the above statements i've few doubts. Could you pls clarify the following:
1) What is REMOVECC,NODETAIL


kiran,

Search before posting . check this link

http://www.mvsforums.com/helpboards/viewtopic.php?p=29521#29521


Quote:

2) What is M11 in the TRAILER1=(MAX=(4,4,ZD,M11))



http://www.mvsforums.com/helpboards/viewtopic.php?p=31958#31958

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Sep 14, 2006 10:44 am    Post subject: Reply with quote

Kirank,

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
_________________
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
sreenivask
Beginner


Joined: 23 Jun 2006
Posts: 10
Topics: 4
Location: CHENNAI

PostPosted: Wed Oct 04, 2006 11:08 am    Post subject: Reply with quote

I have a similar requirement,but i have to get the maximum of those two outputs in a file and I want to do it in the same step.The output of the above mentioned input in the begining has to be 8910. I tried the follwong,but ended up only to get both those in a single file. I don't know how to get maximum of those two outputs(trailers) in the same step.

//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=FILE1,REMOVECC,NODETAIL,
TRAILER1=(MAX=(4,4,ZD,M11)),
TRAILER2=(MAX=(8,4,ZD,M11))
/*

I want the maximum of these two trailers in the same step.Can some one help me?
How to give multiple conditions in that MAX field? How to get maximum of those two trailers in the same step?
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: Wed Oct 04, 2006 11:45 am    Post subject: Reply with quote

If you want the two maximums in the same record, change your OUTFIL statement to something like this:

Code:

  OUTFIL FNAMES=FILE1,REMOVECC,NODETAIL,
    TRAILER1=(MAX=(4,4,ZD,M11),X,       
              MAX=(8,4,ZD,M11))         


If you want the two maximums in separate records, change your OUTFIL statement to something like this:

Code:

  OUTFIL FNAMES=FILE1,REMOVECC,NODETAIL,
    TRAILER1=(MAX=(4,4,ZD,M11),/,       
              MAX=(8,4,ZD,M11))         


If you want something else, show exactly what 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


Last edited by Frank Yaeger on Wed Oct 04, 2006 11:48 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Oct 04, 2006 11:46 am    Post subject: Reply with quote

sreenivask,

Try this

Code:

//SYSIN DD *
  SORT FIELDS=COPY
  OUTFIL FNAMES=FILE1,REMOVECC,NODETAIL,
  TRAILER1=(MAX=(4,4,ZD,M11),X,
                   MAX=(8,4,ZD,M11))
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sreenivask
Beginner


Joined: 23 Jun 2006
Posts: 10
Topics: 4
Location: CHENNAI

PostPosted: Thu Oct 05, 2006 12:28 am    Post subject: Reply with quote

Thanks for your replies. But what I need is the maximum of these two maximums.

The above solution gives the out put as
3756
8910

But I need the out put as the maximum of these two and I want to do it in the same step.Out put should be
8910

Thanks
Srinivask
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Oct 05, 2006 7:40 am    Post subject: Reply with quote

sreenivask wrote:
Thanks for your replies. But what I need is the maximum of these two maximums.

The above solution gives the out put as
3756
8910

But I need the out put as the maximum of these two and I want to do it in the same step.Out put should be
8910

Thanks
Srinivask


Srinivask,

Your question has been answered here

http://www.mvsforums.com/helpboards/viewtopic.php?t=7282

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
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