Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Produce a random generated file through the use of DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Bill Ross

New User


Joined: 25 Jan 2007
Posts: 39
Location: Charleston SC

PostPosted: Sat Feb 24, 2007 3:12 am    Post subject: Produce a random generated file through the use of DFSORT
Reply with quote

Is there any way to produce a random generated file through the use of DFSORT or ICETOOL?

For example I have a 30,000 record file and I want to randomly select 3,000 of these records to produce an output file.

Thank you in advance

Bill Ross
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Feb 24, 2007 3:31 am    Post subject:
Reply with quote

You can use the OUTFIL SAMPLE operand to "sample" every n records, but of course that wouldn't be a random sample.

Here's an idea: Create fileA from the input file with sequence numbers added. Use a tool that can create random numbers to create fileB with 3000 randomly generated sequence numbers within the bounds 1-n where n is the number of records in the input file (not sure what that tool would be but there must be one). Use SELECT on the seqnum with FIRSTDUP against the concatenation of fileA and FileB.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Feb 24, 2007 4:05 am    Post subject:
Reply with quote

Bill,

Though it really isn't random, I've reformatted on inrec adding several (the more the merrier) sequence numbers to the end of the record, short 2 to 4 digit seqs, all with different starts and skip values such as some skipping every third, some skipping every seventh and so on.
Sort on that added key and stop after you get what you want using outrec to strip the added fields.

Bill
Back to top
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Sat Feb 24, 2007 11:23 pm    Post subject: Re: Produce a random generated file through the use of DFSOR
Reply with quote

You can also make use of the IEBDG utility to produce the random test data generation. Look in the "DFSMS/MVS Utilities" Manual in this site.

Dinesh.
Back to top
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Sat Feb 24, 2007 11:58 pm    Post subject: Re: Produce a random generated file through the use of DFSOR
Reply with quote

By using IEBDG you can add a column of random data at the end of the each record of the input file. The below is a sample one..,

Quote:
//RIPPLE JOB ...
//STEP1 EXEC PGM=IEBDG
//SYSPRINT DD SYSOUT=A
//SEQIN DD INPUT FILE (LRECL = 80)
//SEQOUT DD OUTPUT FILE (LRECL = 100)
//SYSIN DD *
DSD OUTPUT=(SEQOUT),INPUT=(SEQIN)
FD NAME=FIELD1,STARTLOC=81,LENGTH=6,PICTURE=5,'12345',ACTION=WV
FD NAME=FIELD2,STARTLOC=87,LENGTH=6,PICTURE=5,'67890',ACTION=WV
CREATE QUANTITY=30000,INPUT=SEQIN,NAME=(FIELD1,FIELD2)
END
/*

Sort based on the random column and SELECT the first 3000 records using DFSORT.

Dinesh.
Back to top
View user's profile Send private message
Bill Ross

New User


Joined: 25 Jan 2007
Posts: 39
Location: Charleston SC

PostPosted: Tue Feb 27, 2007 9:48 pm    Post subject: Thank you for your recommendations
Reply with quote

Thank you for your recommendations. I now have somewhere to begin my solution.
Back to top
View user's profile Send private message
Bill Ross

New User


Joined: 25 Jan 2007
Posts: 39
Location: Charleston SC

PostPosted: Thu Mar 01, 2007 1:05 am    Post subject: Selecting every Nth record
Reply with quote

Is there anyway through ICETOOL that would allow me to select every 59th record and generate an output file?

The input file contains lets say 65,000 records.

Also the output file needs to be exactly 300 records.

I will look thorough the forum for a possible solution.

Thank you in advance.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 01, 2007 1:47 am    Post subject:
Reply with quote

Bill,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OUTFIL STARTREC=59,SAMPLE=59,ENDREC=17700
/*
Back to top
View user's profile Send private message
Bill Ross

New User


Joined: 25 Jan 2007
Posts: 39
Location: Charleston SC

PostPosted: Thu Mar 01, 2007 1:54 am    Post subject: Thank you sir
Reply with quote

Thank you Frank.
Back to top
View user's profile Send private message
vishweshkrishnadevaram

New User


Joined: 17 Nov 2006
Posts: 7

PostPosted: Mon Feb 09, 2009 9:59 pm    Post subject: Reply to: Produce a random generated file through the use of
Reply with quote

Thanks. I was looking for a similar requirement and this post saved lot of time for me. icon_razz.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Feb 09, 2009 11:06 pm    Post subject: Reply to: Produce a random generated file through the use of
Reply with quote

Hello and welcome to the forum,

You're welcome and Thanks for letting us know icon_smile.gif

d
Back to top
View user's profile Send private message
Rindia

New User


Joined: 17 Jun 2009
Posts: 6
Location: Hyderabad

PostPosted: Mon Jul 13, 2009 10:54 am    Post subject: Re: Reply to: Produce a random generated file through the us
Reply with quote

Learning a lot by just a click. Thanks to all.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 13, 2009 8:16 pm    Post subject: Reply to: Produce a random generated file through the use of
Reply with quote

Hello and welcome to the forum,

Quote:
Learning a lot by just a click. Thanks to all.
You're welcome icon_smile.gif

"Lurk" a while and enjoy,

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Produce Mainframe Dash Board Reports ... sdcarlson53 All Other Mainframe Topics 2 Thu Jan 05, 2017 11:01 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us