What is the reference modification

Questions by sprabodhini

Showing Answers 1 - 12 of 12 Answers

Say the following is your cobol code:

000340 01  TREE-TYPE      PIC X(15) VALUE 'BANANATREE'. 000350 01  FRUIT-TYPE     PIC X(15) VALUE 'BANANA'.     000360 01  TREE-FRUIT     PIC X(5).   If you wanna move only particular value to another variable instead of as a whole value you can use reference modification.
For Eg :

You can say
004310 004320 MOVE TREE-TYPE(1:5) TO TREE-FRUIT. 004440
This will move "BANAN" to TREE-FRUIT. (The letters from position 1 of TREE-TYPE for 5 positions.So this : (colon) is called ref modification indicator.Like this you can use MOVE TREE-TYPE(2:4) TO TREE-FRUIT.So the character from 2nd position for 4 character length will get move.




  Was this answer useful?  Yes

pawan_kch

  • Jun 20th, 2008
 

Reference modification is used to retrieve/replace the set of characters from a string.

Ex: MOVE WS-VAR(1:5) TO PV-VAR.
      MOVE 'GEEK' TO WS-VAR(1:4).
     

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions