View previous topic :: View next topic
|
Author |
Message |
Michael Simpson
New User
Joined: 27 Sep 2012 Posts: 6 Location: Sweden
|
|
|
|
First of all, let me confess that I have never written any ICETOOL JCL (but am willing to learn).
Could someone point me in the right direction (or tell me it can't be done so I don't waste time).
I have an input file of about 900,000 records. I would like to be able to extract a random number of records from this file based on the following criteria:-
- start/end records should be included (these are identified by specific values in cols 1-2 and are obviously at the start and end of the file)
- selection should be done for a specific value in a specific column for all records other that the start/end records
- a specific randomized number of records from item 2 should be selected after which the JCL should "stop" (apart from then reading to the end so as to include the end record)
Is this easily doable or should I go with an easytrieve program instead (or even a tailor-written Cobol program) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
There are no DFSort functions for selection of random data.
There is a SAMPLE function, but I don't think it does random sampling.
You might consider a E15/35 "exit", but it would probably be "over the top" for the task.
From Easytrieve Plus you'd likely have to use a callable Language Environment routine to get something "random" to work with.
Cobol has an intrinsic function. |
|
Back to top |
|
|
Michael Simpson
New User
Joined: 27 Sep 2012 Posts: 6 Location: Sweden
|
|
|
|
Thanks Bill for the speedy reply.
Tailor-made it'll have to be then. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Michael Simpson,
While you work on tailor-made solution, could you please post sample records and expected output. Also post your actual LRECL and DFSort function level.
Thanks, |
|
Back to top |
|
|
Michael Simpson
New User
Joined: 27 Sep 2012 Posts: 6 Location: Sweden
|
|
|
|
was
Quote: |
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
|
As to sample records, I'll have to get back to you on that - have none at the moment |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Michael Simpson wrote: |
First of all, let me confess that I have never written any ICETOOL JCL (but am willing to learn).
Could someone point me in the right direction (or tell me it can't be done so I don't waste time).
I have an input file of about 900,000 records. I would like to be able to extract a random number of records from this file based on the following criteria:-
- start/end records should be included (these are identified by specific values in cols 1-2 and are obviously at the start and end of the file)
- selection should be done for a specific value in a specific column for all records other that the start/end records
- a specific randomized number of records from item 2 should be selected after which the JCL should "stop" (apart from then reading to the end so as to include the end record)
Is this easily doable or should I go with an easytrieve program instead (or even a tailor-written Cobol program) |
DFSORT does not have Random function generator. If the columns are you want to pick are numeric, then you can use Date/Time stamps as random generation key and pull only such records.
Ex: current time is 12:11:35 you can pass parms to add/subtract/mul/div a constant(which can be modified from each run) via JPn construct and pick the records.
If it is a column data , then you can use IEBDG utility to generate ripple character data and use that to pick records using Joinkeys.
Let us know if the above techniques are acceptable and we can show you a way to extract records. |
|
Back to top |
|
|
Michael Simpson
New User
Joined: 27 Sep 2012 Posts: 6 Location: Sweden
|
|
|
|
Quote: |
If it is a column data , then you can use IEBDG utility to generate ripple character data and use that to pick records using Joinkeys. |
Sorry - never heard the expression ripple character data - no idea what it means.
Be that as it may .... I basically would like to be able to select a number of records based on, say, the value 888888888888 in columns 13-28.
If it makes the logic easier, I could easily extract the end record, place it in a separate file so it could be appended to the 900,000 file rather than reading the latter all the way through to the end. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Michael Simpson wrote: |
Sorry - never heard the expression ripple character data - no idea what it means. |
If you have a six-byte field containing "ABCDEF" and ripple it once, the field will then contain either "BCDEFA" or "BCDEFG", depending on the exact definition of the field.
SFAIK, it's a term used only in regards to IEBDG, which sees very little use these days (although it's come up several times recently on this and our sister site). |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Michael Simpson,
Quote: |
Be that as it may .... I basically would like to be able to select a number of records based on, say, the value 888888888888 in columns 13-28.
If it makes the logic easier, I could easily extract the end record, place it in a separate file so it could be appended to the 900,000 file rather than reading the latter all the way through to the end. |
Sample Data??
If you know the number of records you want to select whenever you have a record with 888888888888 at 13-28, you can use GROUP function to add sequence number and later extract records based on that seq. number. If you know when the record selection ends (for example, 999999999999 on the same position or some other char. at a different position), you can use GROUP BEGIN and END.
Thanks, |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Or perhaps you can generate your random number somewhere else and generate your sort cards using the random number to STOPAFT. You would then have to get your trailer in by whatever other means that you had in mind. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Michael Simpson wrote: |
Quote: |
If it is a column data , then you can use IEBDG utility to generate ripple character data and use that to pick records using Joinkeys. |
Sorry - never heard the expression ripple character data - no idea what it means.
Be that as it may .... I basically would like to be able to select a number of records based on, say, the value 888888888888 in columns 13-28.
If it makes the logic easier, I could easily extract the end record, place it in a separate file so it could be appended to the 900,000 file rather than reading the latter all the way through to the end. |
Michael Simpson,
Check this link which explains IEBDG (Test Data Generator) Program
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2U170/4.0? |
|
Back to top |
|
|
|