View previous topic :: View next topic
|
Author |
Message |
jackal Currently Banned New User
Joined: 21 Jan 2006 Posts: 48 Location: india
|
|
|
|
Can I move an element (having pic comp5 which is just comp) to another element that is comp-3? |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
Did you make a try?What was the result? |
|
Back to top |
|
|
jackal Currently Banned New User
Joined: 21 Jan 2006 Posts: 48 Location: india
|
|
|
|
Hi,
I did compile the program successfully but i dont know whether it will work during run time that i cannot check because application can be run by client only. |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
The move from COMP to COMP-3 is valid provided the variables are of same size.
Please provide the piece of code fordeclaration and move so that we could help you more. |
|
Back to top |
|
|
jackal Currently Banned New User
Joined: 21 Jan 2006 Posts: 48 Location: india
|
|
|
|
01 AT1 PIC S9(00004) COMP.
01 AT2 PIC S9(00012)V9(06) COMP-3 .
Move At1
To At2 |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
A numeric move works just fine, from four digits to larger works just fine..... |
|
Back to top |
|
|
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
jackal,
Quote: |
Can I move an element (having pic comp5 which is just comp) to another element that is comp-3? |
PIC 9(1) COMP-5 can accomodate numeric values from 0 to 65535.
PIC 9(1) COMP-3 can accomodate numeric values from 0 to 9.
suppose if PIC 9(1) COMP-5 contain the value 65535 and is moved to PIC 9(1) COMP-3, the result from PIC 9(1) COMP-3 will be 5 and 6553 will get truncated.
Example code:
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. COMP5.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-A PIC 9(1) COMP-5 VALUE ZERO.
77 WS-B PIC 9(1) COMP-3 VALUE ZERO.
PROCEDURE DIVISION.
DISPLAY 'WS-A ' WS-A ' ==> INITIAL VALUE'
DISPLAY 'WS-B ' WS-B ' ==> INITIAL VALUE'
PERFORM 65535 TIMES
COMPUTE WS-A = WS-A + 1
END-PERFORM
DISPLAY 'WS-A ' WS-A ' ==> COMPUTED VALUE'
MOVE WS-A TO WS-B
DISPLAY 'WS-B ' WS-B ' ==> MOVED VALUE'
GOBACK. |
Output:
Code: |
WS-A 00000 ==> INITIAL VALUE
WS-B 0 ==> INITIAL VALUE
WS-A 65535 ==> COMPUTED VALUE
WS-B 5 ==> MOVED VALUE |
Please post the working-storage declaration for PIC COMP-5 variable. So that it will be easy to suggest you how to declare PIC COMP-3 variable which will get the input value(s) from PIC COMP-5 variable. |
|
Back to top |
|
|
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
jackal,
Quote: |
Can I move an element (having pic comp5 which is just comp) to another element that is comp-3? |
Quote: |
01 AT1 PIC S9(00004) COMP.
01 AT2 PIC S9(00012)V9(06) COMP-3 .
Move At1
To At2 |
In your first post you mentioned COMP-5 and in the latest post you mentioned as COMP.
Suppose if you are moving COMP-5 to COMP-3, use appropriate PIC 9(x)V9(y) COMP-3. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I did compile the program successfully but i dont know whether it will work during run time that i cannot check because application can be run by client only. |
I suggest you test this (and any other code about which you are unsure) in a test program of your own. This program would have no business-rules logic. It would be only for testing. |
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
Jackal,
You said: i cannot check because application can be run by client only.
Ouch... This is not an acceptable situation to be in. Programmers must be able to test their code. This is a basic requirement. I suspect you know this already yet somehow managed to find yourself in a crazy situation that prevents you from testing your code.
Do not stay in this situation. Change the situation so that you can test what you code. If you can't change the situation, then perhaps transfer to an area that does permit their programmers to test their own code...
As well, the question you asked can be answered by making a test program. You don't have to use a production program to test this out. I have hundreds of test programs hanging around that I use to test things out.
But like I said, you need to be able to test your own code. |
|
Back to top |
|
|
|