I have a flat file that contains a Header and many Detail records. My problem is that there is no primary or foreign key to join the records. All that I know is that all of the detail records that follow a particular header record, belong to that header.
What I would like to do is to create a sequential value that will generate a value that will link each detail record to its' corresponding header. Please see below:
Any help would be appreciated..
****this is what I have****
HXXX XXX XXX XXXXX
DX X XXX X X XXXX
DX X XXX X X XXXX
HXXX XXX XXX XXXXX
DX X XXX X X XXXX
HXXX XXX XXX XXXXX
DX X XXX X X XXXX
DX X XXX X X XXXX
DX X XXX X X XXXX
****this is what I would like to see****
01 HXXX XXX XXX XXXXX
01 DX X XXX X X XXXX
01 DX X XXX X X XXXX
02 HXXX XXX XXX XXXXX
02 DX X XXX X X XXXX
03 HXXX XXX XXX XXXXX
03 DX X XXX X X XXXX
03 DX X XXX X X XXXX
03 DX X XXX X X XXXX
Generating a Key between a Header and Detail Record
Moderators: chulett, rschirm, roy
When you say 'this is what I have' does that mean you are currently generating that output? If so, it should be fairly simple to add a couple of stage variables to check for a Header record and increment a counter each time one is encountered.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers