IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to eliminate dots in the middle of the string?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Fri Oct 19, 2007 12:39 pm
Reply with quote

HI,

How to remove dots from the string in a file. My file wont have fields differentiation ie not copybook.

I have to remove all the dots in data.


If the data in the file is S.A.S Then the dots should be removed and the output file should contian SAS.

How can I achieve this, how can we do that with INSPECT??

Please help me in this regard.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Oct 19, 2007 12:43 pm
Reply with quote

Hello,

Please post some sample data and what the output should look like.
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Fri Oct 19, 2007 1:22 pm
Reply with quote

IP

S.A.S
S.A.S.L
S.D.R

OP:
SAS
SASL
SDR

This is my Req. can i achieve this through sort or can i go with (INSPECT). Kindly suggest.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Oct 19, 2007 1:46 pm
Reply with quote

Sakthi,

Quote:
This is my Req. can i achieve this through sort


Yes, you can use DFSORT's SQZ function for your requirement. Refer to the DFSORT forum/ manuals for the syntax.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Oct 19, 2007 1:48 pm
Reply with quote

Sakthi,

Use this if you have DFSORT installed in your site.

Code:
OPTION COPY
INREC OVERLAY=(1,10,SQZ=(SHIFT=LEFT,PREBLANK=C'.'))
Back to top
View user's profile Send private message
puzzled_elton

New User


Joined: 09 May 2005
Posts: 7

PostPosted: Fri Oct 19, 2007 2:32 pm
Reply with quote

Hi,
You can use reference modification method to eliminate dots.
pls refer manuals for exact syntax.
1. take the length of the string from which you want to remove dots.(lengt function)
2.use a do loop,reference modification.for each iteration sore non-dot value in temp variable and go on concatinating.
Back to top
View user's profile Send private message
rajesh_mbt

New User


Joined: 27 Mar 2006
Posts: 97
Location: India

PostPosted: Fri Oct 19, 2007 4:01 pm
Reply with quote

Code:


01 WS-VALID-CHAR                         PIC X(01)
01 WS-SUB                                      PIC 9(04) COMP.
01 WS-SUB1                                    PIC 9(04) COMP.

PERFORM WS-SUB VARRYING FROM 1 BY 1 UNTIL END-OF-REC OR WS-SUB > 20
                                                                         

  IF WS-INPUT-REC(WS-SUB:1) NOT  '.'
   
      WS-INPUT-REC(WS-SUB:1)       TO WS-VALID-CHAR
      MOVE WS-VALID-CHAR            TO WS-OUTPUT-REC(WS-SUB1:1)
      ADD 1                                     TO WS-SUB1

  ELSE
      CONTINUE
  END-F

END-PERFORM




Let us know if it works
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Oct 19, 2007 4:10 pm
Reply with quote

Rajesh,

One suggestion - while posting code, make sure you provide error free code.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Oct 19, 2007 7:29 pm
Reply with quote

Hello,

If you are going to use some coding method of removing the dots, i'd suggest that before you start building the output area, you move spaces to the entire output area to be built.

Otherwise, there may be leftover characters from a previous, longer field icon_smile.gif

Quote:
Let us know if it works
When posting code, it is a good idea to post tested code that is already known to work. . . .
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Oct 23, 2007 3:42 pm
Reply with quote

Hi !

In a Cobol-Pgm you could achieve this by using STRING/UNSTRING with
DELIMITED BY '.' and POINTER.

Have a look at the Syntax of this commands.

Regards, UmeySan
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts Search string in job at regular Spool... CLIST & REXX 0
Search our Forums:

Back to Top