Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 10232
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 what is meaning of the number in dcl Martylin PL/I & Assembler 2 Thu Mar 09, 2017 7:18 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts GDG version number PANDU1 JCL & VSAM 4 Sat Mar 04, 2017 8:28 pm
No new posts Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us