MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
vijayakumar Beginner Joined: 28 Jul 2006 Posts: 17 Topics: 9
Posted: Mon Sep 11, 2006 9:08 am Post subject: Taking the max value and place in two separate files
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Sep 11, 2006 9:30 am Post subject:
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
vijayakumar Beginner Joined: 28 Jul 2006 Posts: 17 Topics: 9
Posted: Mon Sep 11, 2006 10:13 pm Post subject:
hi kolusu
The sort job works fine .
Regards & Thanks
vijay
Back to top
vijayakumar Beginner Joined: 28 Jul 2006 Posts: 17 Topics: 9
Posted: Mon Sep 11, 2006 11:43 pm Post subject:
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
Cogito-Ergo-Sum Advanced Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
Posted: Tue Sep 12, 2006 1:46 am Post subject:
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
kirank Beginner Joined: 21 Apr 2004 Posts: 61 Topics: 33 Location: hyderabad
Posted: Thu Sep 14, 2006 7:12 am Post subject:
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Sep 14, 2006 10:44 am Post subject:
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
sreenivask Beginner Joined: 23 Jun 2006 Posts: 10 Topics: 4 Location: CHENNAI
Posted: Wed Oct 04, 2006 11:08 am Post subject:
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
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Oct 04, 2006 11:45 am Post subject:
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Oct 04, 2006 11:46 am Post subject:
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
sreenivask Beginner Joined: 23 Jun 2006 Posts: 10 Topics: 4 Location: CHENNAI
Posted: Thu Oct 05, 2006 12:28 am Post subject:
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu Oct 05, 2006 7:40 am Post subject:
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
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