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

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1448
Location: Chicago, IL

PostPosted: Wed Jan 04, 2006 11:53 am
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
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 Developer


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

PostPosted: Wed Jan 04, 2006 9:24 pm
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:

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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top