Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort by altering the columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
inamadugu
Warnings : 1

New User


Joined: 23 Aug 2007
Posts: 18
Location: Delhi

PostPosted: Mon Nov 12, 2007 11:49 am    Post subject: Sort by altering the columns
Reply with quote

Hi,
If the columns in the input are like NAME, FATHER NAME, ADDRES.
How can we create a output file in the format FATHER NAME, NAME, ADDRESS.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Nov 12, 2007 11:58 am    Post subject:
Reply with quote

Inamadugu,

Quote:
output file in the format FATHER NAME, NAME, ADDRESS.

Use OUTREC FIELDS statement. For syntax and examples, go thru manuals.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Nov 12, 2007 1:11 pm    Post subject:
Reply with quote

Rearrange/reformat fields using INREC/OUTREC
Code:
//*******************************************************
//STEP1    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
----+----1----+----2----+----3----+----4----+----5----+--
NAME  FATHER-NAME  ADDRES                               
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
           SORT FIELDS=COPY                             
           INREC FIELDS=(1:7,11,14:1,5,20:20,6)         
/*                                                       

In this example you could also replace INREC with OUTREC.
SORTOUT
Code:
----+----1----+----2----+----3
FATHER-NAME  NAME  ADDRES


Look at z/OS DFSORT: Getting Started
Back to top
View user's profile Send private message
inamadugu
Warnings : 1

New User


Joined: 23 Aug 2007
Posts: 18
Location: Delhi

PostPosted: Mon Nov 12, 2007 2:01 pm    Post subject: Reply to: SORT BY ALTERING COLUMNS
Reply with quote

Kris,
Thank you for your answer with explanation.

Murali,
Thank you for your valuable info.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Mon Nov 12, 2007 4:38 pm    Post subject: Reply to: SORT BY ALTERING COLUMNS
Reply with quote

Krisprems.

Wouldn't be appropriate to use OUTREC instead of INREC? from the manual

Quote:
INREC Describes how records are to be reformatted before they are sorted,
copied or merged. OUTREC Describes how records are to be reformatted after they are sorted,
copied or merged.


Just a thought and let me know your views.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Nov 12, 2007 4:46 pm    Post subject:
Reply with quote

Quote:
Wouldn't be appropriate to use OUTREC instead of INREC? from the manual


Thats why i specified "in this example"....
Quote:
In this example you could also replace INREC with OUTREC


icon_arrow.gif When you are making a COPY(SORT FIELDS=COPY), inrec or OUTREC dosent make much difference
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Mon Nov 12, 2007 4:54 pm    Post subject: Reply to: SORT BY ALTERING COLUMNS
Reply with quote

Prem.

Quote:
When you are making a COPY(SORT FIELDS=COPY), inrec or OUTREC dosent make much difference


Ok. Thanks for the details.
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: Mon Nov 12, 2007 9:48 pm    Post subject:
Reply with quote

DFSORT Symbols works nicely for this kind of thing. For example:

Code:

//S1    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
NAME,1,20,CH
FATHER_NAME,*,20,CH
ADDRESS,*,40,CH
/*
//SORTIN   DD DSN=...  input file
//SORTOUT  DD DSN=...  output file
//SYSIN    DD *
   OPTION COPY
   OUTREC BUILD=(FATHER_NAME,NAME,ADDRESS)
/*


For complete details on DFSORT Symbols, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/7.0?DT=20060615185603

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us