Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Generating sequence number

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Generating sequence number
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10457
Location: italy

PostPosted: Thu Sep 25, 2008 12:09 pm    Post subject: Reply to: Generating sequence number
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    Post subject: Reply to: Generating sequence number
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Repeat Sequence Number Until change i... rahulabvp DFSORT/ICETOOL 6 Thu Mar 29, 2018 12:51 pm
No new posts Detect break in the sequence tuxama DFSORT/ICETOOL 6 Tue Mar 20, 2018 1:35 pm
No new posts add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm
No new posts PARSE GDG name to separate generation... Abid Hasan SYNCSORT 2 Sun Feb 11, 2018 3:40 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us