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
 

 

Splitting files along with record counts

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Arun Raj

Moderator


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

PostPosted: Tue Apr 01, 2008 1:37 pm    Post subject: Splitting files along with record counts
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: 500
Location: USA

PostPosted: Tue Apr 01, 2008 8:08 pm    Post subject: Re: Splitting files along with record counts
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: 2181
Location: @my desk

PostPosted: Tue Apr 01, 2008 8:39 pm    Post subject:
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: 500
Location: USA

PostPosted: Tue Apr 01, 2008 8:56 pm    Post subject:
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: 500
Location: USA

PostPosted: Tue Apr 01, 2008 9:29 pm    Post subject:
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: 500
Location: USA

PostPosted: Tue Apr 01, 2008 9:50 pm    Post subject:
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: 2181
Location: @my desk

PostPosted: Wed Apr 02, 2008 8:55 am    Post subject:
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    Post subject: Reply to: Splitting files along with record counts
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: 2181
Location: @my desk

PostPosted: Wed Apr 02, 2008 6:39 pm    Post subject:
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    Post subject: Reply to: Splitting files along with record counts
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: 2181
Location: @my desk

PostPosted: Thu Apr 03, 2008 4:54 pm    Post subject:
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    Post subject: Reply to: Splitting files along with record counts
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: 2181
Location: @my desk

PostPosted: Thu Apr 03, 2008 6:11 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


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