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

Copy records from a file based on search Key


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Thu Apr 23, 2009 11:36 am
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 Developer


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

PostPosted: Thu Apr 23, 2009 9:15 pm
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
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
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 Developer


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

PostPosted: Fri Apr 24, 2009 9:17 pm
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: 496
Location: USA

PostPosted: Fri Apr 24, 2009 10:00 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
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
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top