Page 1 of 1

Suppressing the file based on Outrec

Posted: Tue Sep 11, 2012 1:22 am
by venky
Hi,

I have a PS file which contains below records.

01
03
01
03
01
03
01
02
03

01
03
01
02
03

01
03


Now from the above file I want to suppress only the bold records i.e see below

01
02
03
01
02
03

the Outfile should get same order from the input file..I mean only 01 02 03 order records.

Please let me know by using outrec. Thanks.

Posted: Tue Sep 11, 2012 1:24 am
by William Collins
You mean you want all records which are 01, 02 and 03 in sequence? And the 0301 is a typo?

Posted: Tue Sep 11, 2012 1:29 am
by venky
hi William,

Yes, I want the 02 records and also the above 01 record with the tralier record 03, this should be same order from the input file. Please once again look into the above query.Thanks.

Regards,
Venky.

Posted: Tue Sep 11, 2012 8:01 am
by William Collins
I'm still not sure of what you want.

I'm assuming you have "header", 01, "trailer", 03, always. Sometimes one "data", 02.

I'm not sure whether you want to keep or exclued the 01,02,03 groups. So:

This is the first part:

Code: Select all

//DROPGRP EXEC PGM=SORT 
//CHKOUT DD DUMMY 
//SYSOUT   DD SYSOUT=* 
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY 
  OUTREC IFTHEN=(WHEN=GROUP, 
                   BEGIN=(1,2,CH,EQ,C'01'),
                   END=(1,2,CH,EQ,C'03'), 
                   PUSH=(3:ID=1)), 
                                           
         IFTHEN=(WHEN=GROUP, 
                   BEGIN=(1,2,CH,EQ,C'01'),
                   RECORDS=3, 
                   PUSH=(4:3,1,7:1,2)), 
                                           
         IFTHEN=(WHEN=GROUP, 
                   BEGIN=(1,2,CH,EQ,C'02'),
                   RECORDS=2, 
                   PUSH=(5:3,1,9:1,2)), 
                                           
         IFTHEN=(WHEN=GROUP, 
                   BEGIN=(1,2,CH,EQ,C'03'),
                   RECORDS=1, 
                   PUSH=(6:3,1)) 
Then, if you want the 01,02,03 records

Code: Select all

 OUTFIL INCLUDE=(3,1,CH,EQ,4,1,CH, 
               AND, 
                 3,1,CH,EQ,5,1,CH, 
               AND, 
                 3,1,CH,EQ,6,1,CH),
        BUILD=(7,2,/,9,2,/,1,2) 
Giving

Code: Select all

01
02
03
01
02
03
Alternatively, if you want the 01,03 records

Code: Select all

  OUTFIL INCLUDE=(1,2,CH,EQ,C'03', 
               AND, 
                 (3,1,CH,NE,4,1,CH, 
                 OR, 
                  3,1,CH,NE,5,1,CH, 
                 OR, 
                  3,1,CH,NE,6,1,CH)),
         BUILD=(7,2,/,1,2) 
Giving

Code: Select all

01
03
01
03
01
03
01
03
01
03

If you want something else, you'll have to be clearer.

Posted: Tue Sep 11, 2012 8:51 am
by DikDude
Hi WC,

If i understand, the desired output is only the "sets" that contain 01, 02, and 03.

TS has not mentioned what to do with a set that has multiple 02s - if that is even possible.

Posted: Tue Sep 11, 2012 11:40 am
by NicC
He also says he wants to SUPPRESS groups having 02 records. This implies 'do not select theses groups'. Anyway, cannot be done in JCL - suggest moving to the Sort section.

Posted: Tue Sep 11, 2012 3:06 pm
by venky
hi,

Yes, I want the set of group records that is 01 02 03 records only.

These records are present in 1st position with length 02 in the input file.

Please give me the correct coding. Thank you all.

Regards,
Venky.

Posted: Tue Sep 11, 2012 3:13 pm
by dbzTHEdinosauer
venky,
stop wasting our time.
William, in his last post, provided code for such.

Posted: Tue Sep 11, 2012 3:20 pm
by venky
yes dbzThedinasauer, I see the code, but the positons are different, because I am beginner in mainframe...so that's why I have asked again...thank you all once again.

Regards,
Venky

Posted: Tue Sep 11, 2012 3:46 pm
by dbzTHEdinosauer
ok,
what positions have changed?