RAMESH KRISHNA REDDY mainframe discussion forum - cobol, db2,cics,jcl,file-aid,changeman,interview questions
Online Tutorials   | PREV  | TOP  | NEXT





MOVE Verb MOVE literal-1/sending-data-item-1 TO receiving-data-item-1. MOVE is a Cobol verb, when there is a need for transfering value from one dataitem to another data item, using MOVE verb we can achieve that task. In above syntax, value from sending-field-1 will be moved to receiving-field-1. Sending-filed-1 can a data item OR a literal (string). Example for move a literal to a numeric data item. 01 WS-A PIC 999 VALUE 000. .... MOVE 345 TO WS-A. Before execution of above statement WS-A contains 000 as a value. After execution of above statement WS-A contains 345. Example - Move a alphanumeric literal to alpha numeric data item. 01 WS-NAME PIC X(4) VALUE 'JOHN'. ... MOVE 'JACOB' TO WS-NAME. Before execution WS-NAME contains value JOHN Afer execution of MOVE statement, WS-NAME contains JACO. If you observe only 4 letters from the string JACOB got transfered to WS-NAME because WS-NAME defined with length of 4 bytes.In alphabetic OR alphanumeric moves, Receiving fields receive the letters from left to right as shown below. That is the reason WS-NAME contains JACO If the receiving field is a numeric data item, data transfer happens from right to left. 01 WS-A PIC 999 VALUE 890. 01 WS-B PIC 99 VALUE 22. ... MOVE WS-A TO WS-B. If numeric data item has any decimal part in it. numeric value after the decimal will be moved to receiving field from left right. i.e, 1st digist after decimal movement happens first, then 2nd byte, etc...



Previous chapter in COBOL tutorial Starting of COBOL tutorial Next chapter in COBOL tutorial

Visit COBOL books section in this site for good books

Home | Donations | Online Tutorials | Books | Entertainment | Contactme | privacy |  sql tutorial | jcl interview questions | JCL Tutorial | JCL Tutorial - chapter1 | JCL Tutorial - chapter2 | JCL Tutorial - chapter3 | JCL Tutorial - chapter4 | JCL Tutorial - chapter5 | JCL Tutorial - chapter6 | JCL Tutorial - chapter7 | JCL Tutorial - chapter8 | JCL Tutorial - chapter9 | JCL Tutorial - chapter10 | JCL Tutorial - chapter11