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

Sort by altering the columns


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Mon Nov 12, 2007 11:58 am
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
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
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: 1287
Location: Chennai, India

PostPosted: Mon Nov 12, 2007 4:38 pm
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
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: 1287
Location: Chennai, India

PostPosted: Mon Nov 12, 2007 4:54 pm
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 Developer


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

PostPosted: Mon Nov 12, 2007 9:48 pm
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:

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:

Use [URL] BBCode for External Links
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 JCL sort card - get first day and las... JCL & VSAM 9
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top