I have one column say 'X' defined as VARCHAR
Can anyone tell me What are the different ways to update
this column thru COBOL-DB2 program?

Answers were Sorted based on User's Feedback



I have one column say 'X' defined as VARCHAR Can anyone tell me What are the different wa..

Answer / anoop

As far as my knowledge if there is a VARCHAR in table then
its host variable should have the length field and data
field. I feel you have to populate bothe the fields in order
to update the VARCHAR field. please get it confirmed also.

Is This Answer Correct ?    4 Yes 0 No

I have one column say 'X' defined as VARCHAR Can anyone tell me What are the different wa..

Answer / priyanka

If a variable is defined as varchar, the filed will have a
length variable also. Before updating the value 'X', you
need to move the length of the new value to length filed
of 'X'.
Eg: If you want to update 'TEST' in 'X'.

MOVE LENGTH OF 'TEST' TO X-LENGTH
exec sql
UPDATE table
SET X = 'TEST'
Where clause
end-exec

Is This Answer Correct ?    3 Yes 0 No

I have one column say 'X' defined as VARCHAR Can anyone tell me What are the different wa..

Answer / shree

Use update query in the COBOL program inside the DB2 code
block
EXEC SQL
UPDATE <TABLE NAME> SET <COLUMN NAME> = 'X'
WHERE CLAUSE
END-EXEC

Is This Answer Correct ?    3 Yes 2 No

I have one column say 'X' defined as VARCHAR Can anyone tell me What are the different wa..

Answer / kk

hi,
if declare varchar format must declare length and text in
level no 49.

Is This Answer Correct ?    1 Yes 0 No

I have one column say 'X' defined as VARCHAR Can anyone tell me What are the different wa..

Answer / ravi

1.Use Update ....
2.Using Cursor ..for update only.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More COBOL Interview Questions

What is level 66 used for ?

3 Answers   TCS,


what is the difference between perform varying and perform until

4 Answers   TCS,


hi. This is Ram.i have one doubt.why can't we display comp-3 variables directly? let me answer quickly plez........

1 Answers  


OCCURS clause is used in the DATA DIVISION on data names at (a) 01 level (b) 77 level (c) 88 level (d) any level from 02 to 49

13 Answers   TCS,


What are differences between COBOL and java ? why we are giving more preference to COBOL ?

3 Answers   TCS,






Can printer files (having 133 characters) be of variable length?

3 Answers  


in cobol i have one file it contains records like 10,4,23,98,7,90..... total records 100. iwant 10 to 20 in reverse order in cobol environ ment any one please give the answer......

2 Answers   IBM,


How to convert bunch of words in a line to relvant ASCII values?

2 Answers  


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

0 Answers   HCL,


WORKING-STORAGE SECTION. 01 VAR1 COMP-2 VALUE 0. PROCEDURE DIVISION. MOVE 10.2115 TO VAR1. DISPLAY 'VAR1 =' VAR1. GOBACK. 10.2115 is stored as .10211499999999996E 02 in OS VS Cobol 10.2115 is stored as .10211500000000000E 02 in ecobol. Any reason why?

3 Answers   TCS,


01 WS-NAME PIC X(10) OCCURES 2. by this we can get ws-name 2 times. My qustion is how can we access the second name

5 Answers   TCS,


write a program to eliminate duplicate records in a input file and send them to output file.

2 Answers   IBM,


Categories