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

How to use ALPHANUMERIC as SEQUENTIAL CODE


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

New User


Joined: 03 Apr 2007
Posts: 1
Location: philippines

PostPosted: Wed Apr 04, 2007 12:32 pm
Reply with quote

HI, PEOPLE!
COULD YOU HELP ME ON THIS ONE?....PLEASE..

GENERATE THE TRANSACTION NUMBER CODE THAT COMES AFTER THE LAST ERROR TRANSACTION NUMBER USED IN THE SAME RUN. THE NUMBER CODE SHOULD BE CONTINUOUS FOR EACH RUN. FOR EACH RUN, IT WILL START FROM '1-9' THEN 'A-Z' THEN GOES TO '0' WITH THE NEXT CHARACTER ON THE LEFT INCREMENTING BY 1. THEN THE CHARACTER ON THE RIGHT WILL START AGAIN FROM '1-9' THEN 'A-Z'.
THEN THE CHARACTER ON THE LEFT WILL INCREMENT BY 1 AND THE RIGHT CHARACTER WILL BECOME '0'.


EXAMPLE:

1-9, A-Z, 10-19, 1A-1Z,20-29,2A-2Z,......90-99,9A-9Z,A0-ZZ,100-109,10A-10A,110-119,11A-11Z,......190-199,19A-19Z,1A0-1A9....
1000-ZZZZ.

ASSUME THAT THE TRANSACTION NUMBER CODE WILL NOT EXCEED ZZZZ FOR EACH RUN.


THANKS!!!

Warning: All Caps
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Apr 04, 2007 1:02 pm
Reply with quote

This seems to be a very interesting question. I remember to solve similar one in my Engineering. icon_smile.gif
This sequence number comsists of 36 symbols. I will call mod 36 number system. ( I am calling it a number system because I perceive this similar similar note to hex - 16, decimal - 10 , octal -8)
I would take some freedom to make change in this NUMBER system as follows.
Quote:
0-9, A-Z, 10-19, .....

This will make our work easy.
Now,
0 in decimal is 0 in mod 36, 1 is 1 and 10 in decimal is A and similarly 35 in decimal is 'Z' in mod 36.
Getting some hint...?

Generate sequence number in decimal only and 'convert' it in to your mod 36 number.

This you can do by dividing decimal number by 36 ( method should be similar to decimal to hex conversion )


Example: 45 in decimal
45/36 = 1
9
So 45 decimal is 19( mod 36)

56 in decimal
56/36 = 1
20 (remainder) = J so 56 (mod 10 ) = 1J (mod 36)


If anyone has different/easier approach, I will eagerly wait for reply. icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 04, 2007 9:43 pm
Reply with quote

Hello,


Sounds good to me icon_smile.gif

As a possible continuation to the posted solution, you might make an array of 1-byte entries that contain the values zero thru zee (0-Z). When you divide by 36, use the remainder of the divide as a displacement into that array to quickly get your mod36 "units" position.
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 run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
No new posts Monitoring production job progress. N... JCL & VSAM 4
Search our Forums:

Back to Top