Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To omit certain records within a group

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 49
Location: Taiwan

PostPosted: Tue Jul 08, 2008 7:30 am    Post subject: To omit certain records within a group
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    Post subject: Reply to: To omit certain records within a group
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: 1703
Location: Australia

PostPosted: Tue Jul 08, 2008 9:08 am    Post subject:
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: 188
Location: india

PostPosted: Tue Jul 08, 2008 10:21 am    Post subject: Re: To omit certain records within a group
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: 1703
Location: Australia

PostPosted: Tue Jul 08, 2008 10:29 am    Post subject:
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 Moderator


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

PostPosted: Tue Jul 08, 2008 9:15 pm    Post subject:
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    Post subject: Reply to: To omit certain records within a group
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: 49
Location: Taiwan

PostPosted: Wed Jul 09, 2008 2:10 pm    Post subject:
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 Moderator


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

PostPosted: Wed Jul 09, 2008 9:54 pm    Post subject:
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:

http://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 Moderator


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

PostPosted: Tue Aug 12, 2008 1:32 am    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
jacobdng

New User


Joined: 27 Aug 2006
Posts: 49
Location: Taiwan

PostPosted: Thu Aug 21, 2008 7:58 am    Post subject: How to verify the release verson of DFSORT on-site?
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

Site Director


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

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

Hello,

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

http://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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 3 Sun Jan 22, 2017 11:32 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us