How-to
How the Logix FLL instruction clears a string array
Short answer
One FLL instruction empties a Logix STRING array: set the source to 0, address the first element as the destination and set the length to the element count read with SIZE. A length of 1 fills only one element — the same symptom the COP and CPS attempts showed. Zero fill sets .LEN to 0 and every .DATA byte to 0, so each element reads as ''.

On this page
One FLL instruction empties a string array in Studio 5000: set the source to 0, address the first element of the array as the destination, and set the length to the element count, which the SIZE instruction reads for you. The fill writes 0 into every byte each element occupies, so .LEN goes to 0, every .DATA byte goes to 0, and each element reads as ''. The length decides the result. A length of 1 fills one element only — the same symptom the COP and CPS attempts produced, because those instructions also count elements of the destination type in their length operand. The rungs below build the SIZE-plus-FLL pair, work the arithmetic for a 16-element array, and show when a template array or the DELETE instruction fits better.
What zero-fill means inside a string tag #
A STRING tag is a structure, not a scalar: a .LEN integer that holds the count of valid characters, and a .DATA array of one-byte characters. The .DATA member can hold extra characters that .LEN does not count, so a tag can read as empty while stale text still sits in its bytes. Assigning 0 to .LEN alone hides the text without removing it; a fill of 0 across the whole structure clears length and bytes together in one instruction.
| Member | Role | After a fill with source 0 |
|---|---|---|
| .LEN | Count of valid characters | 0, so the element reads as '' |
| .DATA[] | The character bytes | Every byte 0, so no residue stays |
Stray values in controller memory are the wider version of this cleanup; the same fill-and-copy family is what resolving junk values in ControlLogix memory with FLL, COP and CPS walks through.
Build the clear rung #
The names here are illustrative, so rename them to your project: Recipe_Names is a one-dimensional STRING array of 16 elements, StrCount is a DINT, and ClearStrings_Req is the request BOOL.
- Create
StrCountas a DINT andClearStrings_Reqas a BOOL. - Add a SIZE instruction on the rung ahead of the fill: its source is
Recipe_Names[0], it reads the first dimension (0), and it stores the element count inStrCount. On a two-dimensional array, decide which dimension you mean to clear and check each one deliberately. - Add the FLL instruction on the next rung with
Source 0,Dest Recipe_Names[0]andLength StrCount. - Gate both rungs with a one-shot driven by
ClearStrings_Req, so the fill runs once per request instead of every scan. - Reset
ClearStrings_Reqafter the fill completes, from the HMI button release, a state-machine step or an unlatch at the end of the chain.
Never set the length above the array dimension: the fill writes exactly that many elements from the start address, so an oversized length writes into whatever tags sit next in memory and can fault the controller. Taking the length from SIZE removes the guess.
FLL is the fill-side twin of the array-scan pattern many programs already run: where the FSC array search that finds one fault code in a CompactLogix INT array reads its way through the elements, FLL writes one value across all of them in a single execution.
Worked example: 16 elements, one fill #
Recipe_Names holds 16 STRING elements. SIZE reads 16 into StrCount, and the fill rung executes as FLL with source 0, destination Recipe_Names[0] and length 16. The controller fills elements [0] through [15] — 16 of 16 — and each ends with .LEN at 0 and every .DATA byte at 0.
Set the length to 1 instead and the same instruction fills element [0] only: 16 - 1 = 15 elements keep their old text, which is exactly the one-element symptom. Set it to 20 and the fill runs 20 - 16 = 4 elements past the end of the array, into whatever tags the project placed next. That is why the count comes from SIZE rather than a typed constant.
Why COP and CPS stopped at one element #
COP and CPS copy elements of the destination type, and their length operand counts those elements. Left at 1, the copy moved one STRING structure and stopped: one element of sixteen, fifteen untouched. With the length set to the element count, the copy covers the array exactly as the fill does — the difference is that it carries the contents of a same-type source array instead of writing one value. Use CPS in place of COP when the copy must complete without a task switch splitting it mid-transfer.
The operand-by-operand behavior of the whole family — MOV, COP, CPS and FLL — is laid out in a memory-copy guide to the MOV, COP, CPS and FLL instructions.
Template array, DELETE and structured text alternatives #
A template array earns its memory only when the cleared state is not all zeros: create a second tag of the same STRING-array type and dimension, never write to it, comment it as a do-not-write source, and copy it over the working array with COP or CPS at a length equal to the element count. Never borrow the shortcut of reading an empty source from a block's temporary memory on other platforms — temporary memory is shared between blocks and is not cleared on each call, so it holds whatever ran before until you write it first.
DELETE clears one string at a time: give it a start position at the first character and a quantity of StringTag.LEN, and it removes every character. When the result writes back to the same tag, gate the rung with a one-shot so later scans do not delete from an already-shrinking string. Because DELETE handles one tag per execution, an array still wants the FLL rung.
FAL steps through array elements for arithmetic and logic expressions, so it is aimed at numeric arrays, not at filling STRING structures. For a selective clear — one element, or only the .LEN member, as in Recipe_Names[i].LEN := 0 with i as the FOR loop index — structured text is the right tool, and its scan-order behavior matches how a REPEAT loop runs in PLC structured text. When every element must become '', the single FLL rung stays shorter and keeps the logic in ladder.
Verify the clear at runtime #
- Go online with the edit and load test text into several elements, including the first and the last.
- Set
ClearStrings_Reqand confirmStrCountshows 16 before the fill rung executes; the count must be current for the length to be right. - Expand the first and the last element in the online tag monitor: .LEN reads 0 and every .DATA byte reads 0.
- If tags sit immediately after the array, open the neighboring tag and confirm it is unchanged.
- Check the controller's fault log after the first execution; with the length taken from SIZE, the fill logs no fault.
Questions asked
Does one FLL clear a single STRING tag as well as an array?
Yes. Address the tag itself as the destination and set the length to 1: a single STRING is one element of the destination type, so the fill covers the whole structure and the tag reads as ''. On an array that same length of 1 reaches only element [0], so there the length must equal the element count.
Will FLL clear an array of a UDT that holds STRING members?
Yes. FLL writes the fill value across each element's bytes, so numeric and BOOL members go to 0 along with the strings. Use it when an all-zero reset is what the machine expects. When the reset state must hold non-zero defaults, copy from a never-written template array of the same type and size instead, at a length equal to the element count.
Does the SIZE result need refreshing every time the clear runs?
No. Array dimensions are fixed once the tag exists, so the element count cannot go stale while the project runs. Keep the SIZE rung immediately ahead of the FLL rung anyway: after an offline resize and a download, the next pass reads the new dimension with no edit to the clear logic. For the same reason, do not replace SIZE with a typed-in constant — the constant is the edit that silently keeps the old dimension.
Is an emptied STRING the same as a string full of spaces?
No. After the fill, .LEN is 0 and the .DATA bytes are 0, so comparisons against '' succeed and no characters show. A string of spaces has a .LEN equal to its space count and the space character in every byte, so it passes a length check and fails an equality test against ''. The zero fill is what clears length and content together.