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

To omit certain records within a group


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

New User


Joined: 27 Aug 2006
Posts: 51
Location: Taiwan

PostPosted: Tue Jul 08, 2008 7:30 am
Reply with quote

The content of the the file are as the followings:

Code:

Customer No      Record Type     Info                Customer Type
X(11)            X(04)           X(10)               X(01)
---------------  --------------  ----------------    -----------------
10000000001      T100            AAAAAAAAAA          A
10000000001      T200            BBBBBBBBBB
10000000001      T201            CCCCCCCCC
10000000001      T300            DDDDDDDDD
10000000002      T100            EEEEEEEEEEE         B
10000000002      T200            FFFFFFFFFFFFF
10000000002      T201            GGGGGGGGG
10000000002      T300            HHHHHHHHHH


The requirement to omit is :
When the Customer Type = 'A' and the Record Type = 'T2xx' , the record should be omitted.

Therefore, the 2nd and 3rd records should be omitted.

How to accomplish this result with DFSORT?
Back to top
View user's profile Send private message
Varun Singh

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Tue Jul 08, 2008 8:55 am
Reply with quote

Hi jacob,

You can use the following JCL.....
Code:

//STEP10  EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*         
//SORTIN    DD DSN= i/p DSN,DISP=SHR 
//SORTOUT   DD DSN= o/p DSN,DISP=OLD           
//SYSIN     DD *               
   SORT FIELDS = COPY
   OMIT COND=(12,2,CH,EQ,C'T2',AND,26,1,CH,EQ,C'A')
/*

this should work...icon_smile.gif
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Jul 08, 2008 9:08 am
Reply with quote

Hi Varun,
have you tested what you have posted ?

There are space between FIELDS = COPY

How does your omit get rid of rec2 and 3 ? Neither have an A


Gerry
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Tue Jul 08, 2008 10:21 am
Reply with quote

hello acobdng,

As per your rule:

Quote:
The requirement to omit is :
When the Customer Type = 'A' and the Record Type = 'T2xx' , the record should be omitted.

Therefore, the 2nd and 3rd records should be omitted.


i feel none of the records should be omitted for the input records you posted above as in 2 and 3 records should have both the conditions meet i.e. both Customer Type = 'A' and the Record Type = 'T2xx'.

Your requriment is not clear can you explain it with some better example.

regards,
rajat
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Jul 08, 2008 10:29 am
Reply with quote

Hi,
I think the keyword here is GROUP (see title), so the first 4 records belong to customer type A and the next 4 belong to customer type B.


Gerry
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: Tue Jul 08, 2008 9:15 pm
Reply with quote

jacobdng,

Assuming Gerry is right about what you're trying to do (and I think he is), here's a DFSORT/ICETOOL job that will do it:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/26)
//OUT DD DSN=...  output file (FB/26)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(28,8,ZD) WITHALL WITH(1,26) -
  KEEPNODUPS KEEPBASE USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(28:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(26,1,CH,NE,C' '),
                OVERLAY=(27:26,1,28:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(36:SEQNUM,8,ZD,
                         28:28,8,ZD,SUB,36,8,ZD,TO=ZD,LENGTH=8))
  OUTFIL FNAMES=OUT,
    OMIT=(27,1,CH,EQ,C'A',AND,12,2,CH,EQ,C'T2'),
    BUILD=(1,26)
/*


In the future, please try to explain what you want to do more clearly so people don't have to guess.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Jul 08, 2008 9:24 pm
Reply with quote

The following DFSORT/ICETOOL JCL will give you the desired results. I assumed that your input is FB and is 26 bytes in length

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD *                                             
----+----1----+----2----+----3----+----4----+----5----+----6-
10000000001T100AAAAAAAAAAA                                   
10000000001T200BBBBBBBBBB                                   
10000000001T201CCCCCCCCC                                     
10000000001T300DDDDDDDDD                                     
10000000002T100EEEEEEEEEEB                                   
10000000002T200FFFFFFFFFF                                   
10000000002T201GGGGGGGGG                                     
10000000002T300HHHHHHHHHH                                   
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  SPLICE FROM(IN) TO(OUT) ON(1,11,CH) WITHALL WITH(1,25) -   
  KEEPNODUPS KEEPBASE USING(CTL1)                           
//CTL1CNTL DD *                                             
 OUTFIL FNAMES=OUT,IFOUTLEN=26,                             
 OMIT=(26,1,CH,EQ,C'A',AND,12,2,CH,EQ,C'T2'),               
 IFTHEN=(WHEN=INIT,OVERLAY=(27:SEQNUM,8,ZD,RESTART=(1,11))),
 IFTHEN=(WHEN=(27,8,ZD,GT,1),OVERLAY=(26:X))                 
/*                                                           
Back to top
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 51
Location: Taiwan

PostPosted: Wed Jul 09, 2008 2:10 pm
Reply with quote

Frank,
Your solution is perfect.

The statement of the omit requirement should be admended like

"When the Customer Type = 'A' , then the rows which has the same Customer No and the Record Type is like 'T2%' should be omitted."

Questions:
1) In the 3rd IFTHEN sentence, what is the function of "SUB" ?
2) How to edit the input in order to make it like a TSO frame?

Thanks again, and sincerely grateful to the other gentalemen.
I love this forum.

Jacob
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: Wed Jul 09, 2008 9:54 pm
Reply with quote

Quote:
1) In the 3rd IFTHEN sentence, what is the function of "SUB" ?


SUB does a subtract. Those IFTHEN clauses are all part of the "group trick" explained in the "Include or omit groups of records" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

Quote:
2) How to edit the input in order to make it like a TSO frame?


I don't know what a TSO frame is. Perhaps somebody else can help with that, or you can show what you want the output to look like.
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: Tue Aug 12, 2008 1:32 am
Reply with quote

With z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can do this more easily and efficiently using the new WHEN=GROUP function like this:

Code:

//S1   EXEC  PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/26)
//SORTOUT DD DSN=...  output file (FB/26)
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(26,1,CH,NE,C' '),
          PUSH=(27:26,1))
  OUTFIL OMIT=(27,1,CH,EQ,C'A',AND,12,2,CH,EQ,C'T2'),
    BUILD=(1,26)
/*


For complete details on the new WHEN=GROUP function and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 51
Location: Taiwan

PostPosted: Thu Aug 21, 2008 7:58 am
Reply with quote

Frank,
Is there a way to verify the release version of DFSORT on-site without bothering the others?

Jacob
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Aug 21, 2008 8:27 am
Reply with quote

Hello,

Please look at the following - Frank posted this a week or so ago. . .

ibmmainframes.com/viewtopic.php?t=33389
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 and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top