IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Random selection of output data


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Michael Simpson

New User


Joined: 27 Sep 2012
Posts: 6
Location: Sweden

PostPosted: Thu Oct 04, 2012 12:43 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 04, 2012 3:35 pm
Reply with quote

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
View user's profile Send private message
Michael Simpson

New User


Joined: 27 Sep 2012
Posts: 6
Location: Sweden

PostPosted: Thu Oct 04, 2012 4:08 pm
Reply with quote

Thanks Bill for the speedy reply.

Tailor-made it'll have to be then.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Oct 04, 2012 8:03 pm
Reply with quote

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
View user's profile Send private message
Michael Simpson

New User


Joined: 27 Sep 2012
Posts: 6
Location: Sweden

PostPosted: Thu Oct 04, 2012 8:07 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 05, 2012 12:45 am
Reply with quote

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
View user's profile Send private message
Michael Simpson

New User


Joined: 27 Sep 2012
Posts: 6
Location: Sweden

PostPosted: Fri Oct 05, 2012 12:58 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Oct 05, 2012 3:01 pm
Reply with quote

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
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Oct 05, 2012 7:37 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Oct 05, 2012 8:00 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 05, 2012 9:21 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top