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

COPY from 1 PS to another with some condition


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

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Tue Mar 23, 2010 12:55 am
Reply with quote

Hello All,
I am looking for some way to copy some record from a PS to another on the basic of criteria.
Like Record(1:8) = 'TESTGPK '

Record is the record of the PS.

Regards,
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: Tue Mar 23, 2010 1:18 am
Reply with quote

Hello,

If you intend to use your sort product, read about INCLUDE in the documentation.
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Tue Mar 23, 2010 1:22 am
Reply with quote

That process i am aware.. but let me introduce one condition,
The input file is tooooo huge.
I need to copy the content of one record which satisfy the above condition.
Looking for the best efficient way!!!
Regards,
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 Mar 23, 2010 1:25 am
Reply with quote

Assuming that you want to write input records that have 'TESTGPK' in positions 1-8 to an output dat set, you can use a DFSORT job like the following:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB)
//SORTOUT DD DSN=...  output file (FB)
//SYSIN DD *
   OPTION COPY
   INCLUDE COND=(1,8,CH,EQ,C'TESTGPK')
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
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: Tue Mar 23, 2010 1:40 am
Reply with quote

Hello,

Quote:
but let me introduce one condition,
The input file is tooooo huge.
I need to copy the content of one record which satisfy the above condition.
Looking for the best efficient way!!!
There is no way to randomly process this file so that only the desired record(s) are read. . .

The entire file must be read and the INCLUDEd record(s) copied to the output.
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 Mar 23, 2010 1:45 am
Reply with quote

If you want to copy only the FIRST record that satisfies the condition, you can change the job I showed to have:

Code:

   OPTION COPY,STOPAFT=1
   INCLUDE COND=(1,8,CH,EQ,C'TESTGPK')


That will tell DFSORT to stop reading the input records as soon as the target record is found which can be more efficient than reading all of the records (depending of course on how close to the top the target record is).
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Tue Mar 23, 2010 2:09 am
Reply with quote

But this condition will also treverse all the previous records.
@DICK: I agree that there is no way to get random records in a PS.
but is it possible with VSAM Dataset..
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 Mar 23, 2010 2:15 am
Reply with quote

I don't understand what you're asking for. If you don't know where the record with the target string is in the file, how can you expect to only access that record?

Are you talking specifically about the "key" of a VSAM KSDS?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Mar 23, 2010 2:17 am
Reply with quote

If your VSAM file is a KSDS file, and
If the Primary key field is 1 thru 8 in your case....

Then you could use IDCAMS to REPRO the record into another file.

This would be a faster option.

Lots of IFs here.
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Tue Mar 23, 2010 2:28 am
Reply with quote

Actually we just came to know from different group about the input file, my group dosnt handle that file, but due to some requirements we need to access that file. As that file is too huge, i was a bit worried so i was looking for some alternatives. now we can ask them to provide the data in according to our requirement. that will work, otherwise we have to use lots of resources. Anyways thanks all for your advices and suggestions.
Regards,
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Tue Mar 23, 2010 3:25 am
Reply with quote

Just curious ... What is huge? A few million record for example is nothing to a mainframe box.
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Tue Mar 23, 2010 5:20 pm
Reply with quote

That File contains the backup of ACF2, All the ids with some details.
And there are millions of millions of Ids in system. Hope this ends your curiosity. icon_smile.gif
Also its taking 3-4 mins to open that file in browse mode.
Regards,
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Mar 23, 2010 8:04 pm
Reply with quote

GauravKudesiya wrote:

Also its taking 3-4 mins to open that file in browse mode.

So why are you accessing it in TSO rather than in a batch job?
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Tue Mar 23, 2010 8:23 pm
Reply with quote

What will be the SYSIN if i use IDCAMS.
Code:
//STEP001  EXEC PGM=IDCAMS
//SYSIN    DD *
   REPRO INFILE(FILE01) OUTFILE(FILE02)
/*
//FILE01   DD DSN=PROD.FILE1.INPUT,DISP=SHR
//FILE02   DD DSN=PROD.FILE2.OUTPUT,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=DISK,
//            SPACE=(TRK,(100,10),RLSE),   
//            DCB=(RECFM=FB,BLKSIZE=4000,LRECL=4000)
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*

There must be some more parameters in REPRO.
for Using KEY = 'TESTGPKb' (b=> Blank)

Regards,
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Mar 23, 2010 8:36 pm
Reply with quote

Just to reiterate what has already been said.

Yes, there are. And this is a classic request for a RTFM response.

Is the input file a KSDS.
Is the value that you wish to extract the primary VSAM key.

If so, click the "IBM Manuals" button at the top of the page and find the IDCAMS manual. Then read it.
VSAM services for DFsms is the book that you MUST read for yourself.
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Tue Mar 23, 2010 10:25 pm
Reply with quote

Its not clear after reading that manual. Still finding the way to perform the above task icon_sad.gif
Regards,
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: Tue Mar 23, 2010 11:06 pm
Reply with quote

Hello,

What did you read concerning FROMKEY and TOKEY?

More basic, which manual did you look in?

From the "IBM Manuals" link you want "VSAM Services for DFSMS"
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Wed Mar 24, 2010 12:06 am
Reply with quote

Hi Dick,
First of all i look into the same manual.
Secondly,
I have to select only one record, so i think cannot use FROMKEY and TOKEY.
Also i know the value of the key not the key number.
What i will do in this case?

Regards,
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Mar 24, 2010 12:35 am
Reply with quote

I too looked in the manual, and I admit, it is not really clear.

So, the FROMKEY is the value so your good with that (make sure the length matches exactly with regard to leading or trailing spaces).

leave the TOKEY off, and add COUNT(1).

That should do it.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Mar 24, 2010 12:45 am
Reply with quote

Oops, I looked a little further, and it was clear to me after all. icon_redface.gif

Oh well, the solution should work for you anyways.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Mar 24, 2010 12:31 pm
Reply with quote

As the OP has said that the input is a PS file, it looks as though using SORT may be the best / only option.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Mar 24, 2010 6:46 pm
Reply with quote

That is the way he started. But then the usual flip-flop to:
Quote:

but is it possible with VSAM Dataset..


So we started down this road.

I guess an actual commitment to a specification would be need for this thread to continue.
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 VB to VB copy - Full length reached SYNCSORT 8
No new posts Need COBOL COPY Help in MVS Environment COBOL Programming 4
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts DB2 Table - Image copy unload IBM Tools 2
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
Search our Forums:

Back to Top