Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Hi All,
Can anyone tell me how we can MOVE value of a X(19)
variable to a S9(17) COMP-3 variable?
Answer with an Example will be of great help.

Answers were Sorted based on User's Feedback



Hi All, Can anyone tell me how we can MOVE value of a X(19) variable to a S9(17) COMP-3 variable?..

Answer / nicx

The function NUMVAL can be used to change the X(19) to S
(17) and then moved to comp-3
Ex:
ws-variable PIC X(19)
ws-variable-1 PIC S9(17)
ws-variable-1 PIC S9(17) comp-3
Compute ws-variable-1 = function numval(ws-variable)
move ws-variable-1 to ws-variable-2.

Ofcourse you should be expecting a signed 9(17) value in
the ws-variable. Check out NUMVAL-C too. Both functions are
a great help in such situations.

Is This Answer Correct ?    6 Yes 0 No

Hi All, Can anyone tell me how we can MOVE value of a X(19) variable to a S9(17) COMP-3 variable?..

Answer / ram.g

you can try with redefine....

Is This Answer Correct ?    3 Yes 1 No

Hi All, Can anyone tell me how we can MOVE value of a X(19) variable to a S9(17) COMP-3 variable?..

Answer / nk

05 MY-NUM-ALPHA PIC X(9).
05 MY-NUM REDEFINES MY-NUM-ALPHA PIC S9(17) COMP-3.
MOVE 'ABCDEFGHI' to MY-NUM-ALPHA.
note that comp-3 stores 2 numbers per byte so 17 digits
takes 9 bytes (half of one byte stores the sign.) So you
could move a 19-character variable to a 9-byte field but it
will be truncated.

Is This Answer Correct ?    5 Yes 5 No

Hi All, Can anyone tell me how we can MOVE value of a X(19) variable to a S9(17) COMP-3 variable?..

Answer / gans

NICX's statements worked for me...
Thanks NICX....

Is This Answer Correct ?    0 Yes 0 No

Hi All, Can anyone tell me how we can MOVE value of a X(19) variable to a S9(17) COMP-3 variable?..

Answer / ram.g

Vamsi, u r wrong, you have to read the 2nd answer again...
we can't perform any numeric operations on arithmetic field
thats right for overcome that scenario only we are using
the method called redefine. when you redefine its pointing
to the same loacation only but just telling the MVS
consider the new picture clause for the new variable..one
thing is sure here which is nothing but truncation when you
try to move x(...) to comp-3 but we can perform arithmetic
operations for sure..you can try it out....

Is This Answer Correct ?    2 Yes 3 No

Hi All, Can anyone tell me how we can MOVE value of a X(19) variable to a S9(17) COMP-3 variable?..

Answer / vamsi

First of all s9(17) comp-3 will occupy 9 bytes and X(19) has
19 bytes of memory.

When we move the text value to an comp-3 field, we will get
Soc7 error. We cannot move alpha values to numeric fields.
If the X(17) contain numeric values then we can move this
field to s(17) comp-3 field and we can move only 9 bytes
other data will be trucated.

Is This Answer Correct ?    4 Yes 8 No

Post New Answer

More COBOL Interview Questions

what is the advantage of sync class

3 Answers   ACS,


What are differences between COBOL and java ? why we are giving more preference to COBOL ?

3 Answers   TCS,


what is Pic 9v99 Indicates?

2 Answers  


what is level 66 means??

7 Answers  


EXPLAIN MAIN FRAME TESTING PROCESS...HOW TO FIX THE MAINFRAME BUGS?

0 Answers   Accenture,


consider the following PROCEDURE DIVISION entry OPEN EXTEND IN-FILE identify the correct statement a.organization of IN-FILE is sequential and records can be added in the beginning b.organization of IN-FILE is sequential and records can be added in the end c.organization of IN-FILE is indexed and records can be added in the beginning d.organization of IN-FILE is indexed and records can be added in the end

3 Answers   TCS,


What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?

0 Answers   TryTechnicals Pvt Ltd,


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

4 Answers   IBM,


what are the utilities for load and unload the DB2 tables

1 Answers   L&T,


when SE37 SB37 and sd37 occurs how to increase the volume , primary quantity and secondary quantity?

1 Answers   Hewitt,


What does the initialize statement do ?

2 Answers  


What is the maximum length of a field you can define using COMP-3?

4 Answers   Complex System, Infosys,


Categories