We are currently modifying a CICS-DB2 prod pgm which has a main menu map which shows address summary and then on selecting S on the record displays a full address on the next screen.
MAIN MAP:
OPTION NAME TRADE ZIP CODE CITY
S DAVID XXXXXXXX 08012 KANSAS
DETAIL MAP(XCTL from MAIN MAP):This would have the complete address.
To achieve this we had a prod query which looks like:
SELECT DISTINCT(For the main map summary)
a.name
,a.trade
,a.zip code
,a.city
FROM table1 a
,table2 b
WHERE a.key = b.key(KEY would be a selection variable entered on the main map).We had some issues with -811 coming on the detail screen since a particular NAME had multiple addresses in several LOCS in same city.
Hence we are trying to change this query to also send the LOC NUMBER to the detail program:
SELECT DISTINCT
a.name
,a.trade
,a.zip code
,a.city
,a.LOCNUM
this would help in uniquely identifying the address.
However when we do this the DISTINCT on the main map is getting affected.
EX:
DAVID XXXXXXXX 08012 KANSAS
DAVID XXXXXXXX 08012 KANSAS
Suppose we had these 2 addresses fetched in main map query then because of DISTINCT it would have sent 1 row to the map but now it would send 2 rows since we are also fetching the loc num.Since the loc num is not required on the map it ends up looking like entire duplicate rows on the main map.
Is there any way we can get the loc number in the same query without affecting the original 4 columns.So we should get 1 row and also get the loc num for the next program.
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
Quote:
Is there any way we can get the loc number in the same query without affecting the original 4 columns.So we should get 1 row and also get the loc num for the next program.
The short answer to this is: No there is not a way to accomplish this.
---------------------------------------------------------------------------------------
How is the user to know if LOCNUM 1 or LOCNUM 4 is the one they should be choosing?
Say you have this in your table
Code:
Bob plumber 90210 Beverly Hills 1
Bob plumber 90210 Beverly Hills 2
Bob plumber 90210 Beverly Hills 3
Bob plumber 90210 Beverly Hills 4
Bob plumber 90210 Beverly Hills 5
Am I correct in stating that you only want the following for your main screen?
Code:
Bob plumber 90210 Beverly Hills 5
Because by using DISTINCT in your first query you have no idea which LOCNUM you are getting. It could be 1,2,3,4, or 5 the result is indeterminate.
If you don't SELECT LOCNUM initially and do a select after the user has made a selection on the screen, how will you know which one is the correct LOCNUM if they are all the same except for the LOCNUM?