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 Sorting of hex values Saurabh_mi JCL & VSAM 0 Thu May 25, 2017 3:49 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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