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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: using OUTFIL getting only required no. of recs for each file
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    Post subject: Reply to: using OUTFIL getting only required no. of recs for
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    Post subject: Reply to: using OUTFIL getting only required no. of recs for
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    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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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