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 give cylinder(1,1)how many cylinders it will be allocate?

3 Answers   Hewitt,


What is the difference between structured cobol programming and object alternativelyiented cobol?

0 Answers  


Why we are using comp and comp-3 in real time projects?

4 Answers   IBM,


Which Search verb is equivalent to PERFORM…VARYING?

0 Answers  


How do you get the data to code the BMS macro?

0 Answers   IBM,






System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..

0 Answers   Amdocs,


How can you get the ksds file records into your cobol program?

0 Answers  


Can we use goto statement in inline_perform ?

5 Answers   IBM,


can we use the two 01 level in file discription ?

6 Answers  


how do u indetify files succesfully executed or not ?

4 Answers   TCS,


what is the meaning of pic 9(09)v99-

4 Answers   HSBC,


How to display the index.(displacement from an array)

4 Answers   IBM,


Categories