Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Mask unneccesary characters with *

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Mon Jul 13, 2009 11:38 am    Post subject: Mask unneccesary characters with *
Reply with quote

Hi All,

The requirement states to replace all unnecessary alphanumeric characters with * .

For Example
Code:
0123456789 Transaction Not Found shekhar1


This Should be converted to
Code:
********** Transaction Not Found ********


The issue is neither the length of such numeric characters is fixed nor is their position. It can be "Transaction Not Found ********"

Thanks in advance
Back to top
View user's profile Send private message

Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Mon Jul 13, 2009 11:40 am    Post subject: Reply to: Mask unneccesary characters with *
Reply with quote

How do you make the difference between the necessary and the unnecessary ??
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Mon Jul 13, 2009 11:45 am    Post subject:
Reply with quote

Hi Sudhanshu,

You have specified ur requirement. What is it that you want our help with ??
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Mon Jul 13, 2009 12:14 pm    Post subject: Reply to: Mask unneccesary characters with *
Reply with quote

Quote:
... neither the length of such numeric characters is fixed nor is their position...

the issue is that the gentleman is trying to discover what cannot be discovered icon_cool.gif
at least reading the quoted fragment - but, maybe as too often happens, he simply forgot to tell something
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Mon Jul 13, 2009 12:14 pm    Post subject:
Reply with quote

@ Marso
I need only "Trans not found" the rest of the characters have to be masked.

@binop

I need assistance on how i can mask the characters when the length and position is dynamic
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Mon Jul 13, 2009 12:18 pm    Post subject:
Reply with quote

@enrico ....

it might be my inability to present you with the exact request but the requirement is a lil fuzzy and i am still trying to figure it out.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Mon Jul 13, 2009 12:27 pm    Post subject: Reply to: Mask unneccesary characters with *
Reply with quote

still You are not telling much more

let' s see
You have a file with some lines/records where a string transaction not found is the trigger to do some processing
( the value of the string is not really an issue as long as it is unique in the file)

now in simple steps describe what You have to do...
for example
...
if the string is found substitute the first word after it with asterisks
-here word means a sequence of chars delimited by blanks

the ball is in Your court now for a better explanation of Your requirement
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Mon Jul 13, 2009 12:46 pm    Post subject:
Reply with quote

@enrico

yes u got it right.
There are some records where a string "Transaction Not Found" exits which will be used for some further trigger.

However the postion of the string "Transaction Not Found" is not fixed. It might be after the first word (delimited by space) or the second word or it can even be the first word itself. It also might have a few characters after the word " found".

I need to subtitute all characters except for the string "Transaction Not Found" by *.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Jul 13, 2009 7:57 pm    Post subject:
Reply with quote

Quote:
I need to subtitute all characters except for the string "Transaction Not Found" by *.


This code will do needful ..
Note multiple occurance of string to be found is not covered here..


Code:

       WORKING-STORAGE SECTION.                                   
       01 MYVAR1 PIC X(40) VALUE                                 
                     '0123456789 Transaction Not Found shekhar'. 
      *01 MYVAR1 PIC X(40) VALUE                                 
      *              'Transaction Not Found some data here    '. 
      *01 MYVAR1 PIC X(40) VALUE                                 
      *              'SOME DATA here     Transaction Not Found'. 
       01 MYVAR2  PIC X(40) VALUE ALL '*'.                       
       01 WS-I     PIC 99 VALUE 1.                               
       01 WS-STRFND-CNT PIC 99 VALUE 0.                           
       PROCEDURE DIVISION.                                       
       BEGIN.                                                   
           PERFORM PARA1 VARYING WS-I FROM 1 BY 1 UNTIL WS-I > 20
           IF WS-STRFND-CNT NOT = 0                             
              MOVE 'Transaction Not Found'                       
                         TO   MYVAR2(WS-STRFND-CNT:21)           
           END-IF                                               
           DISPLAY MYVAR1                                       
           DISPLAY MYVAR2                                       
           STOP RUN.                                             
       PARA1.                                                   
           IF MYVAR1(WS-I:21) = 'Transaction Not Found'         
              MOVE WS-I  TO  WS-STRFND-CNT                       
           ELSE                                                 
              CONTINUE                                           
           END-IF.                                               
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jul 13, 2009 8:26 pm    Post subject:
Reply with quote

Sudhanshu: Sambhaji didn't ask -- how long can the strings be? The solution posted only works for 40-character strings such as you had in your first post. Are the strings coming from a file or a terminal or ? And where are the masked results going -- to a file, a terminal, or ? Can you have multiple occurrences of the TRANSACTION NOT FOUND in a single string / record ?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Jul 13, 2009 8:52 pm    Post subject:
Reply with quote

Hello,

I suspect this:
Code:
MOVE 'Transaction Not Found' 
may need to be:
Code:
MOVE ' Transaction Not Found '
.

Also, there may be a requirement that "*" replace positions with a value (up to the trailing spaces) rather than replacing all positions with "*"?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts how to mask the phone number kumarinfy DB2 4 Mon Apr 03, 2017 5:23 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm
No new posts Remove Special Characters from Mainfr... Rodger Zhang All Other Mainframe Topics 6 Wed Jul 06, 2016 1:12 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us