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
 
Need to remove First special charecter in the string

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

New User


Joined: 10 Jun 2005
Posts: 21
Location: Mumbai

PostPosted: Mon Jul 11, 2011 12:10 pm    Post subject: Need to remove First special charecter in the string
Reply with quote

HI,

Having requirement, If very first charecter in the string is any of the special charecter then It needs to be replaced by alphabet. Is there any shortest way to do this? Like any cobol function is available to check the values of special charecter
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Jul 11, 2011 12:32 pm    Post subject:
Reply with quote

Your requirement is about as clear as mud.

Please specify exactly what it is that you want to do, specify special characters, which letter of the alphabet replaces which special character, are there any exceptions to the rule.

DSORG, RECFM and LRECL of input file.

Not too much to ask is it.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jul 11, 2011 1:03 pm    Post subject:
Reply with quote

Also give us some sample input and sample output...
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2442
Location: Netherlands, Amstelveen

PostPosted: Mon Jul 11, 2011 1:07 pm    Post subject:
Reply with quote

And last but not least, what did you try yourself?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Jul 11, 2011 1:22 pm    Post subject: Re: Need to remove First special charecter in the string wit
Reply with quote

SHAILESH OZA wrote:
Having requirement, If very first charecter in the string is any of the special charecter then It needs to be replaced by alphabet. Is there any shortest way to do this? Like any cobol function is available to check the values of special charecter
There is no such intrinsic function in COBOL. How would COBOL, for your given application, understand that what is "special character"?

For COBOL, you need to define some working-storage variable to list your special character-set, then there you go.

This earlier thread also have a hint: http://ibmmainframes.com/viewtopic.php?t=49281&highlight= , there are some more threads in the forum on similar topic. Please search.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Jul 11, 2011 3:47 pm    Post subject:
Reply with quote

Code:
05  W-STRINGY-THING.
    10  W-ST-FIRST-BYTE PIC X.
        88  W-ST-FIRST-BYTE-TO-BE-REPLACED VALUE "<", "@", etc.
    10  FILLER PIC X(??).


IF W-ST-FIRST-BYTE-TO-BE-REPLACED
    MOVE whatever-you-decide TO W-ST-FIRST-BYTE
END-IF
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Tue Jul 12, 2011 7:37 am    Post subject: Reply to: Need to remove First special charecter in the stri
Reply with quote

Try INSPECT TALLYING -

Code:

MOVE ZERO TO TALLY.

INSPECT WS-STRING TALLYING TALLY FOR CHARACTERS BEFORE INITIAL 'SPECIAL CHARACTER'.

MOVE 'REPLACEMENT CHARACTER' TO WS-STRING (TALLY + 1:1).

WS-STRING is the made up field.

To make things easier, the 'SPECIAL CHARACTER' should be coded in hex-notation, so there's no question of intent.

I can't recall (CRS, ya know) if the REFERENCE MODIFICATION uses TALLY or TALLY + 1 to get to the target offset, so you'll need to fool with it or another member can verify.

Bill
Back to top
View user's profile Send private message
SHAILESH OZA

New User


Joined: 10 Jun 2005
Posts: 21
Location: Mumbai

PostPosted: Tue Jul 12, 2011 2:47 pm    Post subject:
Reply with quote

Well, i applied the below logic

i am getting input from cics screen.

I declare variable WS-FIRST CHAR to store the first charecter of the name. on the 88 LEVEL OF THE VARIABLE, GIVEN THE VALUES OF SPEICAL CHARECTERS LIKE QUOTE, @ # THEN CHECKING THIS IN IF CLAUSE AND IF 88 LEVEL IS TRUE THEN MOVING ALPHABET IN THAT THAT IS WHAT IS WHAT THE SOLUTION I HAVE PROVIDED FOR MY REQUIREMENT
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 Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

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