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

Clarification in Move statement ?????


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 677
Location: NJ

PostPosted: Wed Dec 28, 2005 4:12 pm
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: 463

PostPosted: Wed Dec 28, 2005 6:14 pm
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
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
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 JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts How to move DB2 Installation HLQ DB2 4
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
Search our Forums:

Back to Top