Page 1 of 1

I have a request to copy, set of alternate records from 2 PS

PostPosted: Tue Feb 02, 2016 1:17 am
by saveragu
I have a request to copy, set of alternate records from 2 PS file to another PS file using Sort JCl.
All three files have record length 80 and fixed record format.
Am using Sort JCl to achieve this.With the help of this forum i could copy the alternative records to 3rd PS file, but am struck with copying set of alternate records as shown in the below example. Any suggestion/help is really appreciated.
Example:
Input File1:
Record1
Record2
Record3
Record4
Record5
Record6
Record7
Record8
Record9
Record10


Input File2:
Record11
Record12
Record13
Record14
Record15
Record16
Record17
Record18
Record19
Record20


Ouput File3:
Record1
Record2
Record3
Record11
Record12
Record4
Record5
Record6
Record13
Record14
Record7
Record8
Record9
Record15
Record16
....
....
<EOM>

Re: I have a request to copy, set of alternate records from

PostPosted: Tue Feb 02, 2016 1:24 am
by saveragu
Below is my JCL i used to achieve to copy alternate records from 2 different PS file to another PS file.

//SORTST EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DISP=SHR,DSN=Input.FILE1
//IN2 DD DISP=SHR,DSN=Input.FILE2
//SORTOUT DD DISP=SHR,DSN=Output.FILE3,
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(81,8,A),SORTED,NOSEQCK
JOINKEYS F2=IN2,FIELDS=(81,8,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OPTION COPY
OUTFIL BUILD=(1,80,/,81,80)
//JNF1CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
//JNF2CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
/*



saveragu wrote:I have a request to copy, set of alternate records from 2 PS file to another PS file using Sort JCl.
All three files have record length 80 and fixed record format.
Am using Sort JCl to achieve this.With the help of this forum i could copy the alternative records to 3rd PS file, but am struck with copying set of alternate records as shown in the below example. Any suggestion/help is really appreciated.
Example:
Input File1:
Record1
Record2
Record3
Record4
Record5
Record6
Record7
Record8
Record9
Record10


Input File2:
Record11
Record12
Record13
Record14
Record15
Record16
Record17
Record18
Record19
Record20


Ouput File3:
Record1
Record2
Record3
Record11
Record12
Record4
Record5
Record6
Record13
Record14
Record7
Record8
Record9
Record15
Record16
....
....
<EOM>

Re: I have a request to copy, set of alternate records from

PostPosted: Tue Feb 02, 2016 2:32 pm
by BillyBoyo
Do you mean you have what you want, or you are still wanting assistance? Your code won't give you the output you've shown.

Re: I have a request to copy, set of alternate records from

PostPosted: Tue Feb 02, 2016 8:12 pm
by NicC
Please post in the correct part of the forum - this is not a JCL question. Also, please use the code tags to present code and data.

This is your JCL
//SORTST EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DISP=SHR,DSN=Input.FILE1
//IN2 DD DISP=SHR,DSN=Input.FILE2
//SORTOUT DD DISP=SHR,DSN=Output.FILE3,
//SYSIN DD *
//JNF1CNTL DD *
//JNF2CNTL DD *
/*

and these are your sort control cards (they are not JCL)

SYSIN:
JOINKEYS F1=IN1,FIELDS=(81,8,A),SORTED,NOSEQCK
JOINKEYS F2=IN2,FIELDS=(81,8,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OPTION COPY
OUTFIL BUILD=(1,80,/,81,80)

JNF1CNTL
INREC OVERLAY=(81:SEQNUM,8,ZD)

JNF2CNTL
INREC OVERLAY=(81:SEQNUM,8,ZD)

Re: I have a request to copy, set of alternate records from

PostPosted: Wed Feb 03, 2016 2:32 am
by saveragu
Thanks NicC for your reply. You code worked perfectly well.
Going forward will post the question in the right format and at right place of the forum.

NicC wrote:Please post in the correct part of the forum - this is not a JCL question. Also, please use the code tags to present code and data.

This is your JCL
//SORTST EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DISP=SHR,DSN=Input.FILE1
//IN2 DD DISP=SHR,DSN=Input.FILE2
//SORTOUT DD DISP=SHR,DSN=Output.FILE3,
//SYSIN DD *
//JNF1CNTL DD *
//JNF2CNTL DD *
/*

and these are your sort control cards (they are not JCL)

SYSIN:
JOINKEYS F1=IN1,FIELDS=(81,8,A),SORTED,NOSEQCK
JOINKEYS F2=IN2,FIELDS=(81,8,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OPTION COPY
OUTFIL BUILD=(1,80,/,81,80)

JNF1CNTL
INREC OVERLAY=(81:SEQNUM,8,ZD)

JNF2CNTL
INREC OVERLAY=(81:SEQNUM,8,ZD)

Re: I have a request to copy, set of alternate records from

PostPosted: Wed Feb 03, 2016 2:35 am
by saveragu
BillyBoyo wrote:Do you mean you have what you want, or you are still wanting assistance? Your code won't give you the output you've shown.


Thanks Billy for your reply. Am good now.