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
 

 

Hoe to divide a file into 4 files based on some condition

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

New User


Joined: 17 May 2007
Posts: 24
Location: India

PostPosted: Tue Jul 03, 2007 9:25 pm    Post subject: Hoe to divide a file into 4 files based on some condition
Reply with quote

Hi all,
My requirement is like

Input file

********first-type**********
aaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaa

********Second-type*******
bbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbb
********Third-type**********
cccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccc
********End of Input file****



Outfile1-
aaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaa

Outfile2 -
bbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbb

Outfile3 -
cccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccc



Is it possible to do . can somebody help me with this
Back to top
View user's profile Send private message

teethu thomas

New User


Joined: 17 May 2007
Posts: 24
Location: India

PostPosted: Tue Jul 03, 2007 9:58 pm    Post subject: Re: Ho to divide a file into 4 files based on some condition
Reply with quote

Input file is of size 133

Output files are also of size 133
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: Tue Jul 03, 2007 10:15 pm    Post subject:
Reply with quote

It's not clear what you're trying to do. Are the header records

********first-type**********

etc actually in the file and do you want to divide the records according to those header records?

Or are the headers records really not in the file and do you want to divide the records by something in the records? If so, what?

Please explain more clearly what you want to do.

And why does your Subject say you want 4 files whereas your example only shows 3 files?
Back to top
View user's profile Send private message
teethu thomas

New User


Joined: 17 May 2007
Posts: 24
Location: India

PostPosted: Tue Jul 03, 2007 10:36 pm    Post subject: Re: Hoe to divide a file into 4 files based on some conditio
Reply with quote

Ya the header records are there in the file . i want to divide the records based on the header records
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jul 04, 2007 12:43 am    Post subject:
Reply with quote

Hello,

Will there always and only be 3 headers?

What should happen if 17 headers are present in a single run?
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 Jul 04, 2007 12:54 am    Post subject:
Reply with quote

teethu,

You can use a DFSORT/ICETOOL job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/133)
//OUT1 DD DSN=...   output file1 (FB/133)
//OUT2 DD DSN=...   output file2 (FB/133)
//OUT3 DD DSN=...   output file3 (FB/133)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,5,CH,EQ,C'*****'),
                OVERLAY=(134:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(142:SEQNUM,8,ZD,
                         134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT1,
    INCLUDE=(134,8,ZD,EQ,+1,AND,1,5,CH,NE,C'*****'),
    BUILD=(1,133)
  OUTFIL FNAMES=OUT2,
    INCLUDE=(134,8,ZD,EQ,+2,AND,1,5,CH,NE,C'*****'),
    BUILD=(1,133)
  OUTFIL FNAMES=OUT3,
    INCLUDE=(134,8,ZD,EQ,+3,AND,1,5,CH,NE,C'*****'),
    BUILD=(1,133)
/*
Back to top
View user's profile Send private message
teethu thomas

New User


Joined: 17 May 2007
Posts: 24
Location: India

PostPosted: Wed Jul 04, 2007 11:03 am    Post subject:
Reply with quote

Can you explain me the meaning of these statement

Code:

  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,5,CH,EQ,C'*****'),
                OVERLAY=(134:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(142:SEQNUM,8,ZD,
                         134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT1,
    INCLUDE=(134,8,ZD,EQ,+1,AND,1,5,CH,NE,C'*****'),
    BUILD=(1,133)
  OUTFIL FNAMES=OUT2,
    INCLUDE=(134,8,ZD,EQ,+2,AND,1,5,CH,NE,C'*****'),
    BUILD=(1,133)
  OUTFIL FNAMES=OUT3,
    INCLUDE=(134,8,ZD,EQ,+3,AND,1,5,CH,NE,C'*****'),
    BUILD=(1,133)
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 Jul 04, 2007 9:05 pm    Post subject:
Reply with quote

The INREC IFTHEN statements are the "group" trick explained in the "Include or omit groups of records" and "Sort groups of records" Smart DFSORT Tricks at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

They assign a group number to each group of records that starts with '*****' (your type headers).

The first OUTFIL statement writes the records from group 1 (except for the header) in OUT1.

The second OUTFIL statement writes the records from group 2 (except for the header) in OUT2.

The third OUTFIL statement writes the records from group 3 (except for the header) in OUT3.

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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 3 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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