There are two key fields -=
Keys (start position , length)
file1 - key1 - (1,128)
file1 - key2 - (136,128)
file2 - key1 - (1,128)
file2 - key2 - (129,128)
I face problems in acheiving this task due to data in the key fields.
File1 is output of a DB2 query. Key1 & key2 are table name and creator name respectively. These fields are of variable length (max 128 characters) in database and therefore whenever the length is less than 128, x'00' is appended at the end. And another important thing is that trailing spaces in table name and creator name are considered as valid characters meaning that length of the table name or creator name includes trailing spaces and x'00' will be appended from length+1 position onwards.
For eg: if the table name is 'employee ' (2 trailing spaces) this is how my input file 1 will be
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 EMPLOYEE
CDDDDECC4400000000000000000000000000000000000000000000000000000000000000
547368550000000000000000000000000000000000000000000000000000000000000000
****** ***************************** Top of Data ******************************
000001 EMPLOYEE
CDDDDECC4400000000000000000000000000000000000000000000000000000000000000
547368550000000000000000000000000000000000000000000000000000000000000000
File2 is imported from a spreadsheet. Trailing spaces are not found in table names or creator names. I'm appending x'00' to the end to make them 128 characters long. Hence my file2 will be like this
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 EMPLOYEE
CDDDDECC0000000000000000000000000000000000000000000000000000000000000000
547368550000000000000000000000000000000000000000000000000000000000000000
****** ***************************** Top of Data ******************************
000001 EMPLOYEE
CDDDDECC0000000000000000000000000000000000000000000000000000000000000000
547368550000000000000000000000000000000000000000000000000000000000000000
Though I can replace x'40' with x'00' in file1 and then do a compare, I dont prefer it as I need those records in my output without being altered. If I have their length, ignoring trailing spaces in file 2 then how can I use this varying field to indicate the key length in JOIN KEYS syntax?