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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 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
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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