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

Create Multiple Files Based on Input File record


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

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Fri Oct 23, 2009 2:11 am
Reply with quote

Hello All,
I have a File which contains Funds only. Each Fund is say 3 Byte and new funds are incepted/ Old Funds are deleted periodically.
Every Quarter, we read a Tax File and split the Tax File
in to n no. of files assuming n funds present in the Fund File.We do this using sort but have to manually identify the Funds present in fund file and add Parms in the job if new Fund are incepted .

Lets consider an example :
At start of the Quarter we have AAA,BBB and CCC in fund file.
So we split the TAX file to TAX.AAA, TAX.BBB and TAX.CCC . This split is a simple INCLUDE COND=(1,3,CH,EQ,AAA) on the Tax file. Similar process followed for other Funds. And then we process the splitted Tax Files.

The issue is we have to add/remove steps in our job every quarter as the Fund file changes periodically. Is it possible that we automate the process whereby the Fund File is read and based on the no. of funds present in it, the tax File is split into seperate files ?

Say,if for the next quarter fund DDD is added, then the new process should be smart enough to identify this fund and create a new file TAX.DDD without manual interpretation ? (Currently we have to add a step in the job to achieve this).
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Oct 23, 2009 2:55 am
Reply with quote

Puspojit,

Here is a DFSORT job which will give you the desired results. The number of files you want to split is dynamically generated. If the funds file is empy the job will not generate the dynamic JCL

Verify the output from step0200. It will have the actual Job required to split the input file. Once verified that JCL is created correctly change the following statement in step0200
Code:

//SORTOUT  DD SYSOUT=*


to the following
Code:

//SORTOUT  DD SYSOUT=(*,INTRDR)



The following JCL will create a dynamic JCL based on the policy numbers.

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                               
AAA                                                           
BBB                                                           
CCC                                                           
//DDOUT    DD DSN=&&DD,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//CCOUT    DD DSN=&&CC,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//SORTOUT  DD DUMMY                                           
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                           
  OUTFIL NULLOFL=RC4                                         
                                                             
  OUTFIL FNAMES=DDOUT,REMOVECC,NODETAIL,BUILD=(80X),         
  SECTIONS=(1,3,                                             
  HEADER3=('//*',80:X),                                       
  TRAILER3=('//',1,3,6X,'DD DSN=TAX.',1,3,',',/,             
            '//',12X,'DISP=(NEW,CATLG,DELETE),',/,           
            '//',12X,'UNIT=SYSDA,',/,                         
            '//',12X,'SPACE=(CYL,(2,1),RLSE)',80:X))         
                                                             
  OUTFIL FNAMES=CCOUT,REMOVECC,NODETAIL,BUILD=(80X),         
  HEADER1=(1:'//SYSIN    DD *',/,                             
           3:'OPTION COPY'),                                 
  SECTIONS=(1,3,                                             
  TRAILER3=(3:'OUTFIL FNAMES=',1,3,                           
              ',INCLUDE=(1,3,CH,EQ,C''',1,3,'''',C')',80:X)),
  TRAILER1=('//*',80:X)                                       
//*                                                           
//STEP0200 EXEC  PGM=SORT,COND=(4,EQ,STEP0100)   
//SYSOUT   DD SYSOUT=*                           
//SYSIN    DD *                                 
   OPTION COPY                                   
/*                                               
//SORTOUT  DD SYSOUT=*                           
//SORTIN   DD DATA,DLM=$$                       
//SPLITJOB JOB 'SPLIT JOB',                     
//             CLASS=A,                         
//             MSGCLASS=Y,                       
//             MSGLEVEL=(1,1),                   
//             NOTIFY=T-ID                       
//*                                             
//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=YOUR.TAX.FILE.TO.BE.SPLIT,     
//            DISP=SHR                           
$$                                               
//         DD DSN=&DD,DISP=(OLD,PASS)           
//         DD DSN=&CC,DISP=(OLD,PASS)           
//*


The output generated from the above jcl is

Code:

//SPLITJOB JOB 'SPLIT JOB',                           
//             CLASS=A,                               
//             MSGCLASS=Y,                           
//             MSGLEVEL=(1,1),                       
//             NOTIFY=T-ID                           
//*                                                   
//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD DSN=YOUR.TAX.FILE.TO.BE.SPLIT,         
//            DISP=SHR                               
//*                                                   
//AAA      DD DSN=TAX.AAA,                           
//            DISP=(NEW,CATLG,DELETE),               
//            UNIT=SYSDA,                             
//            SPACE=(CYL,(2,1),RLSE)                 
//*                                                   
//BBB      DD DSN=TAX.BBB,                           
//            DISP=(NEW,CATLG,DELETE),               
//            UNIT=SYSDA,                             
//            SPACE=(CYL,(2,1),RLSE)                 
//*                                                   
//CCC      DD DSN=TAX.CCC,                           
//            DISP=(NEW,CATLG,DELETE),               
//            UNIT=SYSDA,                             
//            SPACE=(CYL,(2,1),RLSE)                 
//SYSIN    DD *                                       
  OPTION COPY                                         
  OUTFIL FNAMES=AAA,INCLUDE=(1,3,CH,EQ,C'AAA')       
  OUTFIL FNAMES=BBB,INCLUDE=(1,3,CH,EQ,C'BBB')       
  OUTFIL FNAMES=CCC,INCLUDE=(1,3,CH,EQ,C'CCC')       
//*                                                   
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Fri Oct 23, 2009 9:27 pm
Reply with quote

Kolusu,
Thank you so much for the solution..... It works perfectly as required.
The JCL was exactly what I was looking for.
Thanks Once Again,
Puspojit
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(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
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
Search our Forums:

Back to Top