Identify numeric or alphanumeric or alphabetic series



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Identify numeric or alphanumeric or alphabetic series

Postby nikesh_rai » Thu Jan 17, 2013 5:21 pm

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.
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Identify numeric or alphanumeric or alphabetic series

Postby BillyBoyo » Thu Jan 17, 2013 5:42 pm

Please give a representative example of input data and expected output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Identify numeric or alphanumeric or alphabetic series

Postby nikesh_rai » Thu Jan 17, 2013 5:54 pm

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
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Identify numeric or alphanumeric or alphabetic series

Postby enrico-sorichetti » Thu Jan 17, 2013 6:04 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Identify numeric or alphanumeric or alphabetic series

Postby nikesh_rai » Thu Jan 17, 2013 6:14 pm

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 )
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Identify numeric or alphanumeric or alphabetic series

Postby BillyBoyo » Thu Jan 17, 2013 6:21 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Identify numeric or alphanumeric or alphabetic series

Postby nikesh_rai » Thu Jan 17, 2013 6:37 pm

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..
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Identify numeric or alphanumeric or alphabetic series

Postby BillyBoyo » Thu Jan 17, 2013 6:54 pm

Have a look at FINDREP. Specify 11 first, else you'll get AAAA for 11 if you specify 1 first.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post