View previous topic :: View next topic
|
Author |
Message |
Abirami.YN
New User
Joined: 16 Jul 2005 Posts: 15 Location: India - Chennai
|
|
|
|
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 |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
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 |
|
|
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 463
|
|
|
|
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 |
|
|
kumar_ngl Warnings : 1 New User
Joined: 05 Aug 2005 Posts: 50 Location: chennai
|
|
|
|
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 |
|
|
jeyakanthan
New User
Joined: 18 May 2005 Posts: 12 Location: chennai
|
|
|
|
I want to know whether we can apply reference modification for all data types in cobol. |
|
Back to top |
|
|
Imran
New User
Joined: 26 Dec 2005 Posts: 12 Location: Pune
|
|
|
|
hEY gUYS
wE CANT DO REFERENCE MODIFICATION ON nUMERIC FIELDS . It will fail
It has to be alphanumeric.
Regards
Imran |
|
Back to top |
|
|
Imran
New User
Joined: 26 Dec 2005 Posts: 12 Location: Pune
|
|
|
|
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 |
|
|
anilbatta
New User
Joined: 13 Nov 2005 Posts: 22
|
|
|
|
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 |
|
|
Imran
New User
Joined: 26 Dec 2005 Posts: 12 Location: Pune
|
|
|
|
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).
|
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
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 |
|
|
|