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
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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