View previous topic :: View next topic
|
Author |
Message |
Trinadh
New User
Joined: 05 Mar 2009 Posts: 20 Location: Pune
|
|
|
|
Hi,
I have a FB file of length 15 bytes as below.
First 10 bytes is Employee name(PD) and next 5 bytes of data can be in a combination of flags(example YYYYY) as below.
There could be millions of records per each combination or may not exist,but I want to extract 10 records for each combination exists in the file.
Input file :
EMP NAME 1YYYYY
EMP NAME 2YYYYY
EMP NAME 3YYYYY
EMP NAME 4YYYYY
EMP NAME 5YYYYY
EMP NAME 6YYYYY
EMP NAME 7YYYYY
EMP NAME 8YYYYY
EMP NAME 9YYYYY
EMP NAME10YYYYY
EMP NAME11YYYYY
EMP NAME12YYYYY
EMP NAME13YYYYY
EMP NAME14YYYYY
EMP NAME15YYYYN
EMP NAME16YYYYN
EMP NAME17YYYNY
EMP NAME18YYNYY
Output file:
EMP NAME 1YYYYY
EMP NAME 2YYYYY
EMP NAME 3YYYYY
EMP NAME 4YYYYY
EMP NAME 5YYYYY
EMP NAME 6YYYYY
EMP NAME 7YYYYY
EMP NAME 8YYYYY
EMP NAME 9YYYYY
EMP NAME10YYYYY
EMP NAME15YYYYN
EMP NAME16YYYYN
EMP NAME17YYYNY
EMP NAME18YYNYY |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Your output data set (not a file) looks to be exactly the same as your input data set (not a file).
Please show something meaningful. Perhaps make you requirement to extract 3 records to make a reasonable example size. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
once in while the TS posted the right thing
in the output EMP NAME11YYYYY thru EMP NAME14YYYYY are missing
add a sequence number on each group of flags and keep only the sequence numbers <lessorequal> the number You want to keep
gazillions of examples in the forum |
|
Back to top |
|
|
Trinadh
New User
Joined: 05 Mar 2009 Posts: 20 Location: Pune
|
|
|
|
Hi,
The input and output files are not same.
" The output EMP NAME11YYYYY thru EMP NAME14YYYYY are missing"
They are not required as per my requirement, brcause the first combination is YYYYY and has more than 10 employees.I need only 10 employees for every combination.
The next combination is YYYYN, there are two employees only and as I require 10 for each combination,so two records should be written to output file.
The next combination is YYYNY, only one employee exists and as I require 10 per each combination, one record should be written to output file.
The next combination is YYNYY,only one employee exists and as I require 10 per each combination,one record should be written to output file.
There could be 32 combinations like this.
Hope I'm clear |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Do I understand your request correctly .....
You want only 10 employee numbers per combination of flags
I assume numbers rather than names as stated as I understand PD to be packed decimal.
So, if I am correct you need to sort the records into flag sequence order adding a counter / sequence number field to each combination and then selecting, as Enrico has said, those with a counter value of 10 or less.
Again as said by Enrico, there are many examples on the forum. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Meanwhile, I shall go to the opticians! |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Something like this would work for you?
Code: |
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:SEQNUM,2,ZD,RESTART=(11,5))
OUTFIL BUILD=(1,80),INCLUDE=(81,2,ZD,LE,10)
/*
|
Thanks,
Ashwin. |
|
Back to top |
|
|
|