Would there ever be two fields with numbers, so that there's an issue 
about which to use?

In any event, follows is a piece that extracts only certain characters 
from "FIELD" and places them in field "FLD004".  The characters to be 
extracted are in the array "OK".   The program is not in RPGIV but may be 
useful anyway as a thought-tool.

Rick, the program itself, with a screen shot,  is at 


The lines of code that I used are:

The RPG code: 

     E                    CF         30  1
     E                    CT         30  1
     E                    OK         70  1
     I              'ABCDEFGHIJKLMNOPQRST-C         NCOK
     I              'UVWXYZabcdefghijklmn-
     I              'opqrstuvwxyz'
     C*  ..................................................
     C* Accept only the characters appearing in array OK:
     C                     MOVE *BLANKS   CF
     C                     MOVE *BLANKS   CT
     C                     SORTAOK
     C* I is the column # of the field we are checking;
     C* J is the column # of the field to which we are writing:
     C                     Z-ADD1         I       20
     C                     Z-ADD1         J       20
     C                     MOVEAFIELD     CT
     C* The array CT is 30 columns long; we need to check all 30 columns.
     C                     DO   30
     C           CT,I      LOKUPOK                       61 
     C* 61 = The character is in the array:
     C           *IN61     IFEQ *ON
     C* Move the character into the next available
     C* column of the array CF, and increment CF's counter.
     C                     MOVE CT,I      CF,J
     C                     ADD  1         J
     C                     END
     C* Now, get the next column's character to process:
     C                     ADD  1         I
     C                     END
     C* _____________________________________________________________
     C* The array CF now holds the new field as we want it, so we are
     C* moving the new field back into the original field to display it.
     C                     MOVE *BLANKS   FLD004
     C                     MOVEACF        FLD004
     C                     END
     C                     END
     C                     ENDSR
      * ::::::::::::::::::::::::::::::::::::::::::::::::::::
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com

This thread ...

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

This mailing list archive is Copyright 1997-2020 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].