View previous topic :: View next topic
|
Author |
Message |
sakthi_ksv
New User
Joined: 20 Jul 2006 Posts: 48 Location: Chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please post some sample data and what the output should look like. |
|
Back to top |
|
|
sakthi_ksv
New User
Joined: 20 Jul 2006 Posts: 48 Location: Chennai
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
puzzled_elton
New User
Joined: 09 May 2005 Posts: 7
|
|
|
|
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 |
|
|
rajesh_mbt
New User
Joined: 27 Mar 2006 Posts: 97 Location: India
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Rajesh,
One suggestion - while posting code, make sure you provide error free code. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
|