Sort card to filter one record

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Jairam_baju
Member
Posts: 10
Joined: Thu Jul 30, 2009 8:11 pm
Location: Bangalore

Sort card to filter one record

Post by Jairam_baju » Tue Aug 11, 2009 8:29 am

Hi i need to split one file into two. first record in one file and the rest in second file. there is no key. i know how to do this in two steps but i want to make it in one step. please help me.

User avatar
arcvns
Member
Posts: 28
Joined: Sat May 30, 2009 10:19 pm
Location: Chennai, India

Post by arcvns » Tue Aug 11, 2009 8:50 am

Jairam_baju,

Is there anything which specifically identifies your first record?
Arun

Jairam_baju
Member
Posts: 10
Joined: Thu Jul 30, 2009 8:11 pm
Location: Bangalore

Post by Jairam_baju » Tue Aug 11, 2009 8:54 am

No, there is no key for my first record. thats y i had two steps. but i want it in single step.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Aug 11, 2009 8:26 pm

You can use a DFSORT job like the following to do what you asked for:

Code: Select all

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//OUT1 DD DSN=...  output file with record 1
//OUT2 DD DSN=...  output file with records 2-n
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=OUT1,ENDREC=1
  OUTFIL FNAMES=OUT2,STARTREC=2    
/*
Alternatively, you can use a DFSORT/ICETOOL job like this:

Code: Select all

//S2    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT1 DD DSN=...  output file with record 1
//OUT2 DD DSN=...  output file with records 2-n
//TOOLIN   DD    *
SUBSET FROM(IN) TO(OUT1) DISCARD(OUT2) INPUT FIRST KEEP
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others