View previous topic :: View next topic
|
Author |
Message |
pbc3199
New User
Joined: 28 Sep 2007 Posts: 7 Location: Malaysia
|
|
|
|
My scenario problem is regarding to 'USER' are
1) I'm login to mainframe as 'EDS01'
2) My USER_PROFILE table structured are USER, NAME, BRANCH.
3) My data in USER_PROFILE are (ABC123, MYNAME, 01)
4) My cobol programming
Code: |
EXEC SQL DECLARE KURSOR CURSOR FOR
SELECT USER,
NAME,
USER_ID
FROM USER_PROFILE
END-EXEC.
EXEC SQL
FETCH KURSOR INTO
:USR-USER,
:USR-NAME,
:USR-BRANCH
END-EXEC.
DISPLAY 'USR-USER = ' USR-USER.
|
The problem is, when I display the USR-USER, the system display 'EDS01', not ABC123. Please help me how to display the correct data. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Your code is showing the data that is in the table.
Why might the sql show something that is not part of the table?
You could log on as "FRED" and the result should still be the same is it is now.
Possibly, there is something i misunderstand. |
|
Back to top |
|
|
pbc3199
New User
Joined: 28 Sep 2007 Posts: 7 Location: Malaysia
|
|
|
|
supposedly, the system should display 'ABC123'.
But, the system display my mainframe login userid ('EDS01'). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Looks like i read your results backwards. . .
Regardless, the sql is returning the value in the table.
Suggest you run a query in spufi without using a cursor and see what is really in the table.
Suggest also you make sure the column names are correct as well as the host variable names and definitions. |
|
Back to top |
|
|
pbc3199
New User
Joined: 28 Sep 2007 Posts: 7 Location: Malaysia
|
|
|
|
the data is exactly correct when i do the SPUFI.......
'ABC123', 'MYNAME', '01'
and i have define the variable correctly
I'm still stuck.......why the system display my mainframe login id? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
What do you see in the other host variables?
O. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
why the system display my mainframe login id? |
Not the answer you want, but the answer is in your code.
If the spufi query returned the problem value we might look elsewhere, but i suspect the code is the culprit.
Or there may be the possibility that the program is not using the exact same table as the spufi. How many different tables have the name USER_PROFILE? |
|
Back to top |
|
|
pbc3199
New User
Joined: 28 Sep 2007 Posts: 7 Location: Malaysia
|
|
|
|
can i say that USER column is reserved word in COBOL? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
pbc3199 wrote: |
can i say that USER column is reserved word in COBOL? |
at first, i wrote a quick an dirty criticizing you lack of db2 skills.
then I tested something and received some interesting results.
next post, out of time. |
|
Back to top |
|
|
pbc3199
New User
Joined: 28 Sep 2007 Posts: 7 Location: Malaysia
|
|
|
|
i'm new in mainframe.....could you please tell me more about bind parms? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
pbc3199,
I changed my post after you read it.
ok,
i have a table at work that has a column name: USER WHICH IS A RESERVED WORD.
in spufi,
if i
Code: |
select company
,product
,user
from my_company_table
|
results are:
Code: |
company
product
my user id
|
if my sql is
Code: |
select company
,product
,user as my_userid
,a.user as tab_user1
,"user" as tab_user2
from my_company_table a
|
results are:
Code: |
company,
product,
my user id,
user id from table
user id from table
|
so, I am not going to say that I don't believe you when you say SPUFI works ok,
just going to say,
qualify the column name or use double quotes
as the manual tells you to do. |
|
Back to top |
|
|
pbc3199
New User
Joined: 28 Sep 2007 Posts: 7 Location: Malaysia
|
|
|
|
at last.....i have settled my problem....thank you very much dbzTHEdinosauer........ |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
And another excellent catch by our resident "Dino". . .
d |
|
Back to top |
|
|
|