View previous topic :: View next topic
|
Author |
Message |
sivaprasad.gadhi
New User
Joined: 21 Aug 2012 Posts: 17 Location: india
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
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 |
|
|
sivaprasad.gadhi
New User
Joined: 21 Aug 2012 Posts: 17 Location: india
|
|
|
|
Data is present in sequential file and we do not use DB2. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
you mean sequential dataset |
|
Back to top |
|
|
sivaprasad.gadhi
New User
Joined: 21 Aug 2012 Posts: 17 Location: india
|
|
|
|
Yes input is in Sequential dataset and is of length 80 bytes |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Meanwhile, you could quickly write a program instead and get this done. |
|
Back to top |
|
|
sivaprasad.gadhi
New User
Joined: 21 Aug 2012 Posts: 17 Location: india
|
|
|
|
Can you please suggest pseudocode for program to achieve the above functionality? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
See if this gives you some clues. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
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 |
|
|
|