Compliments of the house ...
A couple of temp fields to do the work
TEMP T-WORK-TEXT CHAR*50
TEMP T-REMOVED INT*2
An internal procedure which removes anything less than a space. Set for 50 character fields in this case.
PROCEDURE INTERNAL STRIP-WEIRDIES
BEGIN
; strip out any weird characters
LET T-REMOVED = 0
LET T-WORK-TEXT = FIELDTEXT
FOR 50
IF " " GT T-WORK-TEXT[OCCURRENCE:1]
THEN BEGIN
LET T-WORK-TEXT &
= " " + T-WORK-TEXT[1:OCCURRENCE - 1] &
+ T-WORK-TEXT[OCCURRENCE + 1:50]
LET T-REMOVED = T-REMOVED + 1
END
IF T-REMOVED GT 0
THEN BEGIN
IF "" = T-WORK-TEXT[1:T-REMOVED]
THEN LET FIELDTEXT = T-WORK-TEXT[T-REMOVED + 1:50]
END
END
The internal procedure is used in this input procedure
PROCEDURE INPUT STK-DESC-F-1
BEGIN
IF 0 NE SIZE(FIELDTEXT)
THEN BEGIN
DO INTERNAL STRIP-WEIRDIES
LET FIELDTEXT = LJ(FIELDTEXT)
END
END
-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On Behalf Of James B. Byrne
Sent: Wednesday, June 14, 2017 3:35 PM
To: [log in to unmask]
Subject: [HP3000-L] Powerhouse 8.39 on MPE/iX
I have a request to alter a very old program and I find that my PH skills are not as they once were. I have a question respecting INPUT procedures and designer functions.
Is there a QDESIGN function to strip out unwanted characters from a string? I am looking for an effect similar to Ruby's String class gsub method. If not is there a procedural work around to achieve the same effect?
--
*** e-Mail is NOT a SECURE channel ***
Do NOT transmit sensitive data via e-Mail Do NOT open attachments nor follow links sent by e-Mail
James B. Byrne mailto:[log in to unmask]
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
________________________________
Email Disclaimer:
This message, including any attachments, may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. If you are not the intended recipient or have received this message in error, please notify the sender immediately by reply email and permanently delete the original transmission from the sender, including any attachments, without making a copy.
Avertissement:
Ce message, y compris tous fichiers joints, peut contenir des renseignements qui sont de nature privée, privilégiée et/ou confidentielle et vise exclusivement la(les) personne(s) à qui il est adressé. Si vous n’êtes pas le destinataire visé ou si vous avez reçu ce message par erreur, veuillez en aviser immédiatement l’expéditeur en répondant au courriel et supprimer de façon permanente la transmission originale de l’expéditeur, y compris tous fichiers joints, sans en avoir fait de copie.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|