× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You can call the following routine/add it to your program to do the required
conversion
This guy accepts a string of 50(You may change the length) alphanumerics and
replaces the first occurence of numeric character by '*'.
Hope its helpful.
Sachin Kumar Gupta
CSC
HalthCare Group
Birmingham-AL

IDENTIFICATION DIVISION.
PROGRAM-ID. RPLC.
AUTHOR. SACHIN.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-AS400.
OBJECT-COMPUTER. IBM-AS400.
INPUT-OUTPUT SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-LENGTH           PIC 99 VALUE 50.
01 WS-COUNTER          PIC 99.
01 WS-TEST             PIC X.
01 REPLACEMENT-FLAG            PIC 1     VALUE B"0".
   88  REPLACED-NO                       VALUE B"0".
   88  REPLACED-YES                      VALUE B"1".
LINKAGE SECTION.
01 LK-STRING           PIC X(50).
PROCEDURE DIVISION USING LK-STRING.
SET REPLACED-NO TO TRUE.
PERFORM VARYING WS-COUNTER FROM 1 BY 1 UNTIL
   ((WS-COUNTER > WS-LENGTH) OR REPLACED-YES )
    MOVE  LK-STRING(WS-COUNTER:1) TO WS-TEST
    IF WS-TEST IS NUMERIC
       MOVE "*" TO LK-STRING(WS-COUNTER:1)
       SET REPLACED-YES TO TRUE
    END-IF
END-PERFORM.
GOBACK.
----- Original Message -----
From: <geir.kildal@entragroup.com>
To: <COBOL400-L@midrange.com>
Sent: Wednesday, August 21, 2002 5:17 AM
Subject: Inspect vs numeric testing.


> This is a multipart message in MIME format.
> --
> [ Picked text/plain from multipart/alternative ]
> Hello all.
>
> I'm wondering if there is a possibility  to get first non-numeric
character in a string replaced by f. eks. '*'?  I have checked the
> INSPECT-statement without finding a solution.
>
> MYSTRING              PIC  X(10).
>
> The contents of MYSTRING will vary, but I know that the first positions
> can be numeric, but I don't know how many.  It's the numeric part I'm
> interested in bringing further...
>  So I can't  just do STRING MYSTRING DELIMITED BY 'someting' INTO
> something, neither can I use MOVE MYSTRING(m:n) to someting.
>
> Any ideas?
>
>
>
> Mvh.
>
> Geir Kildal
>
>
> _______________________________________________
> This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
> To post a message email: COBOL400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l
> or email: COBOL400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/cobol400-l.
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.