String Delete (DELETE)

This information applies to the
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370,
GuardLogix
5570,
Compact GuardLogix
5380,
CompactLogix
5380,
CompactLogix
5480,
ControlLogix
5580, and
GuardLogix
5580 controllers.
The DELETE instruction removes ASCII characters from a string.
Available Languages
Ladder Diagram
Function Block
This instruction is not available in function block.
Structured Text
DELETE(Source,Qty,Start,Dest);
Operands
There are data conversion rules for mixed data types within an instruction. See Data conversions.
Ladder Diagram and Structured Text
Operand
Type
Format
Description
Notes
Source
ANY_STRING
tag
The tag that contains the string from which you want to delete characters
String types are:
default STRING data type with max 82 length of characters for the string.
any new string type you created with configurable length of characters for the string.
Quantity
SINT
INT
DINT
immediate
tag
The number of characters to delete
The Start plus the Quantity must be less than or equal to the length of the Source plus 1.
Start
SINT
INT
DINT
immediate
tag
The position of the first character to delete
Enter a number between 1 and the DATA size of the Source.
Destination
String type
tag
The tag to store the result
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Description
The DELETE instruction deletes (removes) one or more characters from the Source and places the remaining characters in the Destination.
  • The Start position and Quantity define the characters to remove.
  • Unless Source A and the Destination are the same tag, Source A remains unchanged.
Affects Math Status Flags
No
Major/Minor Faults
A minor fault will occur if:
Fault Type
Fault Code
The LEN value of the Source string tag is greater than the DATA size of the Source string tag.
4
51
The length of output string is larger than the DATA size of the destination string tag.
4
52
The Start or Quantity value is invalid.
4
56
See Common Attributes for operand-related faults.
Execution
Ladder Diagram
Condition/State
Action
Prescan
N/A
Rung-condition-in is false
N/A
Rung-condition-in is true
The instruction executes.
Postscan
N/A
Structured Text
Condition/State
Action
Prescan
See Prescan in the Ladder Diagram table.
Normal execution
See rung-condition-in is true in the Ladder Diagram table.
Postscan
See Postscan in the Ladder Diagram table.
Examples
ASCII information from a terminal contains a header character. After the controller reads the data (term_read.EM is on), the DELETE instruction removes the header character. The controller can then use the text of the message or pass it on to another device.
Ladder Diagram
Structured Text
IF term_read.EM THEN
DELETE(term_input,1,1,term_text);
term_read.EM := 0;
END_IF;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.