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

Extract records from file.


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

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Fri Mar 20, 2009 8:32 am
Reply with quote

Hi i have an requirement in which i have to extract all the records from a file which have value 'fetch' in them. This value can be in any position in the record.The value 'fetch' will always be after 'Include' . Is it possible to do this in sort or any other utility.

Example:
Input file:
123456 Include fetch-1 87456
5487 Include fetch-2 54781
1245 789658 74122

Output:
123456 Include fetch-1 87456
5487 Include fetch-2 54781

Last record should be omitted as it does not have value fetch in it.

Thanks in advance.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 20, 2009 8:40 am
Reply with quote

Hello,

You mention "include" . . . Does this have anything to do with the requirement? If a record had "fetch" but not "include" should it be selected or skipped?

Which sort product is used on your system?
Back to top
View user's profile Send private message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Fri Mar 20, 2009 9:24 am
Reply with quote

If the record has no include then it can be skipped. I am Using DFSORT.
Can you please help me in this.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Mar 20, 2009 9:33 am
Reply with quote

Hi,

try this
Code:
//STEP0001 EXEC PGM=SORT               
//SORTIN   DD *                         
123456 INCLUDE FETCH-1 87456           
5487 INCLUDE FETCH-2 54781             
1245 789658 74122                       
//SORTOUT  DD SYSOUT=*                 
//SYSOUT   DD SYSOUT=*                 
//SYSIN    DD *                         
  SORT FIELDS=COPY                     
  INCLUDE COND=(1,80,SS,EQ,C'FETCH')   
/*                                     



I have assumed the file has an LRECL of 80 and is FB.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 20, 2009 9:38 am
Reply with quote

Hello,

You might try something like:
Code:

  SORT FIELDS=COPY
  INCLUDE COND=(1,80,SS,EQ,C'include fetch')
This should work for a fixed length file of length 080.
Back to top
View user's profile Send private message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Fri Mar 20, 2009 9:54 am
Reply with quote

Thanks dick, it is working fine.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 20, 2009 10:05 am
Reply with quote

You're welcome - thank you for letting us know icon_smile.gif


Gerry, i see you're still quicker on the keyboard icon_cool.gif


d
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Mar 20, 2009 10:22 am
Reply with quote

That's what happens when one stops monkeying around icon_lol.gif


Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 20, 2009 10:44 am
Reply with quote

Or starts. . . icon_cool.gif

d
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 To fetch records that has Ttamp value... DFSORT/ICETOOL 2
No new posts ICETOOL returns no records JCL & VSAM 1
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
Search our Forums:

Back to Top