View previous topic :: View next topic
|
Author |
Message |
mrdinesh
New User
Joined: 23 Sep 2006 Posts: 24 Location: India
|
|
|
|
Hi,
I have a requirement where I have two files
File1
Code: |
Header
Record1
Record2
Date 01/01/2013
Record3
Record4
Trailer
|
File2
My requirement is to replace the Date in the File1 with the Date in the File2.
I tried with Joinkeys to do the same as
Code: |
SORT FIELDS=COPY
JOINKEYS FILE=SORTJNF1,FIELDS=(1,4,A)
JOINKEYS FILE=SORTJNF2,FIELDS=(1,4,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,80,F2:1,80)
INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'DATE'),OVERLAY=(1:81,80,81:80X))
OUTREC FIELDS=(1:1,80)
|
But the output came in a sorted order, but I dont require the files to be sorted?
Is there any other way to do the same?
Thanks,
Dinesh |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
Back to top |
|
|
mrdinesh
New User
Joined: 23 Sep 2006 Posts: 24 Location: India
|
|
|
|
Thanks Rohit...I was able to solve the issue.. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
No to JOINKEYS. It would be absurd to sort the data twice just to update one record.
Two-step process. First step takes the date-file and generates a symbol for a SYMNAMES dataset (ensure that records are 80 bytes).
Second step, which has DDnames for SYMNAMES using the file created and SYMNOUT going to SYSOUT, then a COPY operation with INREC IFTHEN=(WHEN=(logical expression) to identify the embedded date record and replace the value with the value from the symbol.
There are examples of the process if you search the forum for SYMNAMES, for instance. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
mrdinesh wrote: |
Thanks Rohit...I was able to solve the issue.. |
Remember, somewhere there is a Client paying for those resources. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Bill, that helps. Thanks |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Bill,
Just checking,If file 2 is going to have last date of the year we could also use LASTDAYY correct? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If the answer required is always 31 December of the source year, then LASTDAYY would do it. |
|
Back to top |
|
|
|