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

How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

0 Answers   HCL,


If a sub program is called from mainprogram.I have opened cursor in main program and Fetch the result in subprogram ,Is it possible ?If yes please tell me the reason.

1 Answers  


Can anyone tell me how to handle the array beyond the limit. If we have an array or a table which can handle 5000 records but now we have to compensate 20000 records with the same array? how to handle the situation.

2 Answers  


Study the DATA DIVISION entries and the three PROCEDURE DIVISION entries given below: 01 END-OF-FILE-SWITCH PIC XXX. 88 NO-MORE-RECS VALUE "YES". 88 MORE-RECS VALUE "NO". (i) READ SAMPLE-FILE AT END MOVE "YES" TO NO-MORE-RECS. (ii) IF NO-MORE-RECS = "YES" GO TO LAST-PARA. (iii) IF NO-MORE-RECS GO TO LAST-PARA. Which are wrong? (a) (i) and (ii) (b) (ii) and (iii) (c) (i) and (iii) (d) all

5 Answers   TCS,


have in 100 records in a flat file i want to move records like 1,3,5,7,9,11,.. to Output file1 and 2,4,6,8,10,12,14 .. records moved to Output file2..Pls Provide real time answer..

5 Answers   TCS,






In EBCDIC, how would the number 1234 be stored?

2 Answers   TCS,


In file1 have 80 records are like d1,d2,d3......D80. File2 have 1000records are like a1d1,a1d2,a3d3.....Etc. I want matching records in file3 ? Plse tell me the matching logic???I want answer only in cobol ?Not using any tool or jcl?

1 Answers   CSC,


What is normalisation?

2 Answers   IBM,


What happens when we move a comp-3 field to an edited (say z (9). Zz-)?

0 Answers  


77 a pic x(4) value '1234' -----> instead of this 'abcd' 77 b pic 9(4) value zeros. move a to b what is the answers for both cases? IS it possible? Give me elementary move rules briefly......

8 Answers  


How do we get current date from system with century in COBOL?

0 Answers   Winsol Solutions,


what happens if we wont give timestamp in precompilation process ?

4 Answers   Covansys,


Categories