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

Sort only few columns not entire record....


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Oct 28, 2005 9:11 pm
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Oct 28, 2005 9:12 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top