View previous topic :: View next topic
|
Author |
Message |
lanand_hps
New User
Joined: 05 Dec 2007 Posts: 82 Location: chennai
|
|
|
|
Hi,
My requirement is to count the number of duplicates in the file and if there are duplicates i should set the jcl return code to 8.
I read how to put duplicate records in a file but how do i find the count and use it in jcl to set the return code?
Thanks in advance. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Please show an example of the records in your input file (relevant fields only) for each case (dups, no dups) and what you expect for output and the return code. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields. |
|
Back to top |
|
|
lanand_hps
New User
Joined: 05 Dec 2007 Posts: 82 Location: chennai
|
|
|
|
Hi Frank,
The LRECL is 250 and record format is FB.
The file will have a header record (first 3 character - 001), a footer (first 3 characters - 003) and the actual records will be in between (first 3 characters - 002)
This is my input file -
001 FILE-NAME
002 AAAA BAIND INDILIASDF 12345
002 BBBB BASD SDAFASFA 45678
002 BBBB ASDE ADFADSFF 5789
002 CCCC ASDF ERTERTRR 9878
003 END-OF-FILE
I need to sort this file to find out duplicates from 5th to 8 column.
Output :
001 FILE-NAME
002 AAAA BAIND INDILIASDF 12345
002 BBBB BASD SDAFASFA 45678
002 CCCC ASDF ERTERTRR 9878
003 END-OF-FILE
In the above example, there is one duplicate record with BBBB from 5th column. I need to check if there are duplicates. If the count is 0, i ll continue the processing. Otherwise, i need to set a return code of 8. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
lanand_hps,
The following DFSORT/ICETOOL JCl will give you the desired results. If there are any duplicate records step0200 will set a return code of 8.
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=your input 250 byte file,
// DISP=SHR
//OUT1 DD DSN=Your output file without dups,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//OUT2 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//TOOLIN DD *
SELECT FROM(IN) TO(OUT1) ON(1,8,CH) NODUPS DISCARD(OUT2)
/*
//********************************************
//STEP0200 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//DUPS DD DSN=&&T1,DISP=SHR
//SYSIN DD *
PRINT INFILE(DUPS) CHARACTER COUNT(1)
IF LASTCC=0 THEN SET MAXCC=8
/*
|
Hope this helps...
Cheers |
|
Back to top |
|
|
lanand_hps
New User
Joined: 05 Dec 2007 Posts: 82 Location: chennai
|
|
|
|
Thanks ..
The forum and the members again and again prove that NOTHING IS IMPOSSIBLE...
thanks a lot! |
|
Back to top |
|
|
|