Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need to sort files with specific criteria

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
a_gangwani

New User


Joined: 12 Dec 2005
Posts: 2
Location: India

PostPosted: Sat Mar 25, 2006 4:53 pm    Post subject: Need to sort files with specific criteria
Reply with quote

Hi

I want to sort a file with input as

Code:

TX      ID           NAME
01 XXXX 7777 XXXXXXX PPPPPP   XXXXXXXXXX
02 XXXX 7777 XXXXXXX AAAAA    XXXXXXXXXX
02 XXXX 1111 XXXXXXX MMMMM    XXXXXXXXXX
01 XXXX 8888 XXXXXXX JJJJJJJJ XXXXXXXXXX
01 XXXX 9999 XXXXXXX HHHHH    XXXXXXXXXX
02 XXXX 9999 XXXXXXX CCCCC    XXXXXXXXXX
01 XXXX 1111 XXXXXXX FFFFFFF  XXXXXXXXXX
01 XXXX 6666 XXXXXXX MMMMM    XXXXXXXXXX


The required output should be like this:
All 01 records should be sorted on NAME ascending.
and all 02s corresponding to an ID should come rite below the 01(in any order):

Code:

01 XXXX 1111 XXXXXXX FFFFFFF  XXXXXXXXXX
02 XXXX 1111 XXXXXXX MMMMM    XXXXXXXXXX
01 XXXX 9999 XXXXXXX HHHHH    XXXXXXXXXX
02 XXXX 9999 XXXXXXX CCCCC    XXXXXXXXXX
01 XXXX 8888 XXXXXXX JJJJJJJJ XXXXXXXXXX
01 XXXX 6666 XXXXXXX MMMMM    XXXXXXXXXX
01 XXXX 7777 XXXXXXX PPPPPP   XXXXXXXXXX
02 XXXX 7777 XXXXXXX AAAAA    XXXXXXXXXX


Want to do this using sort card and not a program. Please guide.
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: Sat Mar 25, 2006 9:42 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what 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=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
* Sort by ID and TX.  Copy NAME to 81-88.
SORT FROM(IN) TO(T1) USING(CTL1)
* Splice NAME in 81-88 of 01 into 81-88 of 02 with same ID.
SPLICE FROM(T1) TO(T2) ON(9,4,CH) WITH(1,80) KEEPNODUPS KEEPBASE
* Sort by NAME and TX.  Remove copy of NAME.
SORT FROM(T2) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  SORT FIELDS=(9,4,CH,A,1,2,CH,A)
  OUTREC OVERLAY=(81:22,8)
/*
//CTL2CNTL DD *
  SORT FIELDS=(81,8,CH,A,1,2,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 Copy Specific Groups V S Amarendra Reddy SYNCSORT 10 Thu Jan 11, 2018 1:16 am
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts TBSARG - Deleting the search criteria... ISPFHerc TSO/ISPF 6 Thu Dec 14, 2017 8:18 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us