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

How do you compile cobol program..?

1 Answers  


what is soc7 abend?how u can trace it?

4 Answers   Accenture,


What is the maximum size of a 01 level item in COBOL I? in COBOL II?

2 Answers   IBM, RBS,


What are the different data types in cobol?

0 Answers  


How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.

0 Answers   Infosys,






db2 variable decimal(15,2) what is the equalent size of cobol variable

2 Answers   Syntel,


how would find total records in files using seqientional

1 Answers   HSBC,


01 xxx pic 9(4). 01 yyy pic 9(6). move 123456 into yyy. move yyy to xxx. display yyy. what would be the value of yyy

13 Answers   HSBC,


What is amode(31)

0 Answers  


Define REDEFINE clause and Is it possible to have the redefine clause anywhere in the working storage section for a data name?

3 Answers  


A table has two indexes defined. Which one will be used by the SEARCH?

0 Answers  


I have a file it contain 10 records.i got abend at 8th record because of soc7.how do you know that perticular record got abend?

3 Answers   IBM,


Categories