File has to be split into four files



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

File has to be split into four files

Postby kamal » Thu Aug 30, 2007 5:42 pm

A files has records :
****
1
2
3
****
3
4
****
5
****
6
7
8


This file has to be split into four files




Whenever '****' is encountered at POS 1:4 split the file and put all records after last '****' into last file.

I know how to do this with FILE-AID ...But I want to use SORT in place...
Please help.
kamal
 
Posts: 48
Joined: Wed Aug 22, 2007 2:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: File has to be split into four files

Postby Frank Yaeger » Fri Aug 31, 2007 3:53 am

Here's a DFSORT job that will do what you asked for. I assumed that your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//OUT1 DD DSN=...    output file1 (FB/80)
//OUT2 DD DSN=...    output file2 (FB/80)
//OUT3 DD DSN=...    output file3 (FB/80)
//OUT4 DD DSN=...    output file4 (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,2,ZD)),               
        IFTHEN=(WHEN=(1,4,CH,EQ,C'****'),                           
                OVERLAY=(81:SEQNUM,2,ZD)),                         
        IFTHEN=(WHEN=NONE,                                         
                OVERLAY=(83:SEQNUM,2,ZD,                           
                         81:81,2,ZD,SUB,83,2,ZD,M11,LENGTH=2))     
  OUTFIL FNAMES=OUT1,                                               
    INCLUDE=(1,4,CH,NE,C'****',AND,81,2,ZD,EQ,1),                   
    BUILD=(1,80)                                                   
  OUTFIL FNAMES=OUT2,                                               
    INCLUDE=(1,4,CH,NE,C'****',AND,81,2,ZD,EQ,2),                   
    BUILD=(1,80)                                                   
  OUTFIL FNAMES=OUT3,                                               
    INCLUDE=(1,4,CH,NE,C'****',AND,81,2,ZD,EQ,3),                   
    BUILD=(1,80)                                                   
  OUTFIL FNAMES=OUT4,                                               
    INCLUDE=(1,4,CH,NE,C'****',AND,81,2,ZD,EQ,4),                   
    BUILD=(1,80)                                                   
/*
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
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post