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

Diferences between MERGE FIELD=COPY


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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: 677
Location: NJ

PostPosted: Tue Dec 06, 2005 11:09 am
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: 411
Location: Colarado, US

PostPosted: Tue Dec 06, 2005 11:23 am
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
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: 411
Location: Colarado, US

PostPosted: Tue Dec 06, 2005 1:55 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Need COBOL COPY Help in MVS Environment COBOL Programming 4
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top