View previous topic :: View next topic
|
Author |
Message |
inamadugu Warnings : 1 New User
Joined: 23 Aug 2007 Posts: 18 Location: Delhi
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
inamadugu Warnings : 1 New User
Joined: 23 Aug 2007 Posts: 18 Location: Delhi
|
|
|
|
Kris,
Thank you for your answer with explanation.
Murali,
Thank you for your valuable info. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
When you are making a COPY(SORT FIELDS=COPY), inrec or OUTREC dosent make much difference |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|