View previous topic :: View next topic
|
Author |
Message |
Anshul Das
New User
Joined: 10 Jan 2009 Posts: 6 Location: pune
|
|
|
|
This is my first post. I do tried to search the topic i wanted to ask & didn't find exact thing i was looking. Here is my question.
I am using ICETOOL for a file which is having for example 5000 records out of which only 30 records are distinct. Rest all are repetitions. The file is variable length of 4092 & key is starting from 1 byte & 15 in length.
I want a new file to have all records which have repetition more than 139 characters. ICETOOL higher option works only till 99. After it ,gives max cc 0012. I have tried sorkwnn option & dynalloc option as well(which not shown in sample jcl below). None of them worked. So need assistance ...... Thank you in advance!!
Sample JCL used:
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN= ABC,DISP=SHR
//SORTMH DD DSN=DEF,
// SPACE=(CYL,(150,50),RLSE),DISP=(,CATLG,CATLG),
// DCB=(RECFM=VB,LRECL=4092,BLKSIZE=0)
//TOOLIN DD *
SELECT FROM(IN) TO(SORTMH) ON(5,15,CH) HIGHER(139)
/* |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
HIGHER is 0-99. End of story.
What do you mean by "have all records which have repetition more than 139 characters". HIGHER does nothing remotely like those words in combination.
You need to be clear about what you want to do, not show random control cards that look like they contain a word related to your task.
If you can tell us what you want, clearly, we can tell you how to do it. |
|
Back to top |
|
|
Anshul Das
New User
Joined: 10 Jan 2009 Posts: 6 Location: pune
|
|
|
|
"have all records which have repetition more than 139 characters"
Sorry I phrased it wrong .
Here is example what i mean
Input file (First 15 bytes only)
123456789101111
123456789101111
.
.
.
10 times repeated
123456789101112
123456789101112
123456789101112
123456789101112
123456789101112
.
.
.
140 times repeated.
So this record 123456789101112 should be in output file as it qualifies >139 repetitions.
I am not sure if you mean higher option can't work beyond 99. If yes, is there a any other way to get duplicates >139 in a another file. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
A COPY operation in a plain SORT step. Extend the record to contain a sequence-number (large enough for your largest possible number of duplicates (and more)), with a RESTART= for the key value (5,15).
Then an OUTFIL with INCLUDE= (or OMIT=) to get the records you want, with a BUILD to return the record to its original content (drop the sequence-number).
Since you have variable-length records you want to extend at the beginning of the data. Lots of examples here. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Obviously not an interview question - moved to DFSort |
|
Back to top |
|
|
Anshul Das
New User
Joined: 10 Jan 2009 Posts: 6 Location: pune
|
|
|
|
Thank You Bill! Appreciate your response.
Here is the thing ... Original files may contain 10 millions records & i am not sure whether sequence (5,15) will repeat or not next time in input. So ideally file is dynamic.
If i am not wrong Outfil(SORT option) with OMIT will need a sequence, which is not fix here. |
|
Back to top |
|
|
kranthikumarb
Active User
Joined: 02 Jan 2009 Posts: 115 Location: Hyderabad
|
|
|
|
Code: |
SORT FIELDS=COPY
INREC OVERLAY=(4100:SEQNUM,3,ZD,RESTART=(5,15))
OUTFIL FNAMES=SORTOUT,INCLUDE(4100,3,ZD,EQ,140),BUILD=(1,4092)
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Anshul Das,
If you are saying the keys may not be contiguous, then there is no reasonable way to do it (for the size of your file) without SORTing the data.
I have no clue about what you may mean by "dynamic" in that context, so you'll have to clear that up. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
kranthikumarb,
That is for fixed-length records. OP has variable-length records. |
|
Back to top |
|
|
Anshul Das
New User
Joined: 10 Jan 2009 Posts: 6 Location: pune
|
|
|
|
Bill, What i mean is this file is a monthly file.....
So Here is sample for
March
123456789101111
.
.
.
20 times
123456789101112
.
.
.
140 times
So here 123456789101112 should be written to sort file.
Next Month File -April
123456789101111
.
.
.
10 times
123456789101113
.
.
.
50 times
123456789101114
.
.
.
.
203 times
123456789101116
.
.
.
150 times
So record 123456789101112 is not present in April month.
Here Sort file should contain 123456789101114 & 123456789101116. |
|
Back to top |
|
|
kranthikumarb
Active User
Joined: 02 Jan 2009 Posts: 115 Location: Hyderabad
|
|
|
|
Bill, you are correct. I tried with FB before. How about the below?
Code: |
//SORT1 EXEC PGM=ICETOOL
//SEND DD DSN=&&SEND,UNIT=SYSDA,SPACE=(CYL,(50,100)),
// DISP=(,PASS)
//CATCH DD DSN=*.SEND,DISP=(OLD,PASS),VOL=REF=*.SEND
//TOOLIN DD *
COPY FROM(SORTIN) TO(SEND) USING(CTL1)
COPY FROM(CATCH) TO(SORTOUT) USING(CTL2)
/*
//CTL1CNTL DD *
SORT FIELDS=(5,15,CH,A)
/*
//CTL2CNTL DD *
INREC OVERLAY=(4100:SEQNUM,3,ZD,RESTART=(5,15))
OUTFIL FNAMES=SORTOUT,INCLUDE(4100,3,ZD,EQ,140),BUILD(1,4,5,4088)
/*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=INPUT.FILE
//SORTOUT DD DISP=SHR,DSN=OUTPUT.FILE
|
|
|
Back to top |
|
|
Anshul Das
New User
Joined: 10 Jan 2009 Posts: 6 Location: pune
|
|
|
|
Thank You very much Kranthi!!
I will try & let you know the result. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
kranthikumarb,
I haven't looked at your code (I will) but there is absolutely no need for two passes of the data. No need to use ICETOOL.
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,4,nX,5)), |
Where "n" is the length of the sequence number.
Then after you have used the sequence number field and don't need it any more:
Where "n+5" gives you the location, in the new current record created in the furst BUILD, of the original data.
There's lots of examples of this here. |
|
Back to top |
|
|
Anshul Das
New User
Joined: 10 Jan 2009 Posts: 6 Location: pune
|
|
|
|
Hello, updating late.
Kranthi , your sort card has worked perfectly well. Thanks for help!
Initially it was confusing ..but i went through some of some manuals & i was able to get what this CTL2 was doing. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ansul,
Maybe you'd like to post your control cards, just in case? |
|
Back to top |
|
|
|