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
 

 

Pick random records and only 100k records

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

New User


Joined: 10 Apr 2014
Posts: 4
Location: USA

PostPosted: Tue Apr 15, 2014 6:27 pm    Post subject: Pick random records and only 100k records
Reply with quote

I am new to this forum. This is my first post ever. Any help is appreciated. I have an input file with 500k records. The length of the file is 300 bytes. There is a 6 digit broker code(stock broker) and an 8 digit account code(associated with the broker) in the file. There are records with one broker with one account and one broker with multiple accounts. I need to pick only 100k records covering all the brokers.

Input data:
A/C no. Broker #
02092849 020999
08000010 080102
08000011 080102
08005213 080102
.................................
............. 500k rows

Output data:
02092849 020999
08000010 080102
................................
............ 100k rows
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Apr 15, 2014 6:36 pm    Post subject:
Reply with quote

You mean you need the first 100k records with unique broker codes?
Back to top
View user's profile Send private message
kpadmanabhuni

New User


Joined: 10 Apr 2014
Posts: 4
Location: USA

PostPosted: Tue Apr 15, 2014 6:47 pm    Post subject:
Reply with quote

There are around 13,000 broker codes in the file. So I need 100k records that covers all 13,000 brokers. So around 7 duplicate accounts for every broker. The important thing is the output file should have all broker codes.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Apr 15, 2014 7:16 pm    Post subject: Reply to: Pick random records and only 100k records
Reply with quote

Quote:
There are around 13,000 broker codes in the file. So I need 100k records that covers all 13,000 brokers. So around 7 duplicate accounts for every broker. The important thing is the output file should have all broker codes.


with one pass of data You might get
13000 * 7
or
13000 * 8

assuming that every broker has at least 7 or 8 accounts

if some brokers have less accounts noo way to extract more from the others

search for GROUP/RESTART/SEQNO
and select for output only the records with a SEQNO less than 7 or 8

quite a few similar samples around
Back to top
View user's profile Send private message
kpadmanabhuni

New User


Joined: 10 Apr 2014
Posts: 4
Location: USA

PostPosted: Tue Apr 15, 2014 7:31 pm    Post subject:
Reply with quote

I really appreciate if you can send me the link to appropriate post or please paste the control card. Remember I need exactly 100k records and it should have all the brokers. Please please please paste the JCL in you response.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Apr 15, 2014 7:59 pm    Post subject: Reply to: Pick random records and only 100k records
Reply with quote

Quote:
Remember I need exactly 100k

then You cannot have with SORT

You will have to adjust for differences

You MUST write two PROGRAMS

the first one to count
the second one to extract

100000 / 13000 ==> 7.69.....

You will have to extract in some cases 7 in some other 8
and You must take into considerations if a broker has less than 7 accounts
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Apr 15, 2014 8:28 pm    Post subject: Reply to: Pick random records and only 100k records
Reply with quote

here is a tested snippet
to extract from each MAIN key the first seven records

the snippet
Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,
 000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=H
 000003 //*
 000004 //CLEAUP  EXEC PGM=CLEANUP
 000005 //STEPLIB   DD DISP=SHR,DSN=HERC.LINKLIB
 000006 //*
 000007 //S1      EXEC PGM=SORT
 000008 //SYSPRINT  DD SYSOUT=*
 000009 //SYSOUT    DD SYSOUT=*
 000010 //SORTIN    DD *
 000011 BRK1 ACCT1
 000012 BRK1 ACCT2
 000013 BRK1 ACCT3
 000014 BRK1 ACCT4
 000015 BRK1 ACCT5
 000016 BRK1 ACCT6
 000017 BRK1 ACCT7
 000018 BRK1 ACCT8
 000019 BRK1 ACCT9
 000020 BRK2 ACCT1
 000021 BRK2 ACCT2
 000022 BRK2 ACCT3
 000023 BRK2 ACCT4
 000024 BRK2 ACCT5
 000025 BRK2 ACCT6
 000026 BRK2 ACCT7
 000027 BRK2 ACCT8
 000028 BRK2 ACCT9
 000029 BRK3 ACCT1
 000030 BRK3 ACCT2
 000031 BRK3 ACCT3
 000032 //SORTOUT   DD SYSOUT=*,
 000033 //             DCB=(RECFM=FB,LRECL=80)
 000034   SORT   FIELDS=COPY
 000035   INREC  IFOUTLEN=80,
 000036          IFTHEN=(WHEN=INIT,OVERLAY=(21:SEQNUM,4,ZD,RESTART=(1,4)))
 000037   OUTFIL BUILD=(1,80),INCLUDE=(21,4,ZD,LT,8)
 000038 //*
 ****** **************************** Bottom of Data ****************************


the result
Code:
 ********************************* TOP OF DATA **********************************
BRK1 ACCT1          0001
BRK1 ACCT2          0002
BRK1 ACCT3          0003
BRK1 ACCT4          0004
BRK1 ACCT5          0005
BRK1 ACCT6          0006
BRK1 ACCT7          0007
BRK2 ACCT1          0001
BRK2 ACCT2          0002
BRK2 ACCT3          0003
BRK2 ACCT4          0004
BRK2 ACCT5          0005
BRK2 ACCT6          0006
BRK2 ACCT7          0007
BRK3 ACCT1          0001
BRK3 ACCT2          0002
BRK3 ACCT3          0003
******************************** BOTTOM OF DATA ********************************


modify accordingly
Back to top
View user's profile Send private message
kpadmanabhuni

New User


Joined: 10 Apr 2014
Posts: 4
Location: USA

PostPosted: Wed Apr 16, 2014 12:57 am    Post subject:
Reply with quote

Awesome. It works. Thank you so much.
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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