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

alphanumeric sequence generation


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sivaprasad.gadhi

New User


Joined: 21 Aug 2012
Posts: 17
Location: india

PostPosted: Mon Mar 21, 2016 1:09 am
Reply with quote

I have the following requirement.Can you please help.

NOW sequence number is 10-12 ( 3 bytes) - 10TH BITE IS alphabetic and 11-12 are numeric and control break is on field starting from character 5 and length of 5.whenever control break changes sequence number starts again from beginning. In new requirement they want to make this sequence number as alphanumeric and increment and new sequence start from BAA instead of AAA( A sequence is using for some other purpose). New sequence should be like BAA,BAB,BAC.....BAZ,BBA,BBB,..BZZ,...BA1,BA2,BA3...etc

Input file:

Code:
704812345B01 XXXXXXXXXXXXXXXXXX
704812345B02 XXXXXXXXXXXXXXXXXX
704812345B03 XXXXXXXXXXXXXXXXXX
.
,
.
.
704812345B98 XXXXXXXXXXXXXXXXXX
704812345B99 XXXXXXXXXXXXXXXXXX
704812345C01 XXXXXXXXXXXXXXXXXX
704812345C03 XXXXXXXXXXXXXXXXXX
 
704856789B01 XXXXXXXXXXXXXXXXXX
704856789B02 XXXXXXXXXXXXXXXXXX
.
.
.
704856789B98 XXXXXXXXXXXXXXXXXX
704856789B99 XXXXXXXXXXXXXXXXXX
704856789C01 XXXXXXXXXXXXXXXXXX
704856789C03 XXXXXXXXXXXXXXXXXX
 

OUTPUT ( As part of bussiness requirement sequence number is making alphanumeric and should start from BAA:

Code:
704812345BAA XXXXXXXXXXXXXXXXXX
704812345BAB XXXXXXXXXXXXXXXXXX
704812345BAC XXXXXXXXXXXXXXXXXX
.
,
.
.
704812345BAZ XXXXXXXXXXXXXXXXXX
704812345BBA XXXXXXXXXXXXXXXXXX
704812345BBB XXXXXXXXXXXXXXXXXX
704812345BBC XXXXXXXXXXXXXXXXXX
 
704856789BAA XXXXXXXXXXXXXXXXXX
704856789BAB XXXXXXXXXXXXXXXXXX
.
.
.
704856789BAZ XXXXXXXXXXXXXXXXXX
704856789BBA XXXXXXXXXXXXXXXXXX
704856789BBB XXXXXXXXXXXXXXXXXX
704856789BBC XXXXXXXXXXXXXXXXXX
 

I have looked in to DFSORT sequence generation and using control break but i have not seen option of alphanumeric sequence generation.This is one time conversion of file.Is it possible with DFSORT or syncsort? if not how can i achieve this using cobol?

Thanks for your help

Regards
siva
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Mar 21, 2016 10:25 pm
Reply with quote

I am not sure about dfsort but it is more like a logical concern to achieve.

Try this approach with DB2 functions (if you have access/installed) for generating the unique combinations:
Code:
 select  'A' || CHR(ASCII('A')+1)from sysibm.sysdummy1


perform this in loop till 26 times then change 'A' to 'B' and perform the above query 26 tmes and so on till you get 'ZZ'.
Once you reach 'ZZ" then perform below loop till Z99 with the same logic as above
Code:
  select  strip('A' || char(0 + 1)) from sysibm.sysdummy1
Back to top
View user's profile Send private message
sivaprasad.gadhi

New User


Joined: 21 Aug 2012
Posts: 17
Location: india

PostPosted: Tue Mar 22, 2016 4:56 am
Reply with quote

Data is present in sequential file and we do not use DB2.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Mar 22, 2016 4:51 pm
Reply with quote

Quote:
sequential file

you mean sequential dataset
Back to top
View user's profile Send private message
sivaprasad.gadhi

New User


Joined: 21 Aug 2012
Posts: 17
Location: india

PostPosted: Tue Mar 22, 2016 8:00 pm
Reply with quote

Yes input is in Sequential dataset and is of length 80 bytes
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Mar 24, 2016 1:36 am
Reply with quote

Meanwhile, you could quickly write a program instead and get this done.
Back to top
View user's profile Send private message
sivaprasad.gadhi

New User


Joined: 21 Aug 2012
Posts: 17
Location: india

PostPosted: Thu Mar 24, 2016 2:51 am
Reply with quote

Can you please suggest pseudocode for program to achieve the above functionality?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Mar 24, 2016 5:53 am
Reply with quote

See if this gives you some clues.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Mar 24, 2016 9:06 pm
Reply with quote

If this is one time then why don't you hardcode in dfsort?
For e.g. 01 -->AA, 02-->AB, 03-->AC and so on....till 99. and write those many IFTHEN sentences and use overlay to replace 01 with AA and so on by grouping them. I think that is the easiest way to replace the ranges
Quote:
Can you please suggest pseudocode for program to achieve the above functionality?

refer here
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts DFHPI1008 JSON generation failed COBOL Programming 0
No new posts Cobol program with sequence number ra... COBOL Programming 5
No new posts Started task using a generation dataset JCL & VSAM 7
No new posts Report generation JCL & VSAM 18
No new posts How can I get Generation Nbr of GDG f... IBM Tools 1
Search our Forums:

Back to Top