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
 

 

DIfference between copy using sort and Copy using Repro

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

New User


Joined: 03 Sep 2010
Posts: 13
Location: Bengaluru

PostPosted: Tue Aug 09, 2011 3:25 pm    Post subject: DIfference between copy using sort and Copy using Repro
Reply with quote

Hi,

While testng for a job i came across an interesting stuff. I am not sure if people alreadu are aware of this so posting for folks who don`t already know this.

Now, there are different ways of copying the contents of one file to another. What I'm quoting is copying using the REPRO and the SORT command. In my example I'll be using a VSAM (KSDS) file and a flat file.

The sample JCL is as below

COPY USING SORT:
Code:
//STEP1  EXEC PGM=SORT       
//SORTIN    DD   DSN=TEST.INPUT.FLAT.FILE,DISP=SHR                   
//SORTOUT   DD   DSN=TEST.OUT.VSAM.FILE,DISP=SHR                         
//SYSOUT    DD   SYSOUT=*   
//SYSIN     DD   *           
   SORT FIELDS=COPY

COPY USING REPRO
Code:
//STEP1 EXEC PGM=IDCAMS             
//SYSPRINT DD  SYSOUT=*               
//INDD     DD  DISP=SHR,DSN=TEST.INPUT.FLAT.FILE
//OUTDD    DD  DISP=SHR,DSN=TEST.OUT.VSAM.FILE
//SYSIN    DD  *                       
   REPRO -                             
   INFILE(INDD) -                     
   OUTFILE(OUTDD)

Now in both the above scenarios, copy will be successfull, no second thoughts about that. But what in scenarios where there is an abend.(Example the VSAM file might be open when the job is run)
In the scenario using the REPRO command the data in your flat file would have been purged when the abend occurs in that step but the same is not in scenarios using the SORT command.
using the SORT command all the contents in your flat file will be safe even when an abend occurs.

Internally i am not aware how this happens icon_confused.gif - maybe if someone helped me understand this, then it would of much help icon_biggrin.gif .

on technical side, if you want to copy data from one file to another and want the data to remain in the file in case abends i suggest you use the SORT parameter.


Hope this is of some help.

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

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Aug 09, 2011 4:22 pm    Post subject:
Reply with quote

Hi,

Quote:
In the scenario using the REPRO command the data in your flat file would have been purged when the abend occurs in that step but the same is not in scenarios using the SORT command.


As far as I'm concerned this is rubbish, how does the input get purged ?
The file is opened for input ?

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

New User


Joined: 03 Sep 2010
Posts: 13
Location: Bengaluru

PostPosted: Tue Aug 09, 2011 4:34 pm    Post subject:
Reply with quote

Quote:
The file is opened for input ?


Gerry,

This does not involve any batch program at all.Just the JCL as a separate entity, it seemed RUBBISH to me too but that is what the results are the i have obtained.

To be more elaborative
- The flat file is a standalone file NOT used in any program.It is a FB with record length = 55
- The VSAM flat to which the data is being written into is used in an online process.

If somebody could, please try if you get any other results.If there a mistake on my part i will gladly correct myself.

Arun.[/quote]
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue Aug 09, 2011 4:42 pm    Post subject:
Reply with quote

The flatfile will not be purged at abend time, its filled till the abend happens. But depending on a close at abend time it will be readable.
Im not sure if either program will do a close in an abend exit for
the output.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Aug 09, 2011 6:06 pm    Post subject:
Reply with quote

gcicchet wrote:
Hi,

Quote:
In the scenario using the REPRO command the data in your flat file would have been purged when the abend occurs in that step but the same is not in scenarios using the SORT command.


As far as I'm concerned this is rubbish, how does the input get purged ?
The file is opened for input ?

Gerry


Seconded.

Arun, I have not the faintest of the remotely faint idea of what you are talking about.

Neither method is going to do anything in any way to affect your input file.

The contents of the output are irrelevant if the job abends.
Back to top
View user's profile Send private message
arunn

New User


Joined: 03 Sep 2010
Posts: 13
Location: Bengaluru

PostPosted: Tue Aug 09, 2011 6:47 pm    Post subject:
Reply with quote

Gerry, Bill and Peter,

I am extremly extremly sorry icon_redface.gif ...i goofed up while writing the file names above icon_eek.gif .
The Flat file is the output file while the VSAM file is the input file.
Here is a copy of the job and i double checked and it is CORRECT this time.

COPY USING SORT:
Code:
//STEP1  EXEC PGM=SORT,COND=(0,NE)                                   
//SORTIN   DD DSN=TEST.INPUT.VSAM.FILE,                             
//            DISP=SHR                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD DSN=TEST.OUPUT.FLAT.FILE,                     
//            DISP=SHR                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
   SORT FIELDS=COPY

COPY USING REPRO :
Code:
//STEP1 EXEC PGM=IDCAMS                                     
//SYSPRINT DD  SYSOUT=*                                         
//INDD     DD DISP=SHR,DSN=TEST.INPUT.VSAM.FILE           
//OUTDD    DD DISP=SHR,DSN=TEST.OUPUT.FLAT.FILE     
//SYSIN     DD *                                               
  REPRO -                                                       
  INFILE(INDD) -                                               
  OUTFILE(OUTDD)


Here is the scenario. There is flat file which needs to be updated everytime the job runs and it is updated by the VSAM file which has the fresh data.
The Flat file already has some data in it which gets refreshed everytime with the updated data.

Now using the SORT command, if there is an abend in the data already in the flat file will still remain and NOT get purged.
However while using the REPRO command, the data previously in the flat file gets purged in case of abends.
This is what i actually wanted to post initially icon_smile.gif ... I apologise again for the goof up.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Aug 09, 2011 6:50 pm    Post subject:
Reply with quote

Hello Ladies - what's this topic all about! icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Aug 09, 2011 7:01 pm    Post subject:
Reply with quote

Anuj Dhawan wrote:
Hello Ladies - what's this topic all about! icon_sad.gif


Hi Anuj,

Kind of hard to say...

Arun,

As I said earlier, the contents of your output file are irrelevant if you happen to get an abend. They are not to be trusted, there is no guarantee as to what they contain, and what they do contain can easily vary from utility to utility.

It is quite possible that you SORT product is not opening the output file until it wants to do the first write to the output file.

If you happen to be using DFSORT, you'll probably get a detailed and accurate answer on this later.

If you still think this is all interesting, try doing it with a little Cobol program.

First, open input and output at the same time, abend, look at the output.

Second, open input, abend, look at the output.

Good luck :-)
Back to top
View user's profile Send private message
arunn

New User


Joined: 03 Sep 2010
Posts: 13
Location: Bengaluru

PostPosted: Tue Aug 09, 2011 7:56 pm    Post subject:
Reply with quote

Thanks for your comments bill.
I had taken a copy of the original file that was initially present prior to running the job, later on i did a little of re-test on the same case a couple of time times and after comparing the output file with the original everytime the data matched, so it sums up to that data never changed when the job abended.

But on the Hindsight like you said before : They are not to be trusted icon_biggrin.gif .

Still the query lingers as to why it is getting purged using a SORT and not a REPRO. icon_rolleyes.gif ...

Will try it out using a program sometime maybe...thanks again
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Aug 09, 2011 8:00 pm    Post subject: Reply to: DIfference between copy using sort and Copy using
Reply with quote

if You' d post the sysouts of the two jobs, You might have better chances of getting a reply
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Aug 09, 2011 8:10 pm    Post subject:
Reply with quote

arunn wrote:
[...] Still the query lingers as to why it is getting purged using a SORT and not a REPRO. icon_rolleyes.gif ...

Will try it out using a program sometime maybe...thanks again


No problem.

Or, vice versa, as you said earlier.

Don't take my bit about the program too seriously. Read it again, and you'll see you don't need to code it.

What I'm saying is, if something is leaving the output file untouched, then the job has failed before the output file is opened.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1714
Location: UK

PostPosted: Wed Aug 10, 2011 1:06 am    Post subject:
Reply with quote

You say your output file has records and is being updated. Do you mean new data is added to the file after the old data or that the old data is replaced by the new data. With DISP=SHR (which should not be used for an output file) your data will be replaced - not updated.

At what point are you saying that the sort job abends? Sort works in phases and one of the last would be to write the all the sorted output (however, doing a copy it may be read-a-record-write-a-record-read-a-record etc)
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Aug 10, 2011 6:46 am    Post subject:
Reply with quote

Hello,

You need to do as Enrico requested. . .
Quote:
if You' d post the sysouts of the two jobs, You might have better chances of getting a reply


Without seeing what actually happened, the topic is simply a waste. Do not post what you think happened - post the info the system provided for you (copy/paste/code tag).
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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