IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Generating sequence number


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shyamjar

New User


Joined: 17 Mar 2005
Posts: 3

PostPosted: Thu Sep 25, 2008 12:06 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Sep 25, 2008 12:09 pm
Reply with quote

what will happen when You get to Z99999 ??
Back to top
View user's profile Send private message
shyamjar

New User


Joined: 17 Mar 2005
Posts: 3

PostPosted: Thu Sep 25, 2008 12:11 pm
Reply with quote

I dont have that much data may be it may reach a max of L99999. Please help me.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Sep 25, 2008 1:12 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Sep 29, 2008 1:40 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top