many "include" on a same outfil - is it possible?

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Tarones
Member
Posts: 4
Joined: Fri Oct 09, 2015 8:16 pm

many "include" on a same outfil - is it possible?

Post by Tarones » Fri Oct 09, 2015 8:32 pm

hi there,
i need to reduce the number of outputs of a given sort.
instead of this:

Code: Select all

 OUTFIL FNAMES=SORTOUT1,                               
     INCLUDE=(1,1,CH,EQ,C'A'),OUTREC=(C'1',1,79)    
 OUTFIL FNAMES=SORTOUT2,
     INCLUDE=(1,1,CH,EQ,C'B'),OUTREC=(C'2',1,79)       
i would like something like this:

Code: Select all

 OUTFIL FNAMES=SORTOUT,                               
     INCLUDE=(1,1,CH,EQ,C'A'),OUTREC=(C'1',1,79),      
     INCLUDE=(1,1,CH,EQ,C'B'),OUTREC=(C'2',1,79)       
that is, writing on a same output file the selected records of different "include/outrec" statements.
it seems to me it isn't possible. the code above got a systax error. i tried other ways too, but none gave me the result i need.
could someone help, please?
thanks.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sat Oct 10, 2015 12:40 am

Code: Select all

 OUTFIL IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),
                BUILD=(C'1',1,79)),     
        IFTHEN=(WHEN=NONE,
                BUILD=(C'2',1,79))     

Tarones
Member
Posts: 4
Joined: Fri Oct 09, 2015 8:16 pm

Post by Tarones » Sat Oct 10, 2015 2:02 am

thanks a lot.
now i see my example wasn't right. the real situation is like this:

Code: Select all

OUTFIL FNAMES=SORTOUT1,                                
     INCLUDE=(1,1,CH,EQ,C'A'),OUTREC=(C'1',1,79)    
 OUTFIL FNAMES=SORTOUT2, 
     INCLUDE=(1,1,CH,NE,C'B'),OUTREC=(C'2',1,79)       
i mean, a same input record may eventually be written twice, receiving '1' when written in out1 and '2' when written in out2.

i had already tried the ifthen/build statement as you suggested, but it will only give the output record either '1 or '2', depending on the condition that is 1stly satisfied.

thanks.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sat Oct 10, 2015 11:57 am

Have you got more than two conditions?

Code: Select all

 OUTFIL  OMIT=(1,1,CH,EQ,C'B'),
        IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),
                BUILD=(C'1',1,79,
                       /,
                       C'2',1,79)),     
        IFTHEN=(WHEN=NONE,
                BUILD=(C'2',1,79))
From the example you showed, All A would get one record from the first OUTFIL and a second from the second. No B records would be output. All other values of 1,1 get one record from the second.

If you have multiple conditions, please describe them more fully.

Tarones
Member
Posts: 4
Joined: Fri Oct 09, 2015 8:16 pm

Post by Tarones » Sat Oct 10, 2015 5:46 pm

thanks.

yes, i have multiple "include" statement with complex conditions on each one. surely way more than 2 "include" statements. i tried to make things simple in my example.

this is a more complex example, but still quite simple compared to the real situation:

Code: Select all

OUTFIL FNAMES=SORTOUT1,                                
     INCLUDE=(1,1,CH,EQ,C'A',AND,2,1,CH,EQ,123,AND,3,1,ZD,EQ,4),OUTREC=(C'1',1,79)    
 OUTFIL FNAMES=SORTOUT2, 
     INCLUDE=(9,8,CH,EQ,C'MICHIGAN',AND,2,1,CH,EQ,456,AND,25,5,ZD,EQ,10100),OUTREC=(C'2',1,79)    
 OUTFIL FNAMES=SORTOUT3, 
     INCLUDE=(1,1,CH,NE,C'B',AND,46,6,ZD,EQ,112233),OUTREC=(C'3',1,79)    
 OUTFIL FNAMES=SORTOUT4, 
     INCLUDE=(134,7,CH,GT,5557788,AND,87,8,LT,98765896,AND,3,2,CH,EQ,C'NY'),OUTREC=(C'4',1,79)    
the number of "include" can be tens or hundreds.

the point is that i'll have input records that match many "include" and, so, are written in many different outputs.

after i write the records in different outputs on step1, i join them all in a single file with an iebgener on step2. what i'd like to do is to eliminate the need of step2, writing the final file directly on step1.

thanks again.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Oct 12, 2015 2:37 pm

I think the only realistic way to avoid the multiple OUTFILs and a second step in this type of situation is for you to write an E35 SORT Exit. This can be in COBOL. It can be very simple, and you should be able to get multiple records from a single record.

Tarones
Member
Posts: 4
Joined: Fri Oct 09, 2015 8:16 pm

Post by Tarones » Mon Oct 12, 2015 5:40 pm

thanks a lot.

academyindia4

Topic deleted by Admin

Post by academyindia4 » Fri Jan 15, 2016 8:16 pm

<< Content deleted By Admin >>

academyindia4

Topic deleted by Admin

Post by academyindia4 » Tue Jan 19, 2016 7:10 pm

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others