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

Need to do sorting on some selective rows only in a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
manitonline

New User


Joined: 17 Sep 2005
Posts: 5
Location: Noida

PostPosted: Thu Sep 13, 2007 9:00 am
Reply with quote

I need to do sorting on some selective rows only in a file. The case is something like this:

Code:

Seq     Name    Code

1       A1      11
4       A1      344
3       A3      3
1       A3      434
2       A3      43
6       A3      343
7       A4      434
8       A4      45
8       A4      4
2       A6      8


In the above example, I need to sort only the rows (in Ascending order of Seq) where Name is A3. The other rows should remain in the order they r in the input file (No sorting on them).

Could you tell me how to create a sort card for the same.

Thanx
Mann
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 12:55 pm
Reply with quote

You gave a nice example of your input, how about providing an example of what you want the output to look like?
Back to top
View user's profile Send private message
manitonline

New User


Joined: 17 Sep 2005
Posts: 5
Location: Noida

PostPosted: Thu Sep 13, 2007 2:44 pm
Reply with quote

The output should be:

Code:

Seq    Name     Code
1      A1       11
4      A1       344
1      A3       434
2      A3       43
3      A3       3
6      A3       343
7      A4       434
8      A4       45
8      A4       4
2      A6       8


Here you'll see that only the rows where name is A3 have been sorted based on Seq. The other rows are not sorted and remain as it is. I hope this clarifies my requirement.

Thanks[/u]
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 3:00 pm
Reply with quote

Have you looked at Frank's Smart DFSORT Tricks and the method of sorting records between a header and trailer? If you treat those records where Name is less that A3 as headers and greater than A3 as trailers, it should work.....
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 Sep 13, 2007 8:38 pm
Reply with quote

Mann,

Here's a DFSORT job that will do what I think you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1       A1      11
4       A1      344
3       A3      3
1       A3      434
2       A3      43
6       A3      343
7       A4      434
8       A4      45
8       A4      4
2       A6      8
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'0')),
    IFTHEN=(WHEN=(9,2,CH,EQ,C'A3'),OVERLAY=(81:1,1))
  OPTION EQUALS
  SORT FIELDS=(9,2,CH,A,81,1,CH,A)
  OUTREC BUILD=(1,80)
/*
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top