View previous topic :: View next topic
|
Author |
Message |
Debabrata Pruseth
New User
Joined: 11 Dec 2008 Posts: 59 Location: Pune , India
|
|
|
|
Hi Robert
I am afraid my understanding is similar to Shashkant . Alphanumeric values are left justified and numeric values are right justified till the decimal point and after the decimal point left justified. So when the movement happens from one variable to another the movement starts from that justified direction to the opposite ie right to left ; or left to right accordingly. This is however in literal sense.
I think MVC may be generating instruction for left to right movement in general however there might be some other internal final adjustment must be happening to give the final output that we have been discussing. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I am afraid my understanding is similar to Shashkant |
Very quickly it will be to your advantage to obtain a more correct understanding.
Quote: |
however there might be some other internal final adjustment must be happening to give the final output that we have been discussing |
If you look at the actual assembler code generated, you will see everything accounted for. There is no internal final adjustment happening. It is just simple one-instruction-at-a-time code that is executed when the code reached that section of the logic. All of the assembler generated by the compiler is visable in the compiler output. If you find some code that is questionable, post the cobol definitions and displacements for those fields as well as the generated assembler instructions and specific discussion can be done from that point. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Debabrata: as Dick said, your understanding is faulty. Some specifics from your post: there is LEFT justification (usual alphanumeric variables), RIGHT justification (alphanumeric variables with JUST RIGHT), and numeric justification -- which is neither left nor right but DECIMAL aligned. For numeric fields, the COBOL compiler determines how many bytes to move to the receiving field, and the conversion (if any is required), and generates pseudo assembler to move the bytes correctly If you move a PIC 9(7) to a PIC 9(3) field, COBOL generates a 3-byte move -- the last 3 bytes of the sending field are moved to the receiving field via an MVC (left to right move) instruction. What about the first 4 bytes? Not touched, not moved, not even considered for a move. Literally, there is no right to left move instruction. From the COBOL Language Reference manual, note that the manual on numeric data moves does not talk about left or right justification but decimal alignment:
Quote: |
5.1.6.6 Alignment rules
The standard alignment rules for positioning data in an elementary item depend on the category of a receiving item (that is, an item into which the data is moved; see "Elementary moves" in topic 6.2.24.1).
Numeric
For such receiving items, the following rules apply:
1. The data is aligned on the assumed decimal point and, if necessary, truncated or padded with zeros. (An assumed decimal point is one that has logical meaning but that does not exist as an actual character in the data.)
2. If an assumed decimal point is not explicitly specified, the receiving item is treated as though an assumed decimal point is specified immediately to the right of the field. The data is then treated according to the preceding rule.
Numeric-edited
The data is aligned on the decimal point, and (if necessary) truncated or padded with zeros at either end, except when editing causes replacement of leading zeros. |
|
|
Back to top |
|
|
Debabrata Pruseth
New User
Joined: 11 Dec 2008 Posts: 59 Location: Pune , India
|
|
|
|
Thanks a lot Robert and Dick for the information . This explains everything. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
These guys (and many more here in this forum) seem to be "walking Encyclopedia"..
Regards,
Ad |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Sorry, Anuj, I don't know it all -- but I do know where to find it, and how to find it! |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
ok, but I'll not stop calling you that..
Ad |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Bala & Abin,
If your compiler supports Ref/Mod, a simple solution is:
Code: |
MOVE X-FLD TO 9-FLD(1:) |
|
|
Back to top |
|
|
foruamit2004
New User
Joined: 17 Dec 2008 Posts: 3 Location: India
|
|
|
|
Hi,
This is my very first post on this community. i'm new to mainframe(infact in IT industry)...just wanted to say what shashank has said about left and right justification is what we were told in our training program
Since their is no indroduction Thread, plz consider this as my intro.
Hope to learn much more from this froum in future.
Regards
Amit |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi Amit and welcome to the Forums,
Not only the concept discussed in this thread only, there are many more things which you will realize that they were "injected" in our heads in an incorrect way.
Pity but true - I met and meet many people everyday who have no respect towards their profession & surprigenly they keep on "instructing" others as well..idiots...
If you are ready to invest your time, many of us will be here to help you out. Whenever you have a doubt do a research on your problem, not solved, post us a good description of problem & what you have done – some one will be around with suggestion for sure..
Good Luck.. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Anuj D. wrote: |
Hi Amit and welcome to the Forums, |
Sorry Dick.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Anuj,
No worries
d |
|
Back to top |
|
|
Shashank.kapoor
New User
Joined: 14 Jan 2009 Posts: 24 Location: Mumbai
|
|
|
|
Hi,
There could be many other things like this which were told wrong to us at the initial phase and found the same knowledge among collogues.
It’s just a matter you met with a people who simply corrects your knowledge instead of criticizing you.
The thread will help many to correct there understanding on this.
Thanks to all the members of the forum to take out some time from there schedule to share there knowledge.
--------------
Shashank |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Don't worry 'am (we are) creating an invoice.. |
|
Back to top |
|
|
foruamit2004
New User
Joined: 17 Dec 2008 Posts: 3 Location: India
|
|
|
|
Thank you every one |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
You are welocme... |
|
Back to top |
|
|
|