IBM MAINFRAME HELP FORUMS for COBOL, JCL, CICS, DB2, IMS etc...
Help & Support Forums for IBM Mainframe computers Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7, CA-11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, VSAM, ISPF, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

To omit certain records within a group

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
View previous topic :: View next topic  
Author Message
jacobdng



Joined: 27 Aug 2006
Posts: 7

Posted: Tue Jul 08, 2008 7:30 am    Post subject: To omit certain records within a group  

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  
Varun Singh



Joined: 01 Aug 2007
Posts: 25
Location: Delhi

Posted: Tue Jul 08, 2008 8:55 am    Post subject: Reply to: To omit certain records within a group  

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...:)
Back to top  
gcicchet



Joined: 28 Jul 2006
Posts: 445

Posted: Tue Jul 08, 2008 9:08 am    Post subject:  

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  
rajatbagga



Joined: 11 Mar 2007
Posts: 124
Location: india

Posted: Tue Jul 08, 2008 10:21 am    Post subject: Re: To omit certain records within a group  

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  
gcicchet



Joined: 28 Jul 2006
Posts: 445

Posted: Tue Jul 08, 2008 10:29 am    Post subject:  

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  
Frank Yaeger



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

Posted: Tue Jul 08, 2008 9:15 pm    Post subject:  

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  
Skolusu



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

Posted: Tue Jul 08, 2008 9:24 pm    Post subject: Reply to: To omit certain records within a group  

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  
jacobdng



Joined: 27 Aug 2006
Posts: 7

Posted: Wed Jul 09, 2008 2:10 pm    Post subject:  

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  
Frank Yaeger



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

Posted: Wed Jul 09, 2008 9:54 pm    Post subject:  

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  
Frank Yaeger



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

Posted: Tue Aug 12, 2008 1:32 am    Post subject:  

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  
jacobdng



Joined: 27 Aug 2006
Posts: 7

Posted: Thu Aug 21, 2008 7:58 am    Post subject: How to verify the release verson of DFSORT on-site?  

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

Jacob
Back to top  
dick scherrer



Joined: 23 Nov 2006
Posts: 7470
Location: 221 B Baker St

Posted: Thu Aug 21, 2008 8:27 am    Post subject:  

Hello,

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

http://ibmmainframes.com/viewtopic.php?t=33389
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
Related Links