AS400 Sql Statement need to be modified. To look in 2 different files before it looks in the below file for the correct address.
"SELECT pat.bdat, pat.lname, pat.pname, pat.pmidi, pat.medrcc, " +
"pat.race, pat.sexcd, pat.status, pat.pssno, pat.pdocno, pat.garno, pat.fmnum, " +
"pat.pcode1, pat.pphon1, pat.pcode2, pat.pphon2, gar.addr1, gar.addr2, " +
"gar.city, gar.st, gar.zipcd " +
"FROM TCRAR001.patmasl pat " +
"LEFT OUTER JOIN TCRAR001.garmasl gar " +
"ON pat.garno = gar.garno", connection);
The first file the statement should look at is
TCRAR001/CONTAC1 - Contact authorization by account, if there is no address in this file it would then look at TCRAR001/PATMASL
File . . . : CONTAL1 Member . . : CONTAL1 Record Length . : 376
Library . : TCRAR001 Format . . : CONTAR File Access . . : Keyed
Page# . . . : 1 of 2 Mode . . . : Display Record Number . : 42804
Control . . . Text . . . : Contact authorization by account
Account # 20
Fm # 602
Standard
Standard W/email
Email Address
Phone Only X
Area Code 951
Phone # 6561171
Alt Address Flag
Address 1
Address 2
City
State
Zip Code
City-ref Zipcd+4
Area Code
2nd file to look at
TCRAR001/Patmasl
DATA BASE UTILITY (DBU)
File . . . : PATMASL Member . . : PATMASL Record Length . : 520
Library . : TCRAR001 Format . . : PATMAS File Access . . : Keyed
Page# . . . : 1 of 5 Mode . . . : Display Record Number . : 19517
Control . . . Text . . . : Patient Master Logical File By GA
Clinic Number 1
Guarantor Number 3
Family-member Number 1
Patient Address 1 3044 HORACE ST
Patient Address 2
Patient Address 3
Patient City RIVERSIDE
Patient Home Area Code 714
Patient Employ Area Code
Patient Msg Area Code
Primary Doctor Number
Patient Employment Code
Patient Employment Date 0001-01-01
Patient Employee
If there is an address here that is where it would stop, but if not it would go on to the address that is in TCRAR001/GARMASL as it is now in the above sql statement.
Can I change the above sql statement to do what I need done, or must this b
You have the SQL quoted and show "+" signs to indicate continuation of lines. Is this embedded SQL? Are you preparing a statement? If so, what language?
What condition tells you there "is no address" in the tables? Are the values blank? ...null? ... some special value?
Tom