Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Clarification in Move statement ?????

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Abirami.YN

New User


Joined: 16 Jul 2005
Posts: 15
Location: India - Chennai

PostPosted: Wed Dec 28, 2005 4:03 pm    Post subject: Clarification in Move statement ?????
Reply with quote

Hi,

Can anybody help me for these queries?

1. Var1 - declared as S9(7) COMP-3
Var2 - declared as S9(05) COMP-3

I want to move first 2 digit of var1 to var2

How can i do that?

2. What is LOW-VALUE?


Thanks,
Abirami.
Back to top
View user's profile Send private message

khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Wed Dec 28, 2005 4:12 pm    Post subject: Variable doubt
Reply with quote

Hi Abirami,

Quote:
2. What is LOW-VALUE?


Passing the minimal value to the variable. ie., it will pass 0 as the low-value to the variable where it wont effect any changes to the prog.
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 464

PostPosted: Wed Dec 28, 2005 6:14 pm    Post subject: Re: Clarification in Move statement ?????
Reply with quote

Hi,

Quote:
1. Var1 - declared as S9(7) COMP-3
Var2 - declared as S9(05) COMP-3

I want to move first 2 digit of var1 to var2

How can i do that?


Try followin code.

Move var(1:2) to Var2
Move spaces to var2(3:3)

Hope this helps

Regards
Rupesh
Back to top
View user's profile Send private message
kumar_ngl
Warnings : 1

New User


Joined: 05 Aug 2005
Posts: 50
Location: chennai

PostPosted: Wed Dec 28, 2005 6:28 pm    Post subject:
Reply with quote

hi,

To move a part of a data item to another data item there is a concept called reference modification.

move var1 (1: 2) to var2.

it will move exactly 2 char from the 1st to var2.

kumar.p.v
Back to top
View user's profile Send private message
jeyakanthan

New User


Joined: 18 May 2005
Posts: 12
Location: chennai

PostPosted: Wed Dec 28, 2005 6:44 pm    Post subject: Re: Clarification in Move statement ?????
Reply with quote

I want to know whether we can apply reference modification for all data types in cobol.
Back to top
View user's profile Send private message
Imran

New User


Joined: 26 Dec 2005
Posts: 12
Location: Pune

PostPosted: Wed Dec 28, 2005 7:05 pm    Post subject:
Reply with quote

hEY gUYS

wE CANT DO REFERENCE MODIFICATION ON nUMERIC FIELDS . It will fail

It has to be alphanumeric.

Regards
Imran
Back to top
View user's profile Send private message
Imran

New User


Joined: 26 Dec 2005
Posts: 12
Location: Pune

PostPosted: Wed Dec 28, 2005 7:12 pm    Post subject:
Reply with quote

Hey

We can achieve this by redefining the var-1.

var-1 s9(7) comp-3
Temp-1 redefines var-1.
TEMP1-A 9(02)
TEMP1-B 9(02)
TEMP1-C 9(02)

then move TEMP-1-A to var-2.

Regards
Imran

HEY plz crct me if i am wrong
Back to top
View user's profile Send private message
anilbatta

New User


Joined: 13 Nov 2005
Posts: 22

PostPosted: Wed Dec 28, 2005 7:14 pm    Post subject:
Reply with quote

Hi

I agree with Mr. Kumar_ngl. Because in COBOL we can apply Reference Modification for any data types.

Using Reference Modification, exactly the varioable values will be moved from one variable to another variable.

Example: Move Var1(1:3) to Var2.

It means moving the 3 characters from Var1 to Var2. This is the best example and refer COBOL book by M.S.Roy and Dastidhar. As for as concerned to me this is the best book and clearly it will be mentioned in that.

Regards,
Anilbatta
Back to top
View user's profile Send private message
Imran

New User


Joined: 26 Dec 2005
Posts: 12
Location: Pune

PostPosted: Wed Dec 28, 2005 7:19 pm    Post subject:
Reply with quote

Hey Anil i am sorry to tell that u r wrong

The following is the MVS quickreference proof.



FUNCTION function-name (argument1 ...) (leftmost:length)
where data-name is an item whose USAGE IS DISPLAY. For COBOL/370,
data-name can also be an item whose usage is DISPLAY-1.

function-name must be an alphanumeric function followed by its required
arguments (if any).
Quote:
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Dec 29, 2005 4:02 am    Post subject: Re: Clarification in Move statement ?????
Reply with quote

Quote:
1. Var1 - declared as S9(7) COMP-3
Var2 - declared as S9(05) COMP-3

I want to move first 2 digit of var1 to var2

How can i do that?


Guy, Guys, Guys,,,,

Have we all lost our senses here? Let?s take some time to think about the structure of a COMP-3 variable.

Time?..time?..time?.

OK, have we taken time to think about this?

If we have a var-1 pic s9(7) comp-3 with a value of +1234567 the hex value will be:

1357
246C

Remember, the last half right most byte is the sign.

How can you use reference modification (AND WE CANNOT ON A COMP-3 FIELD) and maintain the sign. And what would happen if it was pic s9(8) with value -12345678

02468
1357D

Making the assumption that the results in var-2 is to be +12, your going to have to move the comp-3 field to a display field, redefine the first two digits and move those to var-2, or

Code:

COMPUTE VAR-2 = VAR-1 / 10000.
 
     Or

DIVIDE VAR-1 BY 10000 GIVING VAR-2
Back to top
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Thu Dec 29, 2005 4:14 am    Post subject:
Reply with quote

Low Values are not always zeroes. They are the lowest poistioned characters in a programs Collating sequence and it depends on the Collating sequence clause of the program.

By default, Low-Values will have null.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us