- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: sting manipulation
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2006 05:19 PM
10-02-2006 05:19 PM
sting manipulation
I have a alphanumeric variable say x(200) which contains a string with spaces in between. Can someone help me how to remove the spaces in the string in cobol.
Thanks,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2006 05:58 PM
10-02-2006 05:58 PM
Re: sting manipulation
PERFORM UNTIL I = 200
IF X(I) = SPACE
THEN
MOVE X(I+1:200 - I)
TO X(I:200 - I + 1)
END-IF
ADD 1 TO I
END-PERFORM
Or use system calls.
Hope it's correct because not used COBOL in 10 years.
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2006 07:27 PM
10-02-2006 07:27 PM
Re: sting manipulation
PERFORM ... VARYING I BY 1 UNTIL 200
...but I haven't used COBOL in 30 years!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2006 07:30 PM
10-02-2006 07:30 PM
Re: sting manipulation
PERFORM ... VARYING I FROM 1 TO 200 BY 1
anyhow, there are also a few full stops (aka periods) missing from the example!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2006 07:43 PM
10-02-2006 07:43 PM
Re: sting manipulation
http://h71000.www7.hp.com/doc/82final/6297/6297pro_031.html#string_unstring_insp_chap
Phil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2006 08:18 PM
10-02-2006 08:18 PM
Re: sting manipulation
STRING ? INSPECT could do it but it replaces characters by characters of equal length. So, no go.
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2006 08:34 PM
10-02-2006 08:34 PM
Re: sting manipulation
I would use STRING
with a DELIMITED BY value and a POINTER
Phil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2006 01:57 AM
10-03-2006 01:57 AM
Re: sting manipulation
Example:
IDENTIFICATION DIVISION.
PROGRAM-ID. BENCH_MOVTC.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-SOURCE-NAME PIC X(55).
77 WS-DEST-NAME PIC X(55).
01 EDIT_VAL_COMP PIC 9(9) USAGE COMP.
01 EDIT_VAL_TEXT PIC 9(3) USAGE DISPLAY.
PROCEDURE DIVISION.
PGM-BEGIN.
DISPLAY "Edit: " NO ADVANCING.
ACCEPT EDIT_VAL_TEXT.
MOVE EDIT_VAL_TEXT TO EDIT_VAL_COMP.
DISPLAY "Name: " NO ADVANCING
ACCEPT WS-SOURCE-NAME
CALL 'DBASIC$EDIT' USING BY DESCRIPTOR WS-DEST-NAME, WS-SOURCE-NAME,
BY VALUE EDIT_VAL_COMP.
Display ws-dest-name.
stop run.
Edit functions available:
$ HELP/LIBRARY=BASICHELP edit% synt
EDIT$
Syntax
str-var = EDIT$(str-exp, int-exp)
Values Effect
1% Trim parity bits
2% Discard all spaces and tabs
4% Discard characters: CR, LF, FF, ESC, RUBOUT, and NULL
8% Discard leading spaces and tabs
16% Reduce spaces and tabs to one space
32% Convert lowercase to uppercase
64% Convert [ to ( and ] to )
128% Discard trailing spaces and tabs
256% Do not alter characters inside quotes
Enjoy!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2006 06:57 PM
10-04-2006 06:57 PM
Re: sting manipulation
Thank you very much for all your help and valuable suggestions which made my job easy.
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 05:59 AM
10-05-2006 05:59 AM
Re: sting manipulation
perhaps you could read
http://forums1.itrc.hp.com/service/forums/helptips.do?#33
to find out hpw to express your thanks.
(and zero points for this please)
Proost.
Have one on me.
jpe