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

Extract record for change in combinational data using SORT


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

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Thu Nov 23, 2017 3:32 pm
Reply with quote

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

Global Moderator


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

PostPosted: Thu Nov 23, 2017 4:07 pm
Reply with quote

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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Nov 23, 2017 4:13 pm
Reply with quote

once in while the TS posted the right thing icon_wink.gif
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
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Thu Nov 23, 2017 5:44 pm
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 23, 2017 5:51 pm
Reply with quote

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

Global Moderator


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

PostPosted: Thu Nov 23, 2017 7:26 pm
Reply with quote

Meanwhile, I shall go to the opticians!
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Nov 24, 2017 3:54 pm
Reply with quote

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
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 SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top