Configuring Siemens 840D GUD String Concatenation Guide

David Krause1 min read
Other TopicSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Build the Delimited GUD String

Use the Siemens 840D string concatenation operator << to combine GUD values and literal delimiters. The confirmed example used semicolons; substitute a colon when the receiving format requires colon-separated values.

VARSTRING = <<GUDVAR1<<":"<<GUDVAR2<<":"<<GUDVAR3

The evidence does not identify the GUD data types or the required VARSTRING capacity. Declare the destination string with enough space for every formatted value plus the two delimiters.

Resolve the Delimiter Ambiguity

Requirement Expression fragment Evidence status
Semicolon-separated values GUDVAR1<<";"<<GUDVAR2<<";"<<GUDVAR3 Reported as working
Colon-separated values GUDVAR1<<":"<<GUDVAR2<<":"<<GUDVAR3 Direct delimiter substitution for the stated requirement

The original requirement specifies colons, while the confirmed expression uses semicolons. Select the delimiter required by the downstream parser and verify the final string rather than assuming the two formats are interchangeable.

Write GUD Values to a File

The supplied program uses WRITE with an integer error variable and the path /_N_WKS_DIR/_N_. It creates a file name from DATEN_GUD and _MPF, then writes the controller date, time, and individual GUD values.

DEF INT ERROR
DEF STRING[120] PATH_NAME="/_N_WKS_DIR/_N_"

WRITE(ERROR,PATH_NAME<<"DATEN_GUD"<<"_MPF",
      "GUDVAR1 ="<<GUDVAR1)
IF ERROR==10 GOTOF DATENVOLL
IF ERROR<>0 GOTOF FEHLER

This demonstrates writing into the stated controller directory. It does not identify a diskette destination, so do not treat the path as proof of direct removable-media storage.

Handle and Verify Write Results

  1. Execute each WRITE call with ERROR as its result variable.
  2. If ERROR==10, branch to the file-capacity handler. The supplied handler directs the engineer to review MD11420, identified there as MAX.PROT.LAENGE.
  3. If ERROR<>0 for any other result, branch to a general write-error handler and display the returned code.
  4. After a zero result, open or otherwise inspect the generated file and confirm the delimiters, GUD names, current values, and date/time fields.

The evidence defines special handling only for error code 10. Diagnose any other returned code using the documentation applicable to the installed 840D configuration.

FAQ

How do I concatenate Siemens 840D GUD values into one string?

Join each GUD and literal delimiter with <<, such as VARSTRING = <<GUDVAR1<<":"<<GUDVAR2<<":"<<GUDVAR3.

Should the Siemens 840D GUD string use colons or semicolons?

The confirmed expression used semicolons, but the stated requirement called for colons. Replace ";" with ":" and verify the resulting format against the downstream parser.

What does Siemens 840D WRITE error 10 require?

The supplied logic treats ERROR==10 as a file-capacity condition and directs the engineer to review MD11420, labeled MAX.PROT.LAENGE in that program.

Back to blog