Page 1 of 1

Identify numeric or alphanumeric or alphabetic series

PostPosted: Thu Jan 17, 2013 5:21 pm
by nikesh_rai
Hi,

I have a small requirement, where i need to replace some values in a sequential file, if a numeric or alphanumeric or alphabetic value is identified.
e.g. if the file have numbers from 01 to 11 for a single record, the numbers will be replaced with 'AA' or if the file have numbers from 12 to 21, the numbers will be replaced by
'BB', or if the file have alphabets ranging from 'A' to 'G', the alphabets will be replaced with '001'

I know it can be achieved through syncsort using ifthen:

OUTFIL IFTHEN=(WHEN=(1,80,SS,EQ,C'01'),.....


but for every single value, I have to write a separate statement like this. Is there any other way to achieve this in more simpler way.. for this small requirement i don't want to use COBOL, and REXX is not allowed here.. so looking for solution in JCL only.

Re: Identify numeric or alphanumeric or alphabetic series

PostPosted: Thu Jan 17, 2013 5:42 pm
by BillyBoyo
Please give a representative example of input data and expected output.

Re: Identify numeric or alphanumeric or alphabetic series

PostPosted: Thu Jan 17, 2013 5:54 pm
by nikesh_rai
Thanks Billy..

this is the input value :

01ATTN33N001110000111  002210NIKFFF3


and the output will be :

0AAATTNAAAA00300AAAAAA0000AAAAAA  00AAAAAA0003002002001001001AA


where the replacement is being done as follows:
for numeric: for value from 1 to 11, values replaced with AA
for alphabet: for value from A to G, values replaced with 001, for value from H to L, values replaced with 002, for value from M to T, values replaced with 003

Re: Identify numeric or alphanumeric or alphabetic series

PostPosted: Thu Jan 17, 2013 6:04 pm
by enrico-sorichetti
a bit more complicated than it looks

You say values from 1 to 11

if true it means that it must be a two step <parsing>
sometimes substituing a single <char> 1-9
sometime substituting 2 10-11

and after the mangling

01A ==> 0AA001
and
011A == 0AA001


and they will be the same ...
is that what You want

it would be wiser to describe better the requirement


and ...

..... 002210N...
..... 00AAAAAA0003...

do not match the description ...

0 ==> 0
0 ==> 0
2 ==> AA
2 ==> AA

now what do You want

1 ==> AA
0 ==> 0

or

10 ==> AA

N ==> 003

the data does not match the 1 to 11 description

Re: Identify numeric or alphanumeric or alphabetic series

PostPosted: Thu Jan 17, 2013 6:14 pm
by nikesh_rai
Thanks Enrico,

In case of double digit number in input file.. the format will be as follows:

0011BBCA068 11 AA3002001 23


and the output will be:

00AAAA0010010010010AAAA AA 001001AA00AA00AA CC


In other word, the double digit number will identified using single space after and before( that's y I am also looking for alphanumeric )

Re: Identify numeric or alphanumeric or alphabetic series

PostPosted: Thu Jan 17, 2013 6:21 pm
by BillyBoyo
I'm not sure this is a "small requirement".

You are translating some "source" value to a "new value" where the "new value" can match a later "source value".

As an example, open a random document in your word processor. Change all "a" to "b". Change all "b" to "c". Is that the result you want? As enrico pointed out, when you look at the "c"s now, you'll have no idea what it was originally.

You are also changing lengths.

You also have a "clash" of source values. "1" exists as "1" and also part of "21", for example.

Unless the intention is to scramble the data beyond use, you have quite a "complex requirement" and it is not even fully defined yet.

Re: Identify numeric or alphanumeric or alphabetic series

PostPosted: Thu Jan 17, 2013 6:37 pm
by nikesh_rai
Thanks Billy,

Just leave behind the requeirment.. :)
If you can suggest me how to check for numbers ranging from 1 to 11 and replace it with 'AA'.. will serve my purpose by 75%.. rest of the part is logical and functional and I will manage it according to design and requirment.

I know COBOL have this facility with 'THROUGH' verb.. is there anything similar to like this...or some better approach..

Re: Identify numeric or alphanumeric or alphabetic series

PostPosted: Thu Jan 17, 2013 6:54 pm
by BillyBoyo
Have a look at FINDREP. Specify 11 first, else you'll get AAAA for 11 if you specify 1 first.