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

Sort utility:Need output in Sorted format


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nagendran

New User


Joined: 24 Jan 2007
Posts: 89
Location: USA

PostPosted: Wed Aug 08, 2007 9:32 pm
Reply with quote

Hi,

there are two groups A and B.

the input contain the following records,

0-5=> Name
5-15=>ID
16-20=> Phone

- - - -5 - - - -10 - - - - 15 - - - - 20 - - - - 21
AAAAA 99999999999997777777777777777
BBBBB 44444444444443333333333333333
AAAAA 66666666666665555555555555555
AAAAA 99999999999997777777777777777
AAAAA 44444444444443333333333333333
BBBBB 66666666666665555555555555555


i want outout in following format using a JCL,

- - - -5 - - - -10 - - - - 15 - - - - 20 - - - - 21
AAAAA 44444444444443333333333333333
BBBBB 44444444444443333333333333333
AAAAA 66666666666665555555555555555
BBBBB 66666666666665555555555555555
AAAAA 99999999999997777777777777777
AAAAA 99999999999997777777777777777

any body plz help me with this issue???

regards,
Nagu
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Aug 08, 2007 9:53 pm
Reply with quote

First by ID, second by Phone and third by Name?
First by Phone, second by ID and third by Name?
First by ID, second by Name?
First by Phone, second by Name?
Back to top
View user's profile Send private message
Nagendran

New User


Joined: 24 Jan 2007
Posts: 89
Location: USA

PostPosted: Wed Aug 08, 2007 11:06 pm
Reply with quote

one correction in output format,

-- - -5 - - - -10 - - - - 15 - - - - 20 - - - - 21
AAAAA 44444444444443333333333333333
BBBBB 44444444444443333333333333333
AAAAA 66666666666665555555555555555
BBBBB 66666666666665555555555555555
AAAAA 99999999999997777777777777777
AAAAA 99999999999997777777777777777


the layout of AAAAA and BBBBB is different.

regards,
Nagu
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 08, 2007 11:10 pm
Reply with quote

Nagendran,

you gave us three (3) char groups
Quote:
0-5=> Name
5-15=>ID
16-20=> Phone


what should the sort seq be? William Thompson's question.
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: Wed Aug 08, 2007 11:17 pm
Reply with quote

It's not clear which fields you want to sort on and your input doesn't seem to match the columns you gave. But let's say your input columns are:

1-6=> Name
7-19=>ID
20-35=> Phone

and you want to sort by Phone, then ID, and then Name. The DFSORT job would be:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*                     
//SORTIN DD DSN=...  input file         
//SORTOUT DD DSN=...  output file                 
//SYSIN DD *                                 
    SORT FIELDS=(20,16,CH,A,7,13,CH,A,1,6,CH,A)
/*


Adjust accordingly for what you need.
Back to top
View user's profile Send private message
Nagendran

New User


Joined: 24 Jan 2007
Posts: 89
Location: USA

PostPosted: Wed Aug 08, 2007 11:46 pm
Reply with quote

Hi,

The layout of input record is like this ,

One file has two different records of different layouts,

Consider the Group AAAAA, has sort pos as :POS(6 to 15)[ID] and POS(16 to 25 )[PHONE].
Consider the Group BBBBB, has sort pos as : POS(11 to 20)[ID] and POS(21 to 30 ).[PHONE]


-- - -5 - - - -10 - - - - 15 - - - - 20 - - - - 25
AAAAA 44444444444443333333333333333
BBBBB 66666666666665555555555555555
AAAAA 99999999999997777777777777777
BBBBB 44444444444443333333333333333
AAAAA 66666666666665555555555555555
AAAAA 99999999999997777777777777777



for type 1 reocrd, sort pos is : POS(6 to 15) and POS(16 to 25 )
for type 2 reocrd, sort pos is : POS(11 to 20) and POS(21 to 30 )


I want output in following format,

-- - -5 - - - -10 - - - - 15 - - - - 20 - - - - 25
AAAAA 44444444444443333333333333333
BBBBB 44444444444443333333333333333
AAAAA 66666666666665555555555555555
BBBBB 66666666666665555555555555555
AAAAA 99999999999997777777777777777
AAAAA 99999999999997777777777777777


regards,
Nagu
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: Thu Aug 09, 2007 1:09 am
Reply with quote

Last I looked 6-15 and 16-25 would be 20 characters but you show 29 characters. At any rate, I think I understand what you want now and here's a DFSORT job that will do it. 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=ICEMAN                             
//SYSOUT    DD  SYSOUT=*                             
//SORTIN DD *                                         
AAAAA4444444444333333333                             
BBBBB     66666666665555555555                       
AAAAA9999999999777777777                             
BBBBB     44444444443333333333                       
AAAAA6666666666555555555                             
AAAAA9999999999777777777                             
//SORTOUT DD SYSOUT=*                                 
//SYSIN    DD    *                                   
  INREC IFTHEN=(WHEN=(1,5,CH,EQ,C'BBBBB'),           
    BUILD=(1,5,6:11,20,80:X))                         
  SORT FIELDS=(6,20,CH,A)                             
  OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C'BBBBB'),           
    BUILD=(1,5,11:6,20,80:X))                         
/*


SORTOUT will have:

Code:

AAAAA4444444444333333333           
BBBBB     44444444443333333333     
AAAAA6666666666555555555           
BBBBB     66666666665555555555     
AAAAA9999999999777777777           
AAAAA9999999999777777777           
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Thu Aug 09, 2007 3:44 pm
Reply with quote

Nagendran,

Quote:
Consider the Group AAAAA, has sort pos as :POS(6 to 15)[ID] and POS(16 to 25 )[PHONE].
Consider the Group BBBBB, has sort pos as : POS(11 to 20)[ID] and POS(21 to 30 ).[PHONE]


I think you want to sort the file based on some fields which are in different positions for different group of records and the group of records can be identified by a particualr field(s). If this is the one you want, the following sort card will help you.

Assuming a file with length of 80 and group of records can be identified by field in position 1 and length 5.

Code:
INREC IFTHEN=(WHEN=(1,5,CH,EQ,C'AAAAA'),OVERLAY=(81:6,15,16,25)),
      IFTHEN=(WHEN=(1,5,CH,EQ,C'BBBBB'),OVERLAY=(81:11,20,21,30))
SORT FIELDS=(1,5,CH,A,81,20,CH,A)
OUTREC FIELDS=(1,80)
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top