MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Dragon_Lee Beginner Joined: 13 Feb 2006 Posts: 31 Topics: 17
Posted: Mon Jul 02, 2007 4:44 am Post subject: Can I only sort parts of the input file with DFSORT?
hello,
I am trying to sort a file with the first character for all the rows in the file but only want to sort the other fields when the first character equals to 'D'.
e.g. the input file is like this
Code:
----+----1----+----
B1
T2
DAAA
T1
T4
B3
E9
DCCC
DBBB
What I want to do is -
1. Sort by the 1st character.
2. Sort the other fields (col 2-4) when the 1st char is 'D'
So the expect output file is -
Code:
----+----1----+----
B1
B3
DAAA
DBBB
DCCC
E9
T2
T1
T4
Can this be implemented by DFSORT?
Thank you!! _________________ Dragon
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Mon Jul 02, 2007 6:17 am Post subject:
Try this job
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
B1
T2
DAAA
T1
T4
B3
E9
DCCC
DBBB
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(01,01,CH,A,
81,03,CH,A)
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:3X)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),
OVERLAY=(81:2,3))
OUTREC FIELDS=(01,80)
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Maximus Beginner Joined: 17 Nov 2005 Posts: 21 Topics: 11
Posted: Mon Jul 02, 2007 7:17 am Post subject:
Hi kolusu,,
I tried the above job, but the out is same as input, No change.
cheers
Maximus
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Mon Jul 02, 2007 7:30 am Post subject:
Quote:
Hi kolusu,,
I tried the above job, but the out is same as input, No change.
Maximus,
Show me your sysout messages. Just for clarification , I ran the job as is and I got the following output.
Code:
B1
B3
DAAA
DBBB
DCCC
E9
T2
T1
T4
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Jul 02, 2007 10:30 am Post subject:
Kolusu's job works correctly except that you might need to add the EQUALS option.
Here's a slightly simplified version of the DFSORT job. Note that we're assuming the input file has RECFM=FB.
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
B1
T2
DAAA
T1
T4
B3
E9
DCCC
DBBB
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),
OVERLAY=(81:2,3))
OPTION EQUALS
SORT FIELDS=(1,1,CH,A,
81,3,CH,A)
OUTREC FIELDS=(1,80)
_________________ 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
Maximus Beginner Joined: 17 Nov 2005 Posts: 21 Topics: 11
Posted: Tue Jul 03, 2007 3:54 am Post subject:
Hi kolusu,
I am absolutely sorry,
It my mistake your sort card is working fine.
Maximus
Back to top
Dragon_Lee Beginner Joined: 13 Feb 2006 Posts: 31 Topics: 17
Posted: Tue Jul 03, 2007 8:36 am Post subject:
Thank you all!!!
The SORT card working fine 8) _________________ Dragon
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