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 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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm


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