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

Sort based on the record type


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

New User


Joined: 16 May 2005
Posts: 17
Location: Bangalore

PostPosted: Wed Aug 21, 2024 10:57 am
Reply with quote

I want to sort the record based on the record type.
For example, I have a file having the record type at the beginning of each record.

Recordtype Field1 Field2 Field3
CS010 ....... ....... .......
CS020 ....... ....... .......
CS030 ....... ....... .......
CS040 ....... ....... .......
CS050 ....... ....... .......

For records type CS050, sort the records based on Field1, Field2 and Field3

For all other records types sort the records based on Field1 and Field2.

Is there a way to sort based on the record types.

Any help would be appreciated.

Thanks,
Prasanna
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Wed Aug 21, 2024 7:25 pm
Reply with quote

1. In this forum any sample must be presented in this way (to be polite to potential readers):

Code:
Recordtype  Field1    Field2   Field3
CS010       .......   .......  .......
CS020       .......   .......  .......
CS030       .......   .......  .......
CS040       .......   .......  .......
CS050       .......   .......  .......


2. What the harm would be if ALL records were sorted by all three fields?
No problem is expected usually.
In this case no need to create an issue where there is none.

3. If there is really a reason for that, the solution can be done:
    - create TempField3 as Field3 for CS050, and blanks for all other types
    - SORT by Field1,Field2,TempField3,EQUALS
    - truncate TempField3
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 Copy only TEXT or String from a record SYNCSORT 4
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
Search our Forums:

Back to Top