Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Extract record for change in combinational data using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Extract record for change in combinational data using SORT
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: 1932
Location: UK

PostPosted: Thu Nov 23, 2017 4:07 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Thu Nov 23, 2017 4:13 pm    Post subject: Reply to: Extract record for change in combinational data using SORT
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    Post subject:
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: 8619
Location: Back in jolly old England

PostPosted: Thu Nov 23, 2017 5:51 pm    Post subject:
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: 1932
Location: UK

PostPosted: Thu Nov 23, 2017 7:26 pm    Post subject:
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    Post subject:
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    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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 1 Thu Dec 14, 2017 8:13 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us