View previous topic :: View next topic
|
Author |
Message |
kpadmanabhuni
New User
Joined: 10 Apr 2014 Posts: 4 Location: USA
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
You mean you need the first 100k records with unique broker codes? |
|
Back to top |
|
|
kpadmanabhuni
New User
Joined: 10 Apr 2014 Posts: 4 Location: USA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
kpadmanabhuni
New User
Joined: 10 Apr 2014 Posts: 4 Location: USA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
kpadmanabhuni
New User
Joined: 10 Apr 2014 Posts: 4 Location: USA
|
|
|
|
Awesome. It works. Thank you so much. |
|
Back to top |
|
|
|