|
|
| Author |
Message |
MGayathri
New User
Joined: 19 May 2007 Posts: 25 Location: Chennai
|
|
|
|
I have few records with same keys repeated if I found a valid data in the first key I need to write out all the records with the same keys
Eg:
Input:
Key1 Valid-Date
Key1 Invalid-Date
Key1 Invalid-Date
Key2 Invalid-Date
Key2 Invalid-Date
Key3 Valid date
Key3 Invalid-Date
Ouput:
Key1 Valid-Date
Key1 Invalid-Date
Key1 Invalid-Date
Key3 Valid date
Key3 Invalid-Date |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4607 Location: San Jose, CA
|
|
|
|
What are the "rules" for determining if a date is valid or invalid?
What is the RECFM and LRECL of the input file?
What is the starting position, length and format of each relevant field?
What is the approx. maximum number of unique keys (e.g. key1, key2). |
|
| Back to top |
|
 |
MGayathri
New User
Joined: 19 May 2007 Posts: 25 Location: Chennai
|
|
|
|
1.The date is considered as invalid if it has spaces
2. The Recfm = FB and total Lrecl is 1454
3. Key Date Data
1-62byte 74-8 ----1454
4. Doest know the maximum number for repeated keys |
|
| Back to top |
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 1199 Location: At my desk
|
|
|
|
| Frank Yaeger wrote: |
| What are the "rules" for determining if a date is valid or invalid? |
| MGayathri wrote: |
| 1.The date is considered as invalid if it has spaces |
For all eight characters? Or just any of the eight being a space?
| Quote: |
| What is the starting position, length and format of each relevant field? |
| Quote: |
| Code: |
3. Key Date Data
1-62byte 74-8 ----1454 |
|
So 63 to 73 can be dropped? And the data start right after the date, at 82 till the last byte at 1454? Is that a length of 1373?
| Quote: |
| What is the approx. maximum number of unique keys (e.g. key1, key2). |
| Quote: |
| 4. Doest know the maximum number for repeated keys |
Is that do know or don't know the max number of duplicate or unique keys? |
|
| Back to top |
|
 |
MGayathri
New User
Joined: 19 May 2007 Posts: 25 Location: Chennai
|
|
|
|
I think the specification I made is not much clear clear.Let me explain the scenario again with example
Eg: INPUT
| Code: |
Key(1-62) Data(72,2) Date(74,8) Data(82-1373)
100F429A XX 20040421 AAAAAA
100F429A YY
1115A503 xx jjjjjjjjjjjjjj
1115A503 yy kkkkkkkkk
1115A588 XX 20060426 --------------
1115A588 XX -------------
1115A588 XX -------------- |
REQUIRED OUTPUT
| Code: |
Key(1-62) Data(72,2) Date(74,8) Data(82-1373)
100F429A XX 20040421 AAAAAA
100F429A YY
1115A588 XX 20060426 --------------
1115A588 XX -------------
1115A588 XX -------------- |
In this the number of repeated keys is unknown
I think this wud better explain the scenario required |
|
| Back to top |
|
 |
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 2977 Location: Tucson AZ
|
|
|
|
Is the 'coded' data in your post what you intended? (use notepad' to align).....
| Frank Yaeger wrote: |
| What is the approx. maximum number of unique keys (e.g. key1, key2). |
Please try answering the question, unique not repeated (though the repeated information might prove useful)...... |
|
| Back to top |
|
 |
MGayathri
New User
Joined: 19 May 2007 Posts: 25 Location: Chennai
|
|
|
|
| The keys are not uniquie it is having Duplicates.The maximum number duplicate key is around 25 |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 357 Location: San Jose
|
|
|
|
The following DFSORT/ICETOOL JCL will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=your input file,DISP=SHR
//OUT DD DSN=your output file,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(5,5),RLSE)
/*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1463,8,CH) -
WITHALL WITH(1,1462) KEEPBASE KEEPNODUPS USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62),SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1455,8,ZD,EQ,1),
OVERLAY=(1463:SEQNUM,8,ZD,74,8)),
IFTHEN=(WHEN=NONE,
OVERLAY=(1471:SEQNUM,8,ZD,
1463:1463,8,ZD,SUB,1471,8,ZD,M11,LENGTH=8))
SORT FIELDS=COPY
OUTFIL FNAMES=OUT,INCLUDE=(1471,8,CH,NE,C' '),BUILD=(1,1454)
/* |
Hope this helps... |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 78 Location: INDIA
|
|
|
|
Skolusu,
One small suggestion.
| Code: |
| OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62),SEQNUM,8,ZD)), |
Can be coded as
| Code: |
| OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62))), |
Logic is working fine but one small clarification about splice.Keepnodups is for keeping the records that are not spliced. Then how the sort is picking only this record
| Code: |
| 1115A588 XX -------------- |
how this record is omitted as this is also not spliced
| Code: |
| 1115A503 yy kkkkkkkkk |
Can you please explain the way splice way of working bit clearly.
Regards
Amar |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 357 Location: San Jose
|
|
|
|
| Quote: |
Skolusu,
One small suggestion.
| Code: |
OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62),SEQNUM,8,ZD)), |
Can be coded as
| Code: |
OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62))), |
|
NO you canNOT do that. We need 2 sequence numbers, the first sequence number is to identify the key and the next is identify the group.
| Quote: |
Logic is working fine
|
The only reason it worked for you because the omit condition is checking for not equal to space condition. Run your job removing the Include and build card on OUTFIL and you will notice how the grouping has gone wrong if you remove the seqnum.
| Quote: |
but one small clarification about splice.Keepnodups is for keeping the records that are not spliced. Then how the sort is picking only this record
| Code: |
1115A588 XX -------------- |
|
KEEPNODUPS parm is required to records which does not have a duplicate. for ex add the following record at the end and rerun the job
| Code: |
1115A589 zz 20060427 --------------
|
Without keepnodups parm SPLICE will eliminate the record, where as you need this record to be kept as the record has a valid date.
| Quote: |
Can you please explain the way splice way of working bit clearly.
|
Read the link given below. Frank has done a fantastic job explaining how splice works. Read the examples also.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/6.13? |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 78 Location: INDIA
|
|
|
|
I think I thought bit wrongly.Thanks for the clarification and help
Regards
Amar |
|
| Back to top |
|
 |
|
|
|