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

split the file based on count


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

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Wed Apr 15, 2009 7:31 pm
Reply with quote

Hi,

I have 3 input files like this:

1st record: f1page1
---------
---------
2nd record f1page1
----------
----------
and 3 files has similar structure.

Now i want to split these 3 files into 10 different files based on f1page1. that means read the first file, if it is f1page1 then first file and if it is 25001 record then second file, if it is 50001 3rd file etc.

could you please provide me the jcl for this.


Sud
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Apr 15, 2009 8:18 pm
Reply with quote

sudhakar1979 wrote:
Now i want to split these 3 files into 10 different files based on f1page1. that means read the first file, if it is f1page1 then first file and if it is 25001 record then second file, if it is 50001 3rd file etc.


It is not clear as to what you are trying to do. Do you mean to say that would only split one file into 10 files based on the first record of each file?

Please show us a sample of input and desired output along with DCB properties of input and output files.
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Wed Apr 15, 2009 8:30 pm
Reply with quote

Hi kolusu,

Here are the dcb parameters:

DCB=(PBS.MODEL,RECFM=FBA,LRECL=210,BLKSIZE=23310)
.

ok. i have changed my mind. now i want to split one file into 10 different files. the input file count may not be fixed count. it could be 50000 or 100000. i want to read the count of input file split it into 10 different file.

ex: if it is 100000 then it should be 10000 in each file.
as i showed in my earlier post
the input is

f1page1
------------
------------
------------
f1page1
------------
-----------
-----------
like this. each time we read 'f1page1' the counter needs to incremented. if 100000 file 1-10000 is file 1, 10001-20000 is file 2 like that.

Just let me know any other questions.
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Wed Apr 15, 2009 9:02 pm
Reply with quote

And to be more on the input file

f1page1
------
-------- (some 100 lines)
f1page1
--------
-------- (some 90 lines)
f1page1
--------
----------( some 100 lines)



and like that.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Wed Apr 15, 2009 10:09 pm
Reply with quote

Some people might mistakenly interpret your signature as an actual question.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Apr 15, 2009 11:29 pm
Reply with quote

sudhakar1979,

It is still not clear as to what you want to do. Lets take a simple example.

Say you have one file and it has 12 records

Code:

01
02
03
04
05
06
07
08
09
10
11
12


Total no: of records = 12 and no: of files to be split = 10

So 12/10 = 1 (decimals are ignored)

So you can copy 1 record into each of the file but what do you want to do with the last 2 records? Do you want discard them? or do you want them in the last file?

Also what happens if the no: of records are less than 10? How do you split them?
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Thu Apr 16, 2009 1:57 am
Reply with quote

Hi Skolusu,

obviously the records should be in millions. there is no point of you know less than 10 records.

first of all is it possible to write 1st record in first file, 2nd record in second file.. etc and 11th record is again in 1st and 12th record is in 2nd file etc ? if yes, how can I acheive that.

and my file is like this.

F2PAGE1
P2PAGE1
197602958
F2PAGE1
P2PAGE1
188546625
F2PAGE1
P2PAGE1
233842522

if you see this layout the first 3 rows

F2PAGE1
P2PAGE1
197602958

should go into file-1

F2PAGE1
P2PAGE1
188546625

should go into file2

F2PAGE1
P2PAGE1
233842522

should go into file3 etc. so each time if you find 'F2PAGE1' that is the starting point for the next file record.

I hope you clear.

Thanks.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 16, 2009 4:33 am
Reply with quote

Quote:
Hi Skolusu,
obviously the records should be in millions. there is no point of you know less than 10 records.


sudhakar1979,

IMHO You need to write code which would cover all scenarios, not just your current day requirement. Just because you have million records today does not mean it will always be true. 2 years down the line you might encounter an empty file or file with just 1 record and the solution still need to function as is instead of abending. That is the reason I asked "what if?"

On the other hand I think your requirement is quite simple , you just complicated it for no reason. From your latest post I am assuming that you want to split a group of records into 10 individual files.

If that is the case then it is very easy to split using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD DSN=your input 210 byte file,
//            DISP=SHR
//OUT01    DD SYSOUT=*                                       
//OUT02    DD SYSOUT=*                                       
//OUT03    DD SYSOUT=*                                       
//OUT04    DD SYSOUT=*                                       
//OUT05    DD SYSOUT=*                                       
//OUT06    DD SYSOUT=*                                       
//OUT07    DD SYSOUT=*                                       
//OUT08    DD SYSOUT=*                                       
//OUT09    DD SYSOUT=*                                       
//OUT10    DD SYSOUT=*                                       
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,7,CH,EQ,C'F2PAGE1'),     
  PUSH=(211:ID=1))
                                           
  OUTFIL FNAMES=OUT01,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,1)   
  OUTFIL FNAMES=OUT02,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,2)   
  OUTFIL FNAMES=OUT03,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,3)   
  OUTFIL FNAMES=OUT04,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,4)   
  OUTFIL FNAMES=OUT05,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,5)   
  OUTFIL FNAMES=OUT06,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,6)   
  OUTFIL FNAMES=OUT07,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,7)   
  OUTFIL FNAMES=OUT08,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,8)   
  OUTFIL FNAMES=OUT09,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,9)   
  OUTFIL FNAMES=OUT10,BUILD=(1,210),INCLUDE=(211,1,ZD,EQ,0)   
/*


If you don't have the July, 2008 PTF installed, ask your System Programmer to install it (it's free).

For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Thu Apr 16, 2009 6:00 pm
Reply with quote

Hi Skolusu,

what a super man you are. unfortunately as you said i am getting syntax error. trying to resolve with system people. Is there any other way? just curious.

Thanks,
Sudhakar.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 16, 2009 9:17 pm
Reply with quote

sudhakar1979 wrote:
as you said i am getting syntax error. trying to resolve with system people. Is there any other way?



sudhakar1979,

run this step and show me the sysout.

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD *           
DUMMY RECORD               
//SORTOUT  DD SYSOUT=*     
//SYSIN    DD *           
  SORT FIELDS=COPY         
/*
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Thu Apr 16, 2009 10:32 pm
Reply with quote

Hi Skolusu,

Here is the sysout.

Code:
SYNCSORT 1.3.0.0 IS NOT LICENSED FOR SERIAL 78921, TYPE 2097 611, LPAR
PRODUCT WILL STOP WORKING IN  41 DAYS UNLESS A VALID KEY IS INSTALLED.
SYSDIAG= 115634, 1368960, 1368960, 2015106                           
6,912K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
   64K BYTES RESERVE REQUESTED, 272K BYTES USED                       
4K BYTES OF EMERGENCY SPACE ALLOCATED                                 
SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE=    80                 
SORTOUT  : RECFM=FB   ; LRECL=    80; BLKSIZE=    80                 
4,860K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,       
   0 BYTES RESERVE REQUESTED, 156K BYTES USED                         
SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
BSAM WAS USED FOR SORTIN                                             
BSAM WAS USED FOR SORTOUT                                             
RCD IN          1, OUT          1                                     
RELEASE 1.3 BATCH 0485 TPF LEVEL 0.0                                 
END SYNCSORT - 
,STEP0100,,DIAG=A200,600A,8AAC,0046,EA52,4CA3,0
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Thu Apr 16, 2009 10:38 pm
Reply with quote

Ahhhhhhhhhh, the truth finally comes out! icon_smile.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 16, 2009 11:03 pm
Reply with quote

Sudhakar1979,

From your sysout messages it is evident that you are using syncsort. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Fri Apr 17, 2009 3:30 am
Reply with quote

Not a problem. i have written a cobol problem to handle this, thanks for all replies and your time.
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 Unable to interpret a hex value to De... COBOL Programming 4
No new posts Sort based on the record type DFSORT/ICETOOL 1
No new posts how to eliminate null indicator value... DB2 7
No new posts CA7 count with DATE variable CA Products 0
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
Search our Forums:

Back to Top