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
 

 

Sort only few columns not entire record....

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Fri Oct 28, 2005 3:31 pm    Post subject: Sort only few columns not entire record....
Reply with quote

Hi All,

I want to sort only first 2 columns of a Dataset. But not the entire record using DFSORT.

The input is as follows...

103 Raju 5000
102 Raghu 4600
101 Renu 7800

Output should be as follows....

101 Renu 5000 (Last column is not sorted)
102 Raghu 4600
103 Raju 7800

Please let me know the option with an exmple to do this.

Thanks,
Reddy.
Back to top
View user's profile Send private message

MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Fri Oct 28, 2005 4:23 pm    Post subject:
Reply with quote

Can this work for your needs?
Code:
//STEP010S EXEC PGM=ICETOOL                                   
//DFSMSG   DD SYSOUT=B                                       
//TOOLMSG  DD SYSOUT=B                                       
//DFSPARM  DD *                                               
ABEND                                                         
//IN1      DD *                                               
103 RAJU  5000                                               
102 RAGHU 4600                                               
101 RENU  7800                                               
//T1       DD SPACE=(CYL,(1,1),RLSE),DSN=&&T1                 
//T2       DD SPACE=(CYL,(1,1),RLSE),DSN=&&T2,DISP=(MOD,PASS)
//OU1      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  SORT   FROM(IN1)  TO(T1)  USING(CTL1)                       
  COPY   FROM(T1)   TO(T2)  USING(CTL2)                       
  COPY   FROM(IN1)  TO(T2)  USING(CTL3)                       
  SPLICE FROM(T2)   TO(OU1) ON(81,5,ZD) -                     
    WITHEACH WITH(11,5) USING(CTL4)                           
//CTL1CNTL DD *                                               
  INREC FIELDS=(1,10,70X)                                     
  SORT FIELDS=(1,3,CH,A,5,6,CH,A)                             
//CTL2CNTL DD *                                               
  INREC FIELDS=(1,80,81:SEQNUM,5,ZD)     
//CTL3CNTL DD *                         
  INREC FIELDS=(10X,11,70,81:SEQNUM,5,ZD)
//CTL4CNTL DD *                         
  OUTFIL FNAMES=OU1,BUILD=(1,80)         


I suppose that there are other method but I hope in this suggest.
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: Fri Oct 28, 2005 9:11 pm    Post subject:
Reply with quote

Reddy,

Here's a better way to do it with DFSORT/ICETOOL. I assumed your input file has RECFM=FB and LRECL=80, but you can change the job 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=(MOD,PASS)
//OUT  DD DSN=...  output file (FB/80)
//TOOLIN   DD    *
* IN->T1:  Sort by field1 and field2 and add seqnums.
SORT FROM(IN) TO(T1) USING(CTL1)
* IN->T1:  Copy field3 and add seqnums.
COPY FROM(IN) TO(T1) USING(CTL2)
* T1->OUT:  Splice field1 and field2 from sort with
* field3 from copy.  Remove seqnums.
SPLICE FROM(T1) TO(OUT) ON(81,8,ZD) WITH(11,4) USING(CTL3)
//CTL1CNTL DD *
   SORT FIELDS=(1,3,CH,A,5,5,CH,A)
   OUTREC OVERLAY=(81:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
   OUTREC OVERLAY=(81:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
   OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
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: Fri Oct 28, 2005 9:12 pm    Post subject:
Reply with quote

Reddy,

In the future, please ask DFSORT questions in the "VSAM and DFSORT" topic rather than in the JCL topic.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am


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