Sending data is aplhabetic size 7 (value 3000), I wantated
this value to be stored in database, which is defined as
s9(7)v9(2)comp-3.

Answers were Sorted based on User's Feedback



Sending data is aplhabetic size 7 (value 3000), I wantated this value to be stored in database, wh..

Answer / guest1

In the above answer the group contains a PIC clause. It
wrong. Group item should not contain any PIC clause.
01 ws-in-alpha pic x(7).
01 ws-in-numeric redefines ws-in-alpha.
05 ws-data pic 9(7)v99.

01 ws-actual-data pic s9(7)v99 comp-3.

In procedure division,
move ws-in-numeric to ws-actual-data.

Is This Answer Correct ?    6 Yes 0 No

Sending data is aplhabetic size 7 (value 3000), I wantated this value to be stored in database, wh..

Answer / mvramesh

01 ws-in-data Pic X(7)
05 ws-numeric Pic x (4) value '3000'
05 ws-filler Pic x (1) value '.'
05 ws-decimial pic x (2) value '00'

01 WS-Temp-CHAR PIC X(6)
05 ws-num Pic x (4)
05 ws-dec Pic x (2)

01 WS-TEMP-NUM redefines WS-Temp-char pic 9(4)V9(2)

01 WS-OUT-Data PIC S9(7)V9(2) comp-3

move ws-numeric to ws-num
move ws-decimal to ws-dec

move ws-temp-num to WS-OUT-data

here is the logic, there may be syntax errors. need to modify based on the format of input data.

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More COBOL Interview Questions

Explain the configuration section of a cobol program with examples of syntax.

0 Answers  


If we use GO BACK instead of STOP RUN in cobol?

1 Answers   Temenos,


What is the difference between Call and a Link?

0 Answers  


What is comp-1 and comp-2?

0 Answers  


I've one string with spaces ( I N D I A ). My question is I want remove the spaces & combine in to single string without space (INDIA).How we can write the cobol program & wich options we need to use. Please let me know.

10 Answers   Mascon,






PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B>2 AFTER C FROM 2 BY -1 UNTIL C<2 How many times the paragraph ACCUMULATE-TOTALS would be exicuted?

5 Answers   TCS,


where do u use low-value and high value in cobol

3 Answers   CGI,


How you can characterize tables in cobol?

0 Answers  


How do u write test cases?

0 Answers   IBM,


how do u link sub pgm to main pgm ?

2 Answers   TCS,


how do you reference the esds vsam file formats from cobol programs

0 Answers  


If i initialize the 01 level variable in array, will it initialize all the array elements (occurs)?

8 Answers   CTS,


Categories