Page 1 of 2

Overlay: how to arrive at the correct output using dfsort

PostPosted: Thu Sep 06, 2007 3:56 pm
by Indranil28
I have a requirement like this:

I have two files of length 80.
First file conatins data 09-04-07
second file contains data 08-11-05
As an output I want the second file as 08-11-0509-04-07
I tried using DFSORT with overlay parameter
***********************************************************************************************
//SORTOUT DD DSN=FILE1,DISP=SHR
//SORTIN DD DSN=FILE2,
// DISP=SHR
//SYSIN DD *
OPTION COPY
OUTREC OVERLAY=(9:1,8)
END
//*
***************************************************************************************************
But the output I am gettin is 09-04-0709-04-07

Can anyone tell me how to arrive at the correct output using dfsort? It is urgent

Thanks in advance

Re: overlay

PostPosted: Thu Sep 06, 2007 4:00 pm
by Indranil28
Sorry!!! in my previous post sortin , sortout got swapped..

//SORTIN DD DSN=FILE1,DISP=SHR
//SORTOUT DD DSN=FILE2,
// DISP=SHR
//SYSIN DD *
OPTION COPY
OUTREC OVERLAY=(9:1,8)
END
//*

Re: overlay

PostPosted: Thu Sep 06, 2007 4:32 pm
by William Thompson
A straight copy is totally destroying your FILE1....... :o The only thing that's going out to FILE1 is the contents of FILE2....
Is there some key where you are matching? Or is FILE1 an identical record for record copy of FILE2 except for the date?

Re: overlay

PostPosted: Thu Sep 06, 2007 4:37 pm
by Indranil28
file1 is an identical layout of file2. there is no such key in any of the file

Re: Overlay: how to arrive at the correct output using dfsort

PostPosted: Thu Sep 06, 2007 5:49 pm
by CICS Guy
Well, you will have to use some sort of (splice?) logic to get both records side-by-side in the sort in order to put some of the info from the one into the other.....

Re: Overlay: how to arrive at the correct output using dfsort

PostPosted: Thu Sep 06, 2007 7:19 pm
by Indranil28
i want to achive it using sort rather than ICETOOL..........

Re: Overlay: how to arrive at the correct output using dfsort

PostPosted: Thu Sep 06, 2007 7:59 pm
by CICS Guy
Indranil28 wrote:i want to achive it using sort rather than ICETOOL..........
No major difference, they are both part of the IBM Sort package.....
Why one over the other? Some "standard" or "requirement"? Or just practicing and learning new tricks?


"Create files with matching and non-matching records" in Smart DFSORT Tricks could be used, pick only the matching (since there is no non-matching) and use a sequence number on input to create a siimple key if needed......

Re: Overlay: how to arrive at the correct output using dfsort

PostPosted: Fri Sep 07, 2007 2:01 am
by Frank Yaeger
indranil28,

Here's a DFSORT job that will do what you asked for:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  file2
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
* Create DFSORT symbol for file2 value as:
* F2,'08-11-05'
* Note: 08-11-05 is the first 8 bytes from file2 ... it could be any value.
  INREC BUILD=(C'F2,''',1,8,C'''',80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  file1
//SORTOUT DD DSN=...  file2
//SYSIN DD *
  OPTION COPY
* Use F2 symbol to build output record as:
* 08-11-0509-04-07
* Note: 08-11-05 is the first 8 bytes from file2 and 09-04-07 is the
* first 8 bytes from file1 ... these could be any values.
  INREC BUILD=(F2,1,8,80:X)
/*

Re: Overlay: how to arrive at the correct output using dfsort

PostPosted: Fri Sep 07, 2007 2:09 am
by William Thompson
Dang Frank, If I'd understood that it was a constant, I wouldn't been so far off base.... :oops:

Re: Overlay: how to arrive at the correct output using dfsort

PostPosted: Fri Sep 07, 2007 3:03 am
by Frank Yaeger
I'm not sure what you mean by a "constant". I'm using the first 8 bytes from the first record in each file. Those values can change and the job would still work. I edited my post to make that clear.