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 utility:Need output in Sorted format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort utility:Need output in Sorted format
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: 3158
Location: Tucson AZ

PostPosted: Wed Aug 08, 2007 9:53 pm    Post subject:
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    Post subject: Re: Sort utility:Need output in Sorted format
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    Post subject:
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 Moderator


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

PostPosted: Wed Aug 08, 2007 11:17 pm    Post subject:
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    Post subject: Re: Sort utility:Need output in Sorted format
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 Moderator


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

PostPosted: Thu Aug 09, 2007 1:09 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


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