Page 1 of 1

Remove block of detail record with COND on one row

PostPosted: Mon Mar 07, 2011 5:34 pm
by saurabh72516
Hi Frank/Borad Members,
Pls could you provide me an ICETOOL card to suffice the following:
LRECL 72, Format FB

File contains set of 17 rows from 001 to 017 per customer_Id level. Customer_id at 001.. rows 42 to 60.
................
---+----1----+----2----+----3----+----4----+----5----+----6----+----7
03560P00000000            001123456789124Customer_Id_19bytes
03560P00000000            002EMPLOYER_Name
03560P00000000            003Address_Details
03560P00000000            004DEFAULT
06560P00000000            01000000000000012341002000000195019  51  <--Check & remove zeroes
06560P00000000            011Customer_Name
06560P00000000            012Address XXXX
06560P00000000            013 Address XXXX
06560P00000000            014 Address XXXX
06560P00000000            015
06560P00000000            016REFUND
06560P00000000            017Product_Name Case_Id
..................


Requirement is to remove these set of 17 rows whenever the detail record at 010 is succeeded by 000000000000 (12 bytes) , ie, when COND (26,3, CH, EQ'010') and when (29,12,CH,EQ'000000000000') then build a new file excluding these and allowing all other sets of 17 rows in the new file.

Regards,
Saurabh

Re: Remove block of detail record with COND on one row

PostPosted: Mon Mar 07, 2011 7:21 pm
by saurabh72516
Pls read the block of data as :
    ................
    ---+----1----+----2----+----3----+----4----+----5----+----6----+----7
    06560P00000000            01000000000000012341002000000195019  51  <--Check & remove zeroes
    06560P00000000            011Customer_Name
    06560P00000000            012Address XXXX
    06560P00000000            013 Address XXXX
    06560P00000000            014 Address XXXX
    06560P00000000            015
    06560P00000000            016REFUND
    06560P00000000            017Product_Name Case_Id
    ..................

And the unique field per block is Customer_Name

Re: Remove block of detail record with COND on one row

PostPosted: Tue Mar 08, 2011 12:08 am
by Frank Yaeger
Your description and example are not very clear, but if I understand what you want, then the following DFSORT job should do it:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/72)
//SORTOUT DD DSN=...  output file (FB/72)
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,
    BEGIN=(26,3,CH,EQ,C'010',AND,29,12,CH,EQ,C'000000000000'),
    END=(26,3,CH,EQ,C'017'),
    PUSH=(73:ID=1))
  OUTFIL OMIT=(73,1,CH,NE,C' '),BUILD=(1,72)
/*

Re: Remove block of detail record with COND on one row

PostPosted: Tue Mar 08, 2011 5:28 pm
by saurabh72516
Thanks Frank, the sort card extracts what I intend to.

But, apart from group (26,3,CH,EQ,C'010') to (26,3,CH,EQ,C'017') there two other recurring group which appear two or 3 times in the file, they are

BEGIN=(26,3,CH,EQ,C' '), END=(26,3,CH,EQ,C'004') &
BEGIN=(26,3,CH,EQ,C'001'), END=(26,3,CH,EQ,C'004')

These two groups are required to be INCLUDED in the SORTOUT result. The current sort card excludes them.

Re: Remove block of detail record with COND on one row

PostPosted: Tue Mar 08, 2011 5:46 pm
by saurabh72516
Frank, pls ignore my request. I have used additional IFTHEN clause to achieve my need.
I appreciate your time and help