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

OUTFIL & INCLUDE (Same DDNAME occuring multiple times)


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bhavan JS
Warnings : 1

New User


Joined: 30 Nov 2007
Posts: 10
Location: Bangalore

PostPosted: Sun Dec 30, 2007 7:54 pm
Reply with quote

Hi,

I have a master file and I want to move the records from master to multiple files based on 2 fields (Field A and Field B)values. I' am using OUTFIL & INCLUDE for this. The problem here for me is I have many combinations of Field A and Field B which should go to File-1. Same case for the records which should go to File-2. For ex..

OUTFIL FNAMES=File-1,
INCLUDE=(2,6,CH,EQ,C'1',AND,9,11,CH,EQ,C'702')
OUTFIL FNAMES=File-1,
INCLUDE=(2,6,CH,EQ,C'1',AND,9,11,CH,EQ,C'703')

.......and many more conditions for File-1
OUTFIL FNAMES=File-2,
INCLUDE=(2,6,CH,EQ,C'2',AND,9,11,CH,EQ,C'702')
OUTFIL FNAMES=File-2,
INCLUDE=(2,6,CH,EQ,C'2',AND,9,11,CH,EQ,C'703')

.......and many more conditions for File-2
.......and many more conditions for multiple output files. (File-n)

Only first OUTFIL& INCLUDE condition for every output file is considered and all the duplicated DDnames are ignored by ICETOOL. As a result, I dont have records in File-1 & File-2 which satisfies the highlighted INCLUDE condtions. Is there a solution for my problem? Great if you can help.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sun Dec 30, 2007 8:22 pm
Reply with quote

Try
Code:

 OUTFIL FNAMES=File-1,
 INCLUDE=(2,6,CH,EQ,C'1',AND,
         (9,11,CH,EQ,C'702',OR,
          9,11,CH,EQ,C'703))
Back to top
View user's profile Send private message
Bhavan JS
Warnings : 1

New User


Joined: 30 Nov 2007
Posts: 10
Location: Bangalore

PostPosted: Sun Dec 30, 2007 9:44 pm
Reply with quote

Thanks for your reply Expat. I' am not coding OUTFIL INCLUDE in my JCL manually. Rather, I' am dynamically creating OUTFIL INCLUDE sysin by unloading records from a table. I have a table like below:

Field-1 Field-2 FileName
=================

FileName may repeat for different combinations of Field-1 and Field-2.
By unloading the below query to a file gives me a dynamic sysin for OUTFIL INCLUDE which I' am using in my JCL.

SELECT
'OUTFIL FNAMES=',FileName,
', INCLUDE=(2,6,CH,EQ, C''',Field-1,
''',AND,9,11,CH,EQ,C''',Field-2,''')'
FROM table-name;

Is there any option in ICETOOL to consider duplicate DD Names?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sun Dec 30, 2007 11:18 pm
Reply with quote

Bhaven,

It seems that instead of figuring out the best way to do what you want, you've picked a way to do it that doesn't work and are insisting on using it.

You can't use the same ddname for multiple OUTFIL statements the way you want to, but you don't have to.

expat showed you one way to do what you want with one OUTFIL per ddname using OR in the INCLUDE operand.

Another way would be to use an INREC with IFTHEN clauses to set an indicator for the one OUTFIL statement for each ddname, e.g.

Code:

   INREC IFTHEN=(WHEN=(2,6,CH,EQ,C'1',AND,9,11,CH,EQ,C'702'),
      OVERLAY=(81:C'1'),HIT=NEXT),
    IFTHEN=(WHEN=(2,6,CH,EQ,C'1',AND,9,11,CH,EQ,C'703'),
      OVERLAY=(81:C'1'),HIT=NEXT),
    ...
    IFTHEN=(WHEN=(2,6,CH,EQ,C'2',AND,9,11,CH,EQ,C'703'),
      OVERLAY=(81:C'2'),HIT=NEXT),
    ...
   OUTFIL FNAMES=File-1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
   OUTFIL FNAMES=File-2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
   ...


A third possible way would be to generate an ICETOOL COPY/USING for each condition so you can use multiple OUTFIL statements to a MOD ddname. However, this is inefficient, and also might give you multiple copies of a record in an output file that you don't want.

Code:

...
//File-1 DD DISP=MOD,...
//File-2 DD DSIP=MOD,...
//TOOLIN DD *
COPY FROM(IN) USING(CT11)
COPY FROM(IN) USING(CT12)
...
COPY FROM(IN) USING(CT21)
...
//CT11CNTL DD *
   OUTFIL FNAMES=File-1,
      INCLUDE=(2,6,CH,EQ,C'1',AND,9,11,CH,EQ,C'702')
//CT12CNTL DD *
   OUTFIL FNAMES=File-1,
     INCLUDE=(2,6,CH,EQ,C'1',AND,9,11,CH,EQ,C'703')
...
//CT21CNTL DD *
  OUTFIL FNAMES=File-2,
     INCLUDE=(2,6,CH,EQ,C'2',AND,9,11,CH,EQ,C'703')
...


You need figure out how to change your unload to generate control statements that are valid and will do what you want.
Back to top
View user's profile Send private message
Bhavan JS
Warnings : 1

New User


Joined: 30 Nov 2007
Posts: 10
Location: Bangalore

PostPosted: Mon Dec 31, 2007 10:11 am
Reply with quote

Thank you so much Frank. Before I started my work, I didn't realised that we cannot use duplicated DD names in OUTFIL. Then, as you said, instead of rework, I was wondering if availabe, I can specify "Use duplicated DD Names" option. Thanks again and I will get back to you with my result.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
Search our Forums:

Back to Top