IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Is it possible to code a direct sql update query in COBOL


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jonnavarapu786

New User


Joined: 28 Mar 2007
Posts: 2
Location: noida

PostPosted: Mon May 07, 2007 2:29 pm
Reply with quote

First one.

Suppose, my embeded sql is fetching two rows.(Iam not using cursors).
I will get -811 sql error, my question is what value will come to host variables.
ex: SELECT ename INTO : HV_ename FROM emp WHERE sal = 5000;

Second one,

suppose, in a update/insert SQL query for vachar field, I given/moved length = 10, text = 20 chars. what will happen while updating/inserting.
is only 10 chars of the text is updated/inserted or 20 chars of the text.
plz clarify ........

Third one.

Is it possible to code a direct sql update query in COBOL- DB2 pgm.
ex: update emp_table set sal = 6000 where sal = 5000;

Eagarly waiting for ur valuble correct answers......
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon May 07, 2007 2:45 pm
Reply with quote

Hi jonnavarapu786 !

First :
Nothing is inserted into your host-variables, they aren't changed

Second:
10 bytes, correct me if i'm wrong

Third:
Yes

Regards, UmeySan
Back to top
View user's profile Send private message
pyar
Warnings : 1

New User


Joined: 15 May 2006
Posts: 4

PostPosted: Thu May 10, 2007 3:26 pm
Reply with quote

Hi,

1st row values will be there with host variables,
while retriving the 2nd row only you will get -811

Correct me if i am worng

Thanks,
Pyari
Back to top
View user's profile Send private message
ashwinreddy

Active User


Joined: 16 Sep 2004
Posts: 106
Location: Hyderabad

PostPosted: Thu May 10, 2007 4:26 pm
Reply with quote

Hi,

1st

When your query results in more than 1 row then the program abends with -811 without any values in Host variable.

If you have given as ignore -811 condition then you will get the first row.

2nd

As far as i know it will update the 20 chars (updating 10 char with ur input and rest with spaces).

3rd

Question is confusion for me.

Do you intend with using any host variables, if so you can.

Cheers
Ashwin
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts run rexx code with jcl CLIST & REXX 15
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Compile rexx code with jcl CLIST & REXX 6
Search our Forums:

Back to Top