|
View previous topic :: View next topic
|
| Author |
Message |
Shriram Jogdand
New User

Joined: 14 Oct 2008 Posts: 65 Location: Pune
|
|
|
|
Hi,
I have 2 files. I want to compare them. But the value format is different in both these files. For eg, one have value as 02000 and other have value as
2,000
Is there any way through which I can convert one format into other? I mean can we convert 02000 to 2,000 or vice versa so that I can match these 2 files through joinkeys? |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
if you only want to do it for the purposes of joining,
you can icetool with multiple applications:- reformat the file
- JOINKEYS
most of the examples for joinkeys is of this type. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| Shriram Jogdand wrote: |
Hi,
Is there any way through which I can convert one format into other? I mean can we convert 02000 to 2,000 or vice versa so that I can match these 2 files through joinkeys? |
May be .. But not before you show us how both the input files look like,
sample record in both and what you want as output...
What is the record format and record lenght of both the input files... |
|
| Back to top |
|
 |
Shriram Jogdand
New User

Joined: 14 Oct 2008 Posts: 65 Location: Pune
|
|
|
|
Both files are FB have file lenght as 15.
File 1 structure
10 02000
10 02199
20 09888
20 10000
30 02400
40 02050
File 2
10 2,000
10 2,199
20 9,888
20 1,000
40 2,050
I want records in o/p file as those whose values are not matching in both file.
30 02400
But since 2,000 of first record of file1 cant be matched with 02000 of second file directly, is there any way to convert these values in same format?
Can we do this in same step or by adding new steps to convert the files to same format and then joining them? |
|
| Back to top |
|
 |
kratos86
Active User

Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
| your input files are confusing, first file was having a value of 20 10000 but in second file it is 20 1,000. Please provide us valid examples and specify the rules completely. |
|
| Back to top |
|
 |
kratos86
Active User

Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
If your input file will look like this -
| Code: |
10 02000
10 02199
20 09888
30 02400
40 02050 |
using this code
| Code: |
OPTION COPY
OUTREC OVERLAY=(4:4,5,ZD,EDIT=(T,TTT)) |
you can attain
| Code: |
10 2,000
10 2,199
20 9,888
30 2,400
40 2,050 |
After which you can use join keys to match files. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
| deleted by poster |
|
| Back to top |
|
 |
Shriram Jogdand
New User

Joined: 14 Oct 2008 Posts: 65 Location: Pune
|
|
|
|
Thanks kratos86.  |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Shriram Jogdand,
You haven't mentioned your matching keys and based on your expected output (30 02400), you need to be matching on first 2 bytes only which doesn't need any conversion, unless you need conversion in the final output "after matching".
However, for either requirement,all these can be done in a single pass, you don't need 2 pass.I assumed you are trying to match on both the fields.
| Code: |
//STEP0001 EXEC PGM=SORT
//SORTJNF1 DD *
10 02000
10 02199
20 09888
20 10000
30 02400
40 02050
//SORTJNF2 DD *
10 2,000
10 2,199
20 9,888
20 1,000
40 2,050
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,2,A,16,5,A)
JOINKEYS FILE=F2,FIELDS=(1,2,A,04,5,A)
JOIN UNPAIRED,ONLY
REFORMAT FIELDS=(F1:01,15,F2:01,15,?)
INREC IFTHEN=(WHEN=(31,1,CH,EQ,C'2'),OVERLAY=(1:16,15))
OPTION COPY
OUTFIL BUILD=(1,15)
//JNF1CNTL DD *
INREC OVERLAY=(16:4,5,ZD,EDIT=(T,TTT))
//*
//SYSOUT DD SYSOUT=*
|
Thanks, |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
SQLCODE1,
slick move with the JNF cntl. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|