View previous topic :: View next topic
|
Author |
Message |
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Hi,
I m having two flat files.The contents from these two files have to be merged as
FILE A:
XXXX YYYY ZZZZ
AAAA BBBB CCCC
FILE B
10/12/1984
Note: File B always contains a single record only.(ie a date value)
EXPECTED O/P:
XXXX 10/12/1984 YYYY ZZZZ
AAAA 10/12/1984 BBBB CCCC |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Murugan,
What are the LRECL/RECFM of your input and output files? |
|
Back to top |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
FILE A:
LRECL=17
RECFM=FB
FILE 8:
LRECL=10
RECFM=FB |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
What about Output file LRECL? |
|
Back to top |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Arun,
Quote: |
What about Output file LRECL |
LRECL=10
RECFM=FB
I tried the following way and got the desired o/p.Is there any other way
to achieve the desired o/p.Let me know ur thoughts about this.
In file A & file B I appended a string 'MATCH'.
Ex
File A:
=====
field1 field2 field3 field4
XXXX YYYY ZZZZ MATCH
AAAA BBBB CCCC MATCH
File B:
=====
field1 field2
10/12/1984 MATCH
Then i did a sort join on the string 'MATCH' and reformatted to get
the desired o/p.
XXXX 10/12/1984 YYYY ZZZZ
AAAA 10/12/1984 BBBB CCCC
It works fine.
[/quote] |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Murugan L,
You can have the date-value in a PS file of FB/LRECL=80 and use it as a SYMNAMES dataset like this. I am away from office now and cant test this now. Try and post back if you come across any issues.
Code: |
DATE-P,'10/12/1984' |
Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN= date-file -- FB/LRECL=80
//SORTIN DD DSN= Input file -- FB/LRECL=17
//SORTOUT DD DSN= Output file -- FB/LRECL=25
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,5,DATE-P,17:6,9)
/* |
|
|
Back to top |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Arun,
I have mentioned the wrong o/p LRECL.
It has to be 27.Sorry for the confusion.
But i tried the above said code it is working fine...
Thanks a lot!!! |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
You're welcome. Glad to hear that it worked for you. |
|
Back to top |
|
|
|