Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to eliminate dots in the middle of the string?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to eliminate dots in the middle of the string?
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

Site Director


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

PostPosted: Fri Oct 19, 2007 12:43 pm    Post subject:
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    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Fri Oct 19, 2007 1:46 pm    Post subject: Reply to: How to eliminate dots in the middle of the string?
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: 1288
Location: Chennai, India

PostPosted: Fri Oct 19, 2007 1:48 pm    Post subject: Reply to: How to eliminate dots in the middle of the string?
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    Post subject: Reply to: How to eliminate dots in the middle of the string?
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: 95
Location: India

PostPosted: Fri Oct 19, 2007 4:01 pm    Post subject: Reply to: How to eliminate dots in the middle of the string?
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: 1439
Location: Bangalore,India

PostPosted: Fri Oct 19, 2007 4:10 pm    Post subject:
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

Site Director


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

PostPosted: Fri Oct 19, 2007 7:29 pm    Post subject:
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: 757
Location: Germany

PostPosted: Tue Oct 23, 2007 3:42 pm    Post subject:
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    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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us