I'm trying to correct a specific customer type in our database from a character customer type of "05" to a character customer type of "09". I need to iterate through the database and find a customer name of ex."Gas Station 123" and then change the customer type to a '09' for each record found. The problem I keep having is how to find a partial string in the customer name for each record. Any help would be appreciated.
`
Dcl-F CUSTMST Keyed Usage(*INPUT:*OUTPUT:*UPDATE);
Dcl-S CUSTNM Uns(10);
SETLL 80000 Custmst;
READ CUSTMST;
DoW not %EoF(CUSTMST);
If CUSTNM = %CHECK('GAS STATION 123':BL2LN1);
CSTYP = %REPLACE('09':'05');
ENDIF;
UPDATE CUSTREC;
READ CUSTMST;
ENDDO;
Return;
`
I've tried %scan and %check but get "Operands are not compatible with the type of operator." I can assign an uns variable to the function which gets rid of the error but then doesn't find anything. I've looked for any kind of wildcard function that would allow partial string searches but haven't had any success.
The function to search for partial string is %scan
%SCAN(search argument : source string {: start position {: length}})
In your code :
If %scan('GAS STATION 123':BL2LN1) > 0;
Note :Your use of %replace is strange, why don't you assign directly CSTYP = '09'?