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

Using SORT alone i need the output file as shown below


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Thu Mar 19, 2009 10:30 am
Reply with quote

Hi,

Below is my requirement using SORT

FILE1 :
AAA 1
AAA 2
AAA 3
BBB 1
BBB 3
BBB 6

using SORT alone i need the output file as shown below

FILE2 :
AAA 1 2 3
BBB 1 3 6

Regards
Saagu
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Thu Mar 19, 2009 10:33 am
Reply with quote

Have you searched it in the forum?
This has been discussed earlier..
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Thu Mar 19, 2009 10:34 am
Reply with quote

I could't find this in forum
Back to top
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Thu Mar 19, 2009 10:54 am
Reply with quote

Hi saagu
Is there any max limit for the no of records with same key.
i.e Max of how many records with a key 'AAA' can be present in the input file?
The output record length will vary on this right?
so, we should have some limit

You want to do this in Sort or in Rexx or you want to submit a sort step through rexx.
There are many topics disscussed on similar requirements in DFSORT/ICETOOL forum

Regards,
Balu
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Thu Mar 19, 2009 10:59 am
Reply with quote

Please refer this www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Thu Mar 19, 2009 11:07 am
Reply with quote

Hi VVmanyam,

Suppose if my limit is 10,can u please post the syntax using SORT.

Thanks for the reply
Back to top
View user's profile Send private message
saagu

New User


Joined: 15 May 2008
Posts: 41
Location: Chennai

PostPosted: Thu Mar 19, 2009 12:09 pm
Reply with quote

If any posiibility please let me know.

Regards,
Saagu
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 19, 2009 7:54 pm
Reply with quote

Hello,

What have you found searching? Which sort product is used on your system?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Mar 19, 2009 9:07 pm
Reply with quote

Here is a SORT application that should produce your requested output:
Code:

//SORT  EXEC PGM=SORT,PARM='EQUALS'
//SORTIN  DD *                       
AAA 1                                 
AAA 2                                 
AAA 3                                 
BBB 1                                 
BBB 3                                 
BBB 6                                 
//SORTOUT DD SYSOUT=*                 
//SYSOUT  DD SYSOUT=*                 
//SYSIN   DD *                       
  SORT FIELDS=(1,3,CH,A)                         
  OUTREC IFTHEN=(WHEN=INIT,                     
    OVERLAY=(81:SEQNUM,2,ZD,RESTART=(1,3))),
    IFTHEN=(WHEN=(81,2,ZD,EQ,1),           
     BUILD=(1:1,3,4,2,18Z)),                 
    IFTHEN=(WHEN=(81,2,ZD,EQ,2),           
     BUILD=(1:1,3,2Z,4,2,16Z)),             
    IFTHEN=(WHEN=(81,2,ZD,EQ,3),           
     BUILD=(1:1,3,4Z,4,2,14Z)),             
    IFTHEN=(WHEN=(81,2,ZD,EQ,4),           
     BUILD=(1:1,3,6Z,4,2,12Z)),             
    IFTHEN=(WHEN=(81,2,ZD,EQ,5),           
     BUILD=(1:1,3,8Z,4,2,10Z)),             
    IFTHEN=(WHEN=(81,2,ZD,EQ,6),           
     BUILD=(1:1,3,10Z,4,2,8Z)),             
    IFTHEN=(WHEN=(81,2,ZD,EQ,7),           
     BUILD=(1:1,3,12Z,4,2,6Z)),             
    IFTHEN=(WHEN=(81,2,ZD,EQ,8),     
     BUILD=(1:1,3,14Z,4,2,4Z)),       
    IFTHEN=(WHEN=(81,2,ZD,EQ,9),     
     BUILD=(1:1,3,16Z,4,2,2Z)),       
    IFTHEN=(WHEN=(81,1,ZD,EQ,10),     
     BUILD=(1:1,3,18Z,4,2))           
  OUTFIL NODETAIL,REMOVECC,
    SECTIONS=(1,3,TRAILER3=(1,3,                 
         TOT=(4,2,BI,BI,LENGTH=2),     
         TOT=(6,2,BI,BI,LENGTH=2),     
         TOT=(8,2,BI,BI,LENGTH=2),     
         TOT=(10,2,BI,BI,LENGTH=2),     
         TOT=(12,2,BI,BI,LENGTH=2),     
         TOT=(14,2,BI,BI,LENGTH=2),     
         TOT=(16,2,BI,BI,LENGTH=2),     
         TOT=(18,2,BI,BI,LENGTH=2),     
         TOT=(20,2,BI,BI,LENGTH=2),     
         TOT=(22,2,BI,BI,LENGTH=2)))   
/*
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 Binary File format getting change whi... All Other Mainframe Topics 7
No new posts How to turn off 'ACTION' SDSF output ... TSO/ISPF 2
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
Search our Forums:

Back to Top