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

if you code move high-values to variable,can you move it into numeric variable or alphanumeric variable?

1 Answers   Patni,


what is subscript in cobol?give realtime example?

2 Answers   Wipro,


What is 66 level number and where it is used in real time by software developers?

2 Answers   ITC Indian Tobacco Company, TCS,


diffrence between renames and redifnes with examples

3 Answers   IBM,


Can we move X(7) to S9(7) COMP?

1 Answers  


study the following 01 A PIC 99V0 VALUE 5 01 B PIC 9V9 VALUE 6 01 C PIC 99V9 VALUE 2.5 01 D PIC 99 VALUE 3 COMPUTE A ROUNDED B C = A+B*C/D ON SIZE ERROR PERFORM PRINT-ERROR the comments of A.B.C after execution of the above statement are a.A=10 B=0 C=10 b.A=10 B=9.9 C=9.9 c.A=10 B=0 C=9.9 d.A=10 B=6 C=10

4 Answers   TCS,


WHAT IS SOC3?HOW IT CAN BE RESOLVED?

1 Answers  


i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this

0 Answers  


subscript and index r not coded in u r application program what will happen?

2 Answers  


how we rectify soc7 and soc4 errors in project?

1 Answers   Anaxis, TCS,


)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?

0 Answers   IBM,


What do you do to resolve SOC-7 error?

2 Answers   Sun Life, Wipro,


Categories