Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Copy records from a file based on search Key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
udaydara

New User


Joined: 08 Mar 2009
Posts: 10
Location: Hyderabad

PostPosted: Thu Apr 23, 2009 11:33 am    Post subject: Copy records from a file based on search Key
Reply with quote

Hi all,

Today I am having an request for coping only few selected records from a file to another file .

Input file will have the search key at different positions.

EXAMPLE:

Input file:(this is Variable block file)

1234 NAME1 EMPLOYEE 1234567
2345 NAME2 EMPLOYEE ADDRESS 1234567
3345 NAME3 1234567
4345 NAME5 EMPLOYEE ADDRESS 3456789
3345 NAME6 9234567
8734 NAME7 EMPLOYEE 1274567
3345 NAME2 37918372
3445 NAME5 EMPLOYEE ADDRESS 4567890
55345 NAME7 1234572
1211 NAME8 EMPLOYEE 1234567
2225 NAME9 EMPLOYEE ADDRESS 0123456
3345 NAME10 5671234
1444 NAME11 EMPLOYEE 1234567
3675 NAME22 1238867
1674 NAME41 EMPLOYEE 1234567
3235 NAME52 1239967
2675 NAME22 EMPLOYEE ADDRESS 1223457

If will give the search key as 1234567

expecting output file as

1234 NAME1 EMPLOYEE 1234567
2345 NAME2 EMPLOYEE ADDRESS 1234567
3345 NAME3 1234567
1444 NAME11 EMPLOYEE 1234567
1674 NAME41 EMPLOYEE 1234567

because only those five records are having search key '1234567'.

Can do this with the help of a DFSORT?Is there any other way of doing this task simple. icon_smile.gif

I tried using 3.14 utility but that is not resolving my problem. icon_cry.gif
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Apr 23, 2009 11:36 am    Post subject:
Reply with quote

Take a read of the DFSORT documentation and look for the SS (Substring search ?) section. It's good, it's very very good.

I am sure that you will also find numerous examples on the forum too.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Apr 23, 2009 9:15 pm    Post subject:
Reply with quote

Uday,

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=VB and LRECL=80, but the job can be changed appropriately for other LRECLs by replacing 76 with LRECL-4.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB/80)
//SORTOUT DD DSN=...  output file (VB/80)
//SYSIN    DD    *
  OPTION COPY,VLSCMP
  INCLUDE COND=(5,76,SS,EQ,C'1234567')
/*
Back to top
View user's profile Send private message
udaydara

New User


Joined: 08 Mar 2009
Posts: 10
Location: Hyderabad

PostPosted: Fri Apr 24, 2009 5:56 pm    Post subject: Reply to: Copy records from a file based on search Key
Reply with quote

Hi Frank,

Thanks for replying to my query,

I tried your solution but getting the below syntax error.

My input file LRECL is 20112.

Current version of DFSORT Installed is VER14

Spool error:

Code:

SYSIN :                                                                                 
    OPTION COPY,VLSCMP                           
                *                                 
    INCLUDE COND=(5,20108,SS,EQ,C'1234567890')   
WER268A  OPTION STATEMENT  : SYNTAX ERROR         
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000     
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE     


Please advice me what to do next
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Fri Apr 24, 2009 6:35 pm    Post subject: Reply to: Copy records from a file based on search Key
Reply with quote

Quote:
Current version of DFSORT Installed is VER14


WER* message codes indicates that you are using SYNCSORT not DFSORT
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Apr 24, 2009 9:17 pm    Post subject:
Reply with quote

Uday,

The job works fine with DFSORT. But you're using Syncsort, not DFSORT.
I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Fri Apr 24, 2009 10:00 pm    Post subject:
Reply with quote

Uday,

Try this SyncSort for z/OS application:
Code:
//STEP1 EXEC PGM=SORT,PARM='VLTESTI=2'
//SYSOUT  DD SYSOUT=*
//SORTIN  DD DSN=your.vb.input,...
//SORTOUT DD DSN=your.vb.output,...
//SYSIN   DD *
  SORT FIELDS=COPY
  INCLUDE COND=(5,76,SS,EQ,C'1234567')
/*
Back to top
View user's profile Send private message
udaydara

New User


Joined: 08 Mar 2009
Posts: 10
Location: Hyderabad

PostPosted: Mon Apr 27, 2009 12:53 am    Post subject:
Reply with quote

Thanks Frank and Margulies for your time.

I have tried the above code,its working for me.
icon_biggrin.gif icon_smile.gif icon_biggrin.gif
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us