Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
Author Message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 200
Location: Keane India Ltd., Hyderabad

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
References
MGIndaco

Moderator


Joined: 10 Mar 2005
Posts: 478
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: 4684
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: 4684
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 Hours
Page 1 of 1