View previous topic :: View next topic
|
Author |
Message |
shyamjar
New User
Joined: 17 Mar 2005 Posts: 3
|
|
|
|
I am working on a Cobal program. please help me.
1.Each time it checks for a key ex:123456 and if its status is 'Z' for the corresponding key it generates a 6 byte char like A00001.
2.My problem is how to write a program such that when this generated number reaches max i.e A99999 it shud be incremented to B00001, and when B99999 it shud be incremented to C00001 so forth.
Can any one please give me the pseudo code or help me. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
what will happen when You get to Z99999 ?? |
|
Back to top |
|
|
shyamjar
New User
Joined: 17 Mar 2005 Posts: 3
|
|
|
|
I dont have that much data may be it may reach a max of L99999. Please help me. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
you can split that gen number as
Code: |
01 gennum.
02 alphanumchar pic x.
02 gennumint 99999.
if gennumint = 99999 then
move function char( ( function ord(alphanumchar)) + 1 ) to alphanumchar
move 00001 to gennumint
end-if.
|
|
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
I did something very similar to this years ago, but I added the restriction of not using the letters I and O since they could be mistaken for the numbers 1 and 0. I used the other 24 letters of the alphabet. When I reached 99999, I searched a 24 occurrence internal table to locate the current letter of the alphabet. When I found it, I incremented the index by 1, used that occurrence as the leading character of the 6 byte key, and set the new 5 character number to 00000. Hope that helps. |
|
Back to top |
|
|
|