View previous topic :: View next topic
|
Author |
Message |
udays51
New User
Joined: 21 Oct 2008 Posts: 2 Location: mumbai
|
|
|
|
Hi all,
Can anyone let me know is there any way to increment Character value.
For example If i want a value say B0 which should come after A9. Is there any way other than using working storage variables or hard coding these values in the program |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Define an array of the values you want and iterate over the array. And you're going to have to use WORKING-STORAGE items most likely, and may have to hard-code the values.
And what do B0 and A9 represent, anyway? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If these values are 01-Byte HEX, then the next value after X'A9' is X'AA'.
To increment these values, define a PIC 9(08) BINARY field and then redefine it as PIC X(04), clear the BINARY field to ZERO then move the 01-Byte HEX value to the 4th-Byte of the PIC X(04) redefined BINARY field. Then, ADD 1 to the BINARY field and you've just increment your HEX value by one.
Is this what you want to do?
Bill |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Uday and welcome to the forum,
What should come after Z9? Should the result value be something a user could enter/read or is it for internal use only?
If you explain your requirement in more detail, we can probably make better suggestions. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Dick,
I believe IBM's got you on the Z9, it's a Z10
Bill |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Oh, pshaw. . .
I wasn't thinking of a hardware solution. . .
d |
|
Back to top |
|
|
udays51
New User
Joined: 21 Oct 2008 Posts: 2 Location: mumbai
|
|
|
|
Thnaks,
the problem solved by using tables i rid it |
|
Back to top |
|
|
|