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

Select records after the master data record


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

New User


Joined: 19 Feb 2008
Posts: 15
Location: chennai

PostPosted: Tue Jun 30, 2009 2:55 pm
Reply with quote

Hi friends,

i want to copy the 'n' records after the master record (only one master record will be there in a file)....

master record can be found a definite value in a particular position....

an example

Code:
----+----1----+----2----+----3
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 v3 v35`353
12 413r 3 25 456b46
adasfsdf liht2385 ldfdgsdgf
1   ancd     235
2   sample  4235
3   sapl     346
4   wetwe    356
5   wegf    5789
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 sqtgwergyw t
----+----1----+----2----+----3


master record is ==> liht2385 in pos 10

i want 5 records after the master record...

likely output is..

Code:
1   ancd     235
2   sample  4235
3   sapl     346
4   wetwe    356
5   wegf    5789


is it possible by default IBM utilities...such as sort, iceman, icetool....etc..?

Thanks in advance friends....
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Jun 30, 2009 7:18 pm
Reply with quote

Fact considered here is
Quote:
(only one master record will be there in a file)....

Also LRECL=80 assumed

Below step will give you required output...

Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD *                   
qwfgef dfgdfgsdgdsgf21414         
dasfsf qe 124 v3 v35`353           
12 413r 3 25 456b46               
adasfsdf liht2385 ldfdgsdgf       
1   ancd     235                   
2   sample  4235                   
3   sapl     346                   
4   wetwe    356                   
5   wegf    5789                   
qwfgef dfgdfgsdgdsgf21414         
dasfsf qe 124 sqtgwergyw t                                 
/*                                                         
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(10,8,CH,EQ,C'liht2385'),
       PUSH=(81:SEQ=8))                                   
  OUTFIL INCLUDE=(81,8,ZD,GT,1,AND,81,8,ZD,LE,6),BUILD=(1,80)           
/*                                                         


Quote:
is it possible by default IBM utilities...such as sort, iceman, icetool....etc..?

Do you think they are different?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jun 30, 2009 9:46 pm
Reply with quote

Here's another way to do it with DFSORT:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 v3 v35`353
12 413r 3 25 456b46
adasfsdf liht2385 ldfdgsdgf
1   ancd     235
2   sample  4235
3   sapl     346
4   wetwe    356
5   wegf    5789
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 sqtgwergyw t
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(10,8,CH,EQ,C'liht2385'),
     RECORDS=6,PUSH=(81:ID=1))
  OUTFIL OMIT=(10,8,CH,EQ,C'liht2385',OR,81,1,CH,EQ,C' '),
   BUILD=(1,80)                                           
/*
Back to top
View user's profile Send private message
senthilmurugan

New User


Joined: 19 Feb 2008
Posts: 15
Location: chennai

PostPosted: Fri Dec 21, 2012 4:28 pm
Reply with quote

icon_razz.gif Thanks a lot icon_smile.gif BTW sry for the delayed gratitude
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Dec 21, 2012 4:46 pm
Reply with quote

After reading the reply,
For a moment I thought Frank was back.. icon_cry.gif
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top