IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to move a 9(11) variable to 9(9)v99.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Debabrata Pruseth

New User


Joined: 11 Dec 2008
Posts: 59
Location: Pune , India

PostPosted: Wed Feb 04, 2009 11:26 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 04, 2009 11:40 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Feb 04, 2009 6:02 pm
Reply with quote

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
View user's profile Send private message
Debabrata Pruseth

New User


Joined: 11 Dec 2008
Posts: 59
Location: Pune , India

PostPosted: Wed Feb 04, 2009 6:06 pm
Reply with quote

Thanks a lot Robert and Dick for the information . This explains everything.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Feb 04, 2009 6:33 pm
Reply with quote

These guys (and many more here in this forum) seem to be "walking Encyclopedia".. icon_smile.gif

Regards,
Ad
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Feb 04, 2009 6:38 pm
Reply with quote

Sorry, Anuj, I don't know it all -- but I do know where to find it, and how to find it!
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Feb 04, 2009 6:56 pm
Reply with quote

ok, but I'll not stop calling you that.. icon_biggrin.gif

Ad
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Feb 05, 2009 7:57 am
Reply with quote

Hi Bala & Abin,

If your compiler supports Ref/Mod, a simple solution is:
Code:
MOVE X-FLD TO 9-FLD(1:)
Back to top
View user's profile Send private message
foruamit2004

New User


Joined: 17 Dec 2008
Posts: 3
Location: India

PostPosted: Tue Feb 10, 2009 7:17 pm
Reply with quote

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 icon_smile.gif

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Feb 10, 2009 7:34 pm
Reply with quote

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.. icon_smile.gif

Good Luck..icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Feb 10, 2009 7:34 pm
Reply with quote

Anuj D. wrote:
Hi Amit and welcome to the Forums,
Sorry Dick.. icon_razz.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 10, 2009 8:13 pm
Reply with quote

Hi Anuj,

Quote:
Sorry Dick..
No worries icon_wink.gif

d
Back to top
View user's profile Send private message
Shashank.kapoor

New User


Joined: 14 Jan 2009
Posts: 24
Location: Mumbai

PostPosted: Wed Feb 11, 2009 3:48 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Feb 11, 2009 4:58 pm
Reply with quote

Don't worry 'am (we are) creating an invoice.. icon_biggrin.gif
Back to top
View user's profile Send private message
foruamit2004

New User


Joined: 17 Dec 2008
Posts: 3
Location: India

PostPosted: Thu Feb 12, 2009 12:06 pm
Reply with quote

Thank you every one icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Sat Feb 28, 2009 6:17 pm
Reply with quote

You are welocme... icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
Search our Forums:

Back to Top