Page 1 of 1

Sort Join to overlay a field in file 1 from file 2

PostPosted: Sat Jun 29, 2019 1:49 am
by Oreod123
I am using the following sort/join
the input file 1 is a sequential file with an LRECL=500 and FB. Key in file 1 starts in position 17 for a length of 10
the input file 2 is LRECL=120 and is FB the key in file 2 starts in position 1 for a length of 10

I want to overlay position 434 in File 1(currently initialized and empty) with the field from File 2 which is in position 113 for 1 byte that is either an 'I' or an 'R'

I have tried to search these forums for help and found the following JCL.. when I try it, my field in file 1 is not populating from file 2.

Any help would be greatly appreciated!

//STEP01   EXEC PGM=SORT
//*
//SYSOUT   DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*
//SYSSNAP  DD  SYSOUT=*
//SYSDUMP  DD  SYSOUT=*
//*
//SORTJNF1 DD  DSN=file1,
//             DISP=SHR
//SORTJNF2 DD  DSN=file 2,
//             DISP=SHR
//SORTOUT  DD  DSN=abc.output.file,
//             DISP=(NEW,CATLG,DELETE),
//             SPACE=(CYL,(100,50),RLSE),
//             DCB=(LRECL=500,BLKSIZE=0,RECFM=FB)
//SORTWK01 DD  UNIT=(DASD,7),SPACE=(CYL,(1,50),RLSE)
//SORTWK02 DD  UNIT=(DASD,7),SPACE=(CYL,(1,50),RLSE)
//SORTWK03 DD  UNIT=(DASD,7),SPACE=(CYL,(1,50),RLSE)
//SORTWK04 DD  UNIT=(DASD,7),SPACE=(CYL,(1,50),RLSE)
//SORTWK05 DD  UNIT=(DASD,7),SPACE=(CYL,(1,50),RLSE)
//SORTWK06 DD  UNIT=(DASD,7),SPACE=(CYL,(1,50),RLSE)
//*
//SYSIN    DD  *
 JOINKEYS FILE=F1,FIELDS=(17,10,A)
 JOINKEYS FILE=F2,FIELDS=(1,10,A)
 JOIN UNPAIRED,F1
 REFORMAT FIELDS=(F1:1,500,?,F2:113,1)
 OPTION COPY

 OUTFIL IFOUTLEN=500,
  IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),OVERLAY=(434:502,1))

Re: Sort Join to overlay a field in file 1 from file 2

PostPosted: Sat Jun 29, 2019 3:26 pm
by NicC
First of all this is not a JCL problem but a sort problem so post in the appropriate sort forum. Topic moved.
Now, which sort product are you using? DFsort, Syncsort or some other product?

Have you actually tried reading about JOINKEYS in your sort documentation? If not, why not?

Re: Sort Join to overlay a field in file 1 from file 2

PostPosted: Mon Jul 01, 2019 7:11 pm
by Oreod123
My appologies on posting in the incorrect forum... I have read documentation and I had found a solution on this forum...I was merely asking a question since I was pretty close to a solution... sorry to cause any confusion my problem is solved!


Thanks

Re: Sort Join to overlay a field in file 1 from file 2

PostPosted: Mon Jul 01, 2019 9:44 pm
by NicC
Excellent! Now...if you could post your solution...
It is always good to see the solution as it adds to the collection of solutions that enables others to solve their own problems.

Re: Sort Join to overlay a field in file 1 from file 2

PostPosted: Mon Jul 01, 2019 9:57 pm
by Oreod123
Yes.. When I posted this last week, I had copied my SORTJNF2 file to a FB file. Unfortunately I did not have this file in my JCL. Once I poined to the FB file, the results worked as expected.

Thank you to users Skolusu (member1359.html) and BGronli (member16573.html) which is where I found a solution they provided in another post!