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

using OUTFIL getting only required no. of recs for each file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
zero

New User


Joined: 01 Dec 2007
Posts: 21
Location: Hyderabad

PostPosted: Wed Mar 12, 2008 3:41 pm
Reply with quote

Hi,
My requirement is this. I have an input file like this :

11111
11111
11111
22222
22222
33333
33333

I am copying subsets of records into different output files using OUTFIL.
But, my requirement is to copy different no. of records for different files.

Eg :

Code:
//SYSIN DD *
         SORT   FIELDS=COPY
         OUTFIL FNAMES=OUT1,INCLUDE=(1,5,ZD,EQ,11111)
         OUTFIL FNAMES=OUT1,INCLUDE=(1,5,ZD,EQ,22222)
         OUTFIL FNAMES=OUT1,INCLUDE=(1,5,ZD,EQ,33333)
       /*

If use the above card, all "11111" records will go to file1; All "22222" records will go to file2; all "33333" records will go to file3;

But, my requirement is not to get all the records.
i would like to copy 3 records to file1; 2 records to file2; 1 record to file3.

is there any option with OUTFIL that can select only required no. of recs ?
(like, STOPAFT=n)

thanks
Back to top
View user's profile Send private message
zero

New User


Joined: 01 Dec 2007
Posts: 21
Location: Hyderabad

PostPosted: Wed Mar 12, 2008 3:43 pm
Reply with quote

Sorry, in the above sort card, Output DD names are OUT1, OUT2, OUT3.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Mar 12, 2008 9:28 pm
Reply with quote

zero wrote:
If use the above card, all "11111" records will go to file1; All "22222" records will go to file2; all "33333" records will go to file3;

But, my requirement is not to get all the records.
i would like to copy 3 records to file1; 2 records to file2; 1 record to file3.


zero,

Assuming that your data is already sorted on the key , here is a JCL which would give you the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                     
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                                 
11111                                           
11111                                           
11111                                           
22222                                           
22222                                           
33333                                           
33333                                           
//OUT1     DD SYSOUT=*                         
//OUT2     DD SYSOUT=*                         
//OUT3     DD SYSOUT=*                         
//SYSIN    DD *                                 
  SORT FIELDS=COPY                             
  OUTREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,5))
  OUTFIL FNAMES=OUT1,BUILD=(01,80),             
  INCLUDE=(1,5,CH,EQ,C'11111',AND,81,8,ZD,LE,3)
  OUTFIL FNAMES=OUT2,BUILD=(01,80),             
  INCLUDE=(1,5,CH,EQ,C'22222',AND,81,8,ZD,LE,2)
  OUTFIL FNAMES=OUT3,BUILD=(01,80),             
  INCLUDE=(1,5,CH,EQ,C'33333',AND,81,8,ZD,LE,1)
/*


If the data is not sorted then just change the sort fields statement to

Code:

 SORT FIELDS=(01,05,CH,A)
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top