MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Maintain duplicate in a group of records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Thu Mar 01, 2007 11:29 pm    Post subject: Maintain duplicate in a group of records Reply with quote

My requirement is like :


Input :
-------
AAA - Group1
BBB
CCC11
CCC22
DDD

AAA - group2
CCC11
CCC11
DDD

AAA - group3
CCC22
EEE


The input file will have groups of records start from AAA and ends in any record DDD or EEE. Its like a group starts only with AAA.

1.When a CCC record occurs in a single group multiple times , all those records needs to be maintained.

2.If CCC record occurs in a group only once , that CCC record should be eliminated from the Group.

3. Eventhough CCC record occurs in a group multiple times and it has
same values in the 4th and 5th position then both CCC record should be eliminated Ex : CCC11 and CCC11 in a samegroup , both record should be eliminated , if CCC22 and CCC11 both should be written.

The output should be , for the input given above:
AAA - group1
BBB
CCC11
CCC22
DDD

AAA - group2
DDD

AAA - group3
EEE


This can be done in a program or SELCOPY(i haven't tried) , can it be done by means of JCL???

can anyone thorw some lights on this...
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Mar 02, 2007 4:12 am    Post subject: Reply with quote

NO - JCL lets the machine know which programs you want to execute and what datasets your program needs - not what data within the datasets. (If SELCOPY is not a program what is it?)
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Mar 02, 2007 6:26 am    Post subject: Reply with quote

Quote:

can it be done by means of JCL???



I assume you have atleast 2 years of mainframe experience. Now can you please educate me as to what YOU think JCL does?

I really wanna Know if JCL can do it why should I bother learning the syntax of utitlies and programs. It will save a lot of time and energy.

Please educate me .

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Fri Mar 02, 2007 8:56 am    Post subject: Reply with quote

Many times i have written a program for a certain requirement , but later when I come across the forum I found that the requirement i had is been done very simply...
many times yourself and Frank yeager has a solution that will make me surprised.

thats the reason why i have posted the query...the solution seems to be
reachable either by jcl or by some utilities...

How can i educate you kolusu ??? Smile , I am just 2 yrs old in mainframe...
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Mar 02, 2007 9:14 am    Post subject: Reply with quote

If after 2 years in a mainframe environment you do not know what JCL is for and how it differs from other languages and tools then i am surprised that the world still spins on its axis. Get yourself on a JCL course - you should have gone on one within 1 week of starting on a mainframe. Actually there is an online one provided by IBM - there is a link in one of the forums - or maybe several of them - otherwise just go to IBM's website and search on JCL Course or similar. I was looking at it the other day because you never know when something new will pop up. I'm sure Kolusu will be able to offer you a more simple and surprising answer!
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Mar 02, 2007 9:17 am    Post subject: Reply with quote

mainframemouli,

either you are being facetious or your command of english is rudimentary.

JCL = Job Control Language As Nic said, JCL does not do anything other than establish an environment in which the STEPs of the JOB can be run (execute).

Sort Control Cards ARE NOT JCL

Quote:
reachable either by jcl or by some utilities


should be
Code:
achievable by some utility



Quote:
How can i educate you kolusu ??? Smile , I am just 2 yrs old in mainframe...


your attempt at humor is wasting the boards time; I am answering you because you have missed the point. you do not seem to know what JCL is.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Mar 02, 2007 11:48 am    Post subject: Reply with quote

mainframemouli,

What would you expect for the output records if the input records were:

Code:

AAA                 - Group1
BBB
CCC11
CCC11
CCC22
DDD   
AAA                 - Group2
BBB
CCC11
CCC11
CCC22
CCC22
CCC22
DDD
AAA                 - Group3
BBB
CCC11
CCC11
CCC11
DDD

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Sat Mar 03, 2007 2:00 am    Post subject: Reply with quote

dbzTHEdinosauer,Nic Clouston.
I undrestood the mistake of mine. I should not mentioned it as jcl or should not have posted in this category. I assure you that it won't happen again.

Frank,

The output for the input you have mentioned will be.

Code:

AAA                 - Group1
BBB
CCC11
CCC22
DDD   
AAA                 - Group2
BBB
CCC11
CCC22
DDD
AAA                 - Group3
BBB
DDD


In group 1 the First occurance of CCC11 is eliminated .
In group 2 1 occurance of CCC11 and Last two occurance of CCC22 got eliminated.
In group 3 all the occurance of CCC11 has been eliminated.

The basic idea is CCC11 record should be followed by a CCC22 record , if so that combination need to be maintained else if only CCC11 or CCC22
occurs in a group ( AAA is the starting of the group) those records needs to be eliminated.

Thats why in Group 1 first occurance of CCC11 got eliminated since it doesn't have a CCC22 record folowing it. In Group 2 the first occurance of CCC11 got eliminated and last two CCC22 , in group 3 no combination CCC11 and CCC22 hence all the CCC's got eliminated.
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Sat Mar 03, 2007 5:02 pm    Post subject: Reply with quote

mainframemouli,

Can we test CCC11 & CCC22 as fixed value like in this example ?

IFTHEN WHEN=(1,5,CH,EQ,C'CCC11') ... ?

Alain
Back to top
View user's profile Send private message
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Sun Mar 04, 2007 9:36 pm    Post subject: Reply with quote

Alain,
As you said the CCC11 and CCC22 are fixed values and you can test the way as you have mentioned in the IF THEN.
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Mon Mar 05, 2007 6:30 am    Post subject: Reply with quote

mainframemouli,

here is the a solution :
Code:

//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD *
AAA - GROUP1
BBB
CCC11-1
CCC22-1
DDD
AAA - GROUP2
CCC11-1
CCC11-2
DDD
AAA - GROUP3
CCC22-1
EEE
AAA - GROUP4
BBB
CCC11-1
CCC11-2
CCC22-1
DDD
AAA - GROUP5
BBB
CCC11-1
CCC11-2
CCC22-1
CCC22-2
CCC22-3
DDD
AAA - GROUP6
BBB
CCC11-1
CCC11-2
CCC11-3
DDD
/*
//OUT1     DD DISP=(NEW,DELETE,DELETE),
//            DSN=&OUT1,UNIT=SYSDA,SPACE=(TRK,(1,1))
//OUT2     DD DISP=(MOD,DELETE,DELETE),
//            DSN=&OUT2,UNIT=SYSDA,SPACE=(TRK,(1,1))
//OUT3     DD DISP=(NEW,DELETE,DELETE),
//            DSN=&OUT3,UNIT=SYSDA,SPACE=(TRK,(1,1))
//OUTX     DD SYSOUT=*
//TOOLIN   DD *
  SELECT FROM(IN) TO(OUT1) USING(ICE0) ON(1,5,CH) LAST
  SELECT FROM(OUT1) TO(OUT2) USING(ICE1) ON(1,3,CH) ALLDUPS -
  DISCARD(OUT3)
  COPY FROM(OUT3) TO(OUT2) USING(ICE2)
  SORT FROM(OUT2) TO(OUTX) USING(ICE3)
/*
//ICE0CNTL DD *
  SORT FIELDS=(COPY)
/*
//ICE1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,5,ZD)
  SORT FIELDS=(COPY)
/*
//ICE2CNTL DD *
  OMIT COND=(1,3,CH,EQ,C'CCC')
/*
//ICE3CNTL DD *
  SORT FIELDS=(81,5,ZD,A)
/*

the result is
Code:

AAA - GROUP1
BBB
CCC11-1
CCC22-1
DDD
AAA - GROUP2
DDD
AAA - GROUP3
EEE
AAA - GROUP4
BBB
CCC11-2
CCC22-1
DDD
AAA - GROUP5
BBB
CCC11-2
CCC22-3
DDD
AAA - GROUP6
BBB
DDD

Alain
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Mon Mar 05, 2007 6:32 am    Post subject: Reply with quote

Alain Benveniste wrote:
mainframemouli,

here is the a solution :
Code:

//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD *
AAA - GROUP1
BBB
CCC11-1
CCC22-1
DDD
AAA - GROUP2
CCC11-1
CCC11-2
DDD
AAA - GROUP3
CCC22-1
EEE
AAA - GROUP4
BBB
CCC11-1
CCC11-2
CCC22-1
DDD
AAA - GROUP5
BBB
CCC11-1
CCC11-2
CCC22-1
CCC22-2
CCC22-3
DDD
AAA - GROUP6
BBB
CCC11-1
CCC11-2
CCC11-3
DDD
/*
//OUT1     DD DISP=(NEW,DELETE,DELETE),
//            DSN=&OUT1,UNIT=SYSDA,SPACE=(TRK,(1,1))
//OUT2     DD DISP=(MOD,DELETE,DELETE),
//            DSN=&OUT2,UNIT=SYSDA,SPACE=(TRK,(1,1))
//OUT3     DD DISP=(NEW,DELETE,DELETE),
//            DSN=&OUT3,UNIT=SYSDA,SPACE=(TRK,(1,1))
//OUTX     DD SYSOUT=*
//TOOLIN   DD *
  SELECT FROM(IN) TO(OUT1) USING(ICE0) ON(1,5,CH) LAST
  SELECT FROM(OUT1) TO(OUT2) USING(ICE1) ON(1,3,CH) ALLDUPS -
  DISCARD(OUT3)
  COPY FROM(OUT3) TO(OUT2) USING(ICE2)
  SORT FROM(OUT2) TO(OUTX) USING(ICE3)
/*
//ICE0CNTL DD *
  SORT FIELDS=(COPY)
/*
//ICE1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,5,ZD)
  SORT FIELDS=(COPY)
/*
//ICE2CNTL DD *
  OMIT COND=(1,3,CH,EQ,C'CCC')
/*
//ICE3CNTL DD *
  SORT FIELDS=(81,5,ZD,A)
  OUTREC FIELDS=(1,80)
/*

the result is
Code:

AAA - GROUP1
BBB
CCC11-1
CCC22-1
DDD
AAA - GROUP2
DDD
AAA - GROUP3
EEE
AAA - GROUP4
BBB
CCC11-2
CCC22-1
DDD
AAA - GROUP5
BBB
CCC11-2
CCC22-3
DDD
AAA - GROUP6
BBB
DDD

Alain
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Mon Mar 05, 2007 6:33 am    Post subject: Reply with quote

the last one is the good one
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Mar 05, 2007 8:55 am    Post subject: Reply with quote

Here is an alternative job of getting the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL       
//TOOLMSG  DD SYSOUT=*           
//DFSMSG   DD SYSOUT=*           
//IN       DD *                   
AAA - GROUP1                     
BBB                               
CCC11-1                           
CCC22-1                           
DDD                               
AAA - GROUP2                     
CCC11-1                           
CCC11-2                           
DDD                               
AAA - GROUP3                     
CCC22-1                           
EEE                               
AAA - GROUP4                     
BBB                               
CCC11-1                           
CCC11-2                           
CCC22-1                           
DDD                               
AAA - GROUP5                     
BBB                               
CCC11-1                           
CCC11-2                           
CCC22-1                           
CCC22-2                           
CCC22-3                           
DDD                               
AAA - GROUP6                     
BBB                               
CCC11-1                           
CCC11-2                           
CCC11-3                           
DDD                               
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)         
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)         
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                   
  SORT FROM(IN) TO(T1) USING(CTL1)                               
  SPLICE FROM(T1) TO(T2) ON(89,8,CH)  WITH(1,88) WITH(115,08) -   
  WITHALL KEEPBASE USING(CTL2)                                   
  SORT FROM(T2) USING(CTL3)                                       
//CTL1CNTL DD *                                                   
  SORT FIELDS=(89,16,CH,A)                                       
  SUM FIELDS=NONE                                                 
  INREC IFTHEN=(WHEN=INIT,                                       
       OVERLAY=(081:SEQNUM,8,ZD,                                 
                089:SEQNUM,8,ZD)),                               
                                                                 
        IFTHEN=(WHEN=(01,03,CH,NE,C'AAA'),                       
       OVERLAY=(097:SEQNUM,8,ZD,                                 
                089:089,8,ZD,SUB,097,8,ZD,M11,LENGTH=8),HIT=NEXT),
                                                                 
        IFTHEN=(WHEN=(01,05,SS,EQ,C'CCC11,CCC22'),               
       OVERLAY=(097:01,05,3X),HIT=NEXT),                         
                                                                 
        IFTHEN=(WHEN=(97,05,CH,EQ,C'CCC11'),                     
       OVERLAY=(107:SEQNUM,8,ZD,RESTART=(89,16)),HIT=NEXT),       
                                                                 
        IFTHEN=(WHEN=(97,05,CH,EQ,C'CCC22'),                     
       OVERLAY=(115:SEQNUM,8,ZD,RESTART=(89,16)),HIT=NEXT),       
                                                                 
        IFTHEN=(WHEN=(107,08,ZD,GT,1),                           
       OVERLAY=(107:C'00000001')),                               
                                                                 
        IFTHEN=(WHEN=(115,08,ZD,GT,1),                           
       OVERLAY=(115:C'00000001')),                               
                                                                 
        IFTHEN=(WHEN=NONE,                                       
       OVERLAY=(089:SEQNUM,8,ZD))                                 
/*
//CTL2CNTL DD *                                 
  SORT FIELDS=(089,08,CH,A,                     
               115,08,CH,D)                     
                                               
  OUTFIL FNAMES=T2,                             
  OMIT=(1,5,CH,EQ,C'CCC11',AND,97,8,CH,EQ,C' ')
/*                                             
//CTL3CNTL DD *                                 
  SORT FIELDS=(081,08,CH,A)                     
  OUTFIL FNAMES=OUT,                           
  OUTREC=(01,80)                               
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Wed Mar 07, 2007 1:36 am    Post subject: Reply with quote

Thanks a lot for everyone , the second solution from Alian is excellent...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group