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
 

 

Diferences between MERGE FIELD=COPY

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
DiegoVanc

New User


Joined: 06 Dec 2005
Posts: 3

PostPosted: Tue Dec 06, 2005 9:27 am    Post subject: Diferences between MERGE FIELD=COPY
Reply with quote

What is the diferents between
merge fields=copy
sort filds=copy

diferents between merge an sort
thanks
Back to top
View user's profile Send private message

khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Tue Dec 06, 2005 11:09 am    Post subject: Sort Vs Merge
Reply with quote

Hi frnd,

Quote:
diferents between merge an sort


so merge will append the existing file with a new file...and sort is nothing but to order the content of the same file either in ascending or in descending...
Quote:

What is the diferents between
merge fields=copy
sort filds=copy


Actually i can't reach u wat u mean to the above thing?
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Tue Dec 06, 2005 11:23 am    Post subject: Re: Diferences between MERGE FIELD=COPY
Reply with quote

Hi diegovanc,


The programming SORT is called as internal sort whereas the sort in JCL is called external sort. If you want to manipulate the data before feeding to sort, prefer internal sort. In all other cases, external sort is the good choice. Internal sort, in turn invokes the SORT product of your installation. (DFSORT). In the run JCL, allocate at least three sort work files. (SORT-WKnn => nn can be 00-99).
FASTSRT compiler option makes the DFSORT to do all file I-O operation than your COBOL program. It would significantly improve the performance. The result of the SORT can be checked in SORT-RETURN register. If the sort is successful, the value will be 0 else 16.

Syntax:
Code:
SORT SORTFILE ON ASCENDING /DESCENDING KEY sd-key-1 sd-key2
  USING file1 file2 / INPUT PROCEDURE IS section-1
  GIVING file3       / OUTPUT PROCEDURE is section-2
END-SORT

File1, File2 are to-be-sorted input files and File3 is sorted-output file and all
of them are defined in FD.SORTFILE is Disk SORT Work file that is defined at SD. It should not be explicitly opened or closed.

INPUT PROCEDURE and USING are mutually exclusive. If USING is used, then file1 and files should not be opened or READ explicitly. If INPUT PROCEDURE is used then File1 and file2 need to be OPENed and READ the records one by one until end of the file and pass the required records to sort-work-file using the command RELEASE.
Syntax:
Code:
RELEASE sort-work-record from input-file-record.

OUTPUT Procedure and GIVING are mutually exclusive. If GIVING is used, then file3 should not be opened or WRITE explicitly. If OUTPUT procedure is used, then File3 should be OPENed and the required records from sort work file should be RETURNed to it. Once AT END is reached for sort-work-file, close the output file.
Syntax:
Code:
RETURN sort-work-file-name AT END imperative statement.


INPUT PROCEDURE Vs OUTPUT PROCEDURE:
Sometimes it would be more efficient to process data before it is sorted, whereas other times it is more efficient to process after it is sorted. If we intend to eliminate more records, then it would be better preprocess them before feeding to SORT. If we want to eliminate all the records having spaces in the key field then it would be efficient if we eliminate them after sorting. Because the records with blank key comes first after sorting.

MERGE
It is same as sort. USING is mandatory. There should be minimum two files in USING.
Code:
MERGE Sort-work-file ON ASCENDING KEY dataname1 dataname2
  USING file1 file2
  GIVING file3 / OUTPUT PROCEDURE is section-1
END-MERGE

Program sort registers (and its equivalent DFSORT parameter/meaning)
SORT-FILE-SIZE (FILSZ), SORT-CORE-SIZE (RESINV), SORT-MSG(MSGDDN)
SORT-MODE-SIZE (SMS=nnnnn)
SORT-RETURN(return-code of sort) and
SORT-CONTROL (Names the file of control card ? default is IGZSRTCD)

NOTE

I couldn't get any information on MERGE field=copy or SORT field =copy.

Please explain your query properly.
Back to top
View user's profile Send private message
CHAITANYAS

New User


Joined: 30 Nov 2005
Posts: 1

PostPosted: Tue Dec 06, 2005 11:45 am    Post subject:
Reply with quote

Hi,

There is no difference between merge fields=copy and sort fields=copy both give the same results.

If you want to copy datasets with out mentinong the keys to sort on you can use either merge fields=copy or sort fields=copy as both does the same function.

The difference between the SORT and MERGE is that if you want to merge two files and you want the output file sorted based on a key:

In MERGE the input datasets to be merged should be sorted based on the same keys before this MERGE is used to merge the files.

In SORT you can give two input datasets in SORTIN DD. The input datasets need not be sorted but the datasets will be sorted and merged based on the SORT condition given in SORT statment.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Tue Dec 06, 2005 1:55 pm    Post subject: Re: Diferences between MERGE FIELD=COPY
Reply with quote

Hi chaitanyas,

Thanks for your valuable information.
Back to top
View user's profile Send private message
DiegoVanc

New User


Joined: 06 Dec 2005
Posts: 3

PostPosted: Wed Dec 07, 2005 9:21 am    Post subject: Re: Diferences between MERGE FIELD=COPY
Reply with quote

Thanks everyone, I need that for my work, thanks a lot again
Back to top
View user's profile Send private message
appanna babu

New User


Joined: 11 Dec 2005
Posts: 4
Location: hyderabad

PostPosted: Mon Dec 12, 2005 12:01 am    Post subject: difference between merge&sort fields
Reply with quote

hi friend ,with merge filelds we can merge the fields what we want by specifing the starting position ,length . But with sort command we cansort the required fields in ascending or decending manner only. bye
[/i][/b]
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 5 Thu Apr 27, 2017 1:15 am
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am


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