View previous topic :: View next topic
|
Author |
Message |
Tone
New User
Joined: 01 Oct 2008 Posts: 12 Location: India
|
|
|
|
Hi
I have 2 group variables one is TEST-VAR second one RESULT-KEY
Code: |
01 TEST-VAR.
05 TEST-A PIC S9(01) COMP-3.
05 TEST-B PIC S9(01) COMP-3.
05 TEST-C PIC S9(05) COMP-3.
05 TEST-D PIC S9(05) COMP-3.
01 RESULT-KEY.
05 RESULT-ROG PIC X(4).
05 RESULT-FACILITY PIC X(4).
05 RESULT-TESTABCD PIC S9(12) COMP-3. |
I would like to have the TEST-VAR as whole in RESULT-TESTABCD.
( concatenated TEST-A,TEST-B,TEST-C,TEST-D)
Is it possible to move the group variable to a fixed length one ?
How can we achieve this in minimum steps ?
Thanks |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Yes it is possible but it will be alphanumeric to numeric move.
What result are you expecting here, can you explain with an example? |
|
Back to top |
|
|
Tone
New User
Joined: 01 Oct 2008 Posts: 12 Location: India
|
|
|
|
one sample value is
TEST-A is 2
TEST-B is 5
TEST-C is 74536
TEST-D is 88123
I would like to have 257453688123 in RESULT-TESTABCD.
PS: I won't be able to changes the the above mentioned variable declarations, but i can define new ones to achieve this.
Thanks |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Tone wrote: |
TEST-A is 2
TEST-B is 5
TEST-C is 74536
TEST-D is 88123
I would like to have 257453688123 in RESULT-TESTABCD |
As I see it, what you really have in hex is:
TEST-A is 2C
TEST-B is 5C
TEST-C is 74536C
TEST-D is 88123C
And the results:
RESULT-ROG is 2C5C7453
RESULT-FACILITY is 6C88123C
RESULT-TESTABCD is 40404040404040
The sending field is eight bytes while the receiving field is fifteen bytes.
From your sample, just what do you want to see in the result fields? |
|
Back to top |
|
|
Tone
New User
Joined: 01 Oct 2008 Posts: 12 Location: India
|
|
|
|
For the sample mentioned,
Whether it is hex or not, I want equivalent of 257453688123 in RESULT-TESTABCD.
So that i can use in condition checks
eg: If CORRECT-KEY = RESULT-KEY ?
Thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Move the 4 TEST fields to 4 fields that are defined as unsigned zoned decimal:
Code: |
01 the-group.
05 t-a pic 9.
05 t-b pic 9
05 t-c pic 9(5).
05 t-d pic 9(5).
01 the-group-n redefines the-group pic 9(12). |
After the move, you should have what you want. |
|
Back to top |
|
|
Tone
New User
Joined: 01 Oct 2008 Posts: 12 Location: India
|
|
|
|
Thank you ! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - good luck
d |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Dick's solution is probably the best, but you could get what you desire into RESULT-TESTABCD by using the following untested code:
Code: |
COMPUTE RESULT-TESTABCD
= TEST-A * 100000000000
+ TEST-B * 10000000000
+ TEST-C * 100000
+ TEST-D
END-COMPUTE |
|
|
Back to top |
|
|
|