MERGE FIELDS=COPY and SORT FIELDS=COPY.

All sort of Mainframes Interview Questions.
Post Reply
Sachin S
New Member
Posts: 2
Joined: Wed Aug 13, 2014 3:37 pm

MERGE FIELDS=COPY and SORT FIELDS=COPY.

Post by Sachin S »

Hi,

What is the difference between the following two statements:

MERGE FIELDS=COPY and SORT FIELDS=COPY

can you please help. I've also used them interchangbliy an not sure if there is a difference between them.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: MERGE FIELDS=COPY and SORT FIELDS=COPY.

Post by Robert Sample »

From the manual:
Specifying COPY on the SORT, MERGE, or OPTION statement

z/OS DFSORT: Getting Started
SC23-6880-00

The SORT and MERGE statements change very little when you specify COPY. Just replace the information you usually put in parentheses with the word COPY:

SORT FIELDS=COPY
MERGE FIELDS=COPY

You can also specify COPY on the OPTION statement:

OPTION COPY

All three of these statements have identical results.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: MERGE FIELDS=COPY and SORT FIELDS=COPY.

Post by Anuj Dhawan »

MERGE is used to combine multiple sorted files into a single file. The MERGE process presumes that the specified input files are already in sorted order by the key field. But it is with when you use key fields with MERGE statement. As Robert has indicated, if you are using these keywords with COPY - they all are just identical and somewhat misnomer too...IMHO.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: MERGE FIELDS=COPY and SORT FIELDS=COPY.

Post by William Collins »

OPTION COPY solves the misnomer issue.

MERGE FIELDS=COPY can then be use for multiple input files not suitable for concatenation, like VSAM.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”