Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Need to do sorting on some selective rows only in a file
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: 2150
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 12:55 pm    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 3:00 pm    Post subject:
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Sep 13, 2007 8:38 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us