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

Splitting files along with record counts


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Apr 01, 2008 1:37 pm
Reply with quote

Hi,

I have an input file having 100 records. I want to split it into 3 output files.I am able to do that with the SPLIT option shown below.
Code:
//SYSIN    DD *                 
   SORT FIELDS=COPY             
   OUTFIL FILES=(01,02,03),SPLIT
/*                             


But I need 3 more output files with the count of records in the splitted files.

Is it possible in a single step? I am using SYNCSORT FOR Z/OS 1.2

Thanks,
Arun
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Apr 01, 2008 8:08 pm
Reply with quote

arcvns wrote:
But I need 3 more output files with the count of records in the splitted files.

So you need 6 files total - 3 having the data records and the other 3 only containing the count of a data file?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Apr 01, 2008 8:39 pm
Reply with quote

Alissa,

You are absolutely right.

Right now I have to find the record count of each file separately which makes the job bulky with increasing number of split files.

Thanks,
Arun
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Apr 01, 2008 8:56 pm
Reply with quote

Are there always 100 records in the input file? Is this constant?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Apr 01, 2008 9:29 pm
Reply with quote

Also, what is the RECFM and LRECL of the input file?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Apr 01, 2008 9:50 pm
Reply with quote

I do not believe this can be accomplished in a single pass of the data.

However, if the numer of records can be included within each split outfil instead of in separate datasets, then it can be done.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Apr 02, 2008 8:55 am
Reply with quote

Alissa,

Thanks for your quick response.

LRECL is 253 and the input record count is variable.

Thanks,
Arun
Back to top
View user's profile Send private message
prabhu118
Currently Banned

New User


Joined: 11 Feb 2008
Posts: 14
Location: Chennai

PostPosted: Wed Apr 02, 2008 12:14 pm
Reply with quote

there is was to split a file into more than 1 output files each having similar number of records.
ur req is
input has - 100 records right?
and u want to split it into 3 output files?

U can uses ICETOOL which will identify number of records in input file and spilt it accordingly into 3 output files
1st outut file - will contain 1st 33 records
2nd - will contain 2nd 33 records (i.e from 34th to 66th)
3rd will contain last 34 records.

since the tool itself will generate the number of input record counts...u o not have to worry any more to manually go and identify the number of records...

if i have got ur requirement correct..please let me know???
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Apr 02, 2008 6:39 pm
Reply with quote

Prabhu,

Quote:
input has - 100 records right?


LRECL is 253 and the input record count is variable

Quote:
U can uses ICETOOL which will identify number of records in input file and spilt it accordingly into 3 output files

With a simple sort card as given in my previous post, I am able to split the input file.

Quote:
u o not have to worry any more to manually go and identify the number of records...

It is particular to my requirement that I need the record counts in separate files which is later fed into another process

Thanks,
Arun
Back to top
View user's profile Send private message
prabhu118
Currently Banned

New User


Joined: 11 Feb 2008
Posts: 14
Location: Chennai

PostPosted: Thu Apr 03, 2008 11:46 am
Reply with quote

yes you can get the record count in separate file
please find the details below

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=.....input file/
/T1 DD DSN=...total count in input file give some datasets name here
// UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,CATLG,DELETE),
// DCB=(LRECL=500,RECFM=FB,BLKSIZE=0)
//C1 DD DSN=...total count in each of the spillted outputs
// UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,CATLG,DELETE),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//CTL3CNTL DD *
OUTFIL FNAMES=(OUT01,OUT02,OUT03),
( .. since we are splitting into three we will be giving till out03... if say we have to split into 7 files we have to give till out07)
// DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)
//OUT01 DD DSN=....split output1
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(25,25),RLSE),
// DCB=(RECFM=FB,LRECL=500,BLKSIZE=0)
//OUT02 DD DSN=....split output2
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(25,25),RLSE),
// DCB=(RECFM=FB,LRECL=500,BLKSIZE=0)
//OUT03 DD DSN=....split output3
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(25,25),RLSE),
// DCB=(RECFM=FB,LRECL=500,BLKSIZE=0)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(C1) USING(CTL2)
COPY FROM(IN) USING(CTL3)
/*
//CTL1CNTL DD * .... this will get the count in input file OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=11))
/*
//CTL2CNTL DD * ..divides the count generated in CTL1 by 3 as we are splitting into 3 output file
OUTREC BUILD=(2X,C'SPLIT1R=',
1,11,ZD,DIV,+03,TO=ZD,LENGTH=11,80:X)
/*

This will surely work...
try this out
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Apr 03, 2008 4:54 pm
Reply with quote

Prabhu,

My requirement is not to divide the total number of input records by 3.

I need the exact count of records in each of the split files.
Can you tell me how the above jcl covers the requirement.
Back to top
View user's profile Send private message
prabhu118
Currently Banned

New User


Joined: 11 Feb 2008
Posts: 14
Location: Chennai

PostPosted: Thu Apr 03, 2008 5:09 pm
Reply with quote

run the jcl..
the output corresponding to dd name T1 will give you the count of records in input
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Apr 03, 2008 6:11 pm
Reply with quote

Can you please explain how it will give the exact count in each of the output files like,

file1 - 34
file2 - 33
file3 - 33

As Alissa said, I think I will have to continue with multiple passes of data.

Thanks,
Arun
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts 3 files concatenated to 1 DFSORT/ICETOOL 2
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
Search our Forums:

Back to Top