Page 1 of 1

MERGE problem using VB input file

PostPosted: Thu Aug 14, 2008 4:33 pm
by pmerc8888
Hi,

I'm trying to learn to use the MERGE application of SYNCSORT as I need to give a presentation about it. I usually just use SORT and COPY. Can someone tell me why one would prefer to use MERGE instead of SORT or COPY?

Additionally, I tried to run a similar JCL below but encountered a WER068A OUT OF SEQ SORTIN02 , BLOCK 1 error. I looked it up from the manual and found the following explanation: "A record in the SORTIN data set indicated by xx is out of sequence according to the FIELDS specification on the MERGE statement.". I checked the contents of my SORTIN02 but couldn't work out which record could be out of sequence and/or why. Can someone help, please.

Kindly note that all my input files are VB.

sample JCL:
==========
//JS010    EXEC PGM=SORT                         
//SYSOUT    DD SYSOUT=*                         
//SORTOUT   DD DSN=PMERCOUT,     
//             DISP=(NEW,CATLG,DELETE),         
//             UNIT=SYSDA,                       
//             SPACE=(CYL,(20,20),RLSE),         
//             DCB=(RECFM=VB,LRECL=374,BLKSIZE=0)
//*                                             
//SORTIN01  DD DISP=SHR,DSN=PMERCIN1
//SORTIN02  DD DISP=SHR,DSN=PMERCIN2
//SORTIN03  DD DISP=SHR,DSN=PMERCIN3
//SYSIN    DD *                                 
 MERGE FIELDS=(5,6,CH,A)                         
/*                                               


first 8 characters of the two records of SORTIN02:
==========================================
SPR000\.!
SPRABC\RU

Re: MERGE problem using VB input file

PostPosted: Thu Aug 14, 2008 5:04 pm
by MrSpock
pmerc8888 wrote:Can someone tell me why one would prefer to use MERGE instead of SORT or COPY?


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. Obviously, a MERGE should take much less time to process than a SORT since no SORT operation has to take place. A COPY can only copy the files in the same order in which they were originally written.

Re: MERGE problem using VB input file

PostPosted: Thu Aug 14, 2008 5:41 pm
by pmerc8888
Thanks MrSpock. I hope you don't mind the following additional questions:

1. Although the MERGE process assumes that the specified input files are already in sorted order, it would still sort/arrange the records in the order I specify in the FIELDS part of the statement, is that correct?

2. Would I be correct in thinking that if I were to combine 16 files or less, it would be better to more efficient to have MERGE FIELDS=COPY than SORT FIELDS=COPY?

Thanks again :)

Re: MERGE problem using VB input file

PostPosted: Thu Aug 14, 2008 7:41 pm
by Bill Dennis
pmerc,

1. The MERGE FIELDS define what "key" the separate files are in sequence by. The merge file records will also be in sequence on that key.

2. Apparently, MERGE FIELDS=COPY is a misnomer and actually performs a SORT FIELDS=COPY. Thus only the SORTIN file is copied to SORTOUT.

Re: MERGE problem using VB input file

PostPosted: Thu Aug 14, 2008 7:47 pm
by Bill Dennis
pmerc,

Also, your sample records for file SORTIN02 are out of sequence. Zero (SPR0) falls after A (SPRA) in the normal sort sequence.

Re: MERGE problem using VB input file

PostPosted: Fri Aug 15, 2008 12:53 am
by dick scherrer
Hello,

It may be worth mentioning that the "collating sequence" of the mainframe is ebcdic while the collating sequence of UNIX and Windows is ascii.

The first difference most people discover is that on the mainframe letters sort before numerals while on the UNIX and Windows platforms the reverse is true.

Another is that on the mainframe there are values between I (eye) and J (jay), and R and S, while in ascii the alphabet is contiguous.

Re: MERGE problem using VB input file

PostPosted: Sun Aug 17, 2008 7:55 am
by pmerc8888
Greetings Bill and Dick,

Thank you kindly for both your replies.

Once Dick pointed out that the MERGE FIELDS define what "key" the separate files are in sequence by, I realise that SYNCSORT actually REQUIRES the records in the input files to be in sorted order and it would issue that "out of sequence" error if that is not the case. And so I organized the input files and it worked beautifully :)

Thanks, too, for reminding me that there are values between I and J (jay), and R and S :)

Both your inputs help.

Thanks again :)

Re: MERGE problem using VB input file

PostPosted: Sun Aug 17, 2008 7:59 am
by dick scherrer
You're welcome - good luck with the presentation :)

d