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

Filtering records based on condtion from VSAM file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Oct 06, 2010 11:42 am
Reply with quote

Hi,

I want to filter the records from VSAM based on condition and write those to either VSAM or Flat file thru JCL. ( Like filtering records using Include Cond in Sort )

Please let us know, your thoughts.

Thanks,
Ram.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 06, 2010 11:49 am
Reply with quote

Once more let us clarify exactly what JCL is.
it is Job Control Language.

By itself it does nothing. It is used to invoke the chosen program and to define which datasets are to be used by the DD names associated with the chosen program.

JCL does not have magical powers that solve all problems, JCL is merely the vehicule for telling the processor which program you want it to execute.

So if you might be so informative to suggest which program you would like your JCL to be executing then perhaps we might be better positioned to assist.
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Oct 06, 2010 12:00 pm
Reply with quote

Hi Expat,

Till now i have used IDCAMS, to process VSAM files.
It would be better, if you please provide any solution for my query by using IDCAMS.

Appreciate any other solutions by using any other programs.

Thanks,
Ram.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 06, 2010 12:05 pm
Reply with quote

Search the forum for solutions using either DFSORT or SYNCSORT - depending on the product and release level you have installed.

Also, it might be a good idea to supply some useful information
Record length is fixed or variable.
The actual record length (Give both average and maximum if variable)
The position and format of the "filter" field(s)
The rules for including / omitting records
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Oct 06, 2010 1:33 pm
Reply with quote

Hi Expat,

Please find below details.

Record length is fixed or variable = Variable
The actual record length (Give both average and maximum if variable) =
RECORDSIZE(31773,32710)
The position and format of the "filter" field(s) = from 5th position 4 bytes
The rules for including / omitting records = include only records have 'aaaa' from 5th position.

Please let me know if you require any further info.

Thanks,
Ram.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 06, 2010 1:48 pm
Reply with quote

Are you using SYNCSORT or DFSORT

Please run the code below and post the output from SYSOUT
Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 06, 2010 1:55 pm
Reply with quote

if You had cared to search the jcl/dfsort forums with sort include
You would have found lots of examples
here is one of them
ibmmainframes.com/viewtopic.php?t=51341&highlight=sort+include
or
ibmmainframes.com/viewtopic.php?t=49018&highlight=
start doing a bit of work Yourself

it would be also useful for you to read and meditate on
How To Ask Questions The Smart Way
catb.org/~esr/faqs/smart-questions.html
to make the most out of the questions You ask
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Oct 06, 2010 2:20 pm
Reply with quote

Hi Expat/enrico-sorichetti,

We have DFSORT in our shop.

Sorry for the confusion, earlier i had an opinion like we should not copy VSAM to flat file using DFSORT and we should do it using only IDCAMS. Now i did it successfully using DFSORT.

Thanks for your help.

Now my query is how to create VSAM file using DFSORT ? Also please let me know how to view whether the VSAM is VB or FB ?

Thanks,
Ram.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 06, 2010 3:18 pm
Reply with quote

You do not create VSAM files with dfsort

You can create them
by JCL
by IDCAMS define

my advice is to use IDCAMS define

after that You can load data into it using idcams repro or sort
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Oct 06, 2010 3:34 pm
Reply with quote

Thanks enrico-sorichetti for your valuable inputs,

If we need to filter few records based on condition from VSAM file and wants to copy those to another VSAM file; Do we have any other solution other than below mentioned ?

step1:- Copy records from VSAM to Flat file based on certian cond using DFSORT.

Step2:- convert the Flat file to VSAM using IDCAMS.

Is there any other solution we can achieve above in single step?

Thanks in advance.
Ram.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 06, 2010 3:42 pm
Reply with quote

Define new VSAM cluster
Sort from existing to new VSAM cluster
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 06, 2010 3:42 pm
Reply with quote

sort can read and write VSAM files

step1 IDCAMS delete/define
step2 sort with vsam input and output

to have an absolute one step only solution then the vsam define should be done with jcl allocation/implicit definition
but that' s an approach I would not advice for, since it needs a very sound SMS environment
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Wed Oct 06, 2010 4:03 pm
Reply with quote

Thanks a lot for all ur inputs..
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 and retrive records f... DFSORT/ICETOOL 2
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
Search our Forums:

Back to Top