IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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: 2431
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

Senior Member


Joined: 14 Mar 2007
Posts: 10695
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: 8793
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: 2431
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 All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
This topic is locked: you cannot edit posts or make replies. Splice JCL into one record for DD sta... SYNCSORT 2
No new posts How to find which file contains my se... DFSORT/ICETOOL 6
No new posts Changing Data Type SYNCSORT 4
No new posts Copying data from prev record using SORT SYNCSORT 19

Back to Top