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
 

 

HOW TO SELECT SPECIFIED FIELDS IN A FILE TO AN OUTPUT FILE

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

New User


Joined: 21 Dec 2005
Posts: 7

PostPosted: Wed Jan 04, 2006 11:02 am    Post subject: HOW TO SELECT SPECIFIED FIELDS IN A FILE TO AN OUTPUT FILE
Reply with quote

HOW TO SELECT SPECIFIED FIELDS IN A FILE TO AN OUTPUT FILE

FOR EG:

INPUT HAS A LRECL OF 724 RECORDS LIKE

Code:

      NUMBER      NAME   DATE  ETC
      1           A      XXX   XXX


I WANT THE OUTPUT FILE AS

Code:

      NUMBER      NAME
      1           A
      2           B


HOW TO DO THIS WITH DF SORT
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Jan 04, 2006 11:53 am    Post subject: Re: HOW TO SELECT SPECIFIED FIELDS IN A FILE TO AN OUTPUT FI
Reply with quote

What is your fields attribute, length of number, name etc.
Will it be having Duplicates in OUT.

Regards,

Priyesh.
Back to top
View user's profile Send private message
meenasomu

New User


Joined: 15 Sep 2005
Posts: 17

PostPosted: Wed Jan 04, 2006 2:46 pm    Post subject:
Reply with quote

Hi,

Will this help you?

Code:

//STEP001 EXEC PGM=SORT                     
//SORTIN DD *                               
12345ABCDEFGHIJKL67890MNOPQRST             
12345ABCDEFGHIJKL67890MNOPQRST             
/*                                         
//SORTOUT DD SYSOUT=*                       
//SYSOUT DD SYSOUT=*                       
//SYSPRINT DD SYSOUT=*                     
//SYSIN DD *                               
  SORT FIELDS=(6,2,CH,A)                   
  SUM FIELDS=NONE                           
  OUTREC FIELDS=(1:6,4,6:12,4)     
/*                                         

The output will be
ABCD     GHIJ 



The 6th column in the input rec will be at the 1st col of the output rec. The length will be 4.

If you use a SORT FIELDS=COPY, the duplicates will not be removed.

Thanks,
Meena.
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 Jan 04, 2006 9:24 pm    Post subject:
Reply with quote

If you just want to keep the first 22 bytes of each record as shown in your example, you can use these DFSORT statements:

Code:

   OPTION COPY
   OUTREC FIELDS=(1,22)


If you want to do something else, you need to explain in detail what you want to do.

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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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