Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

Following Cicode Syntax

  • Last UpdatedJul 18, 2023
  • 2 minute read

Some programming languages have strict rules about how the code needs to be formatted, including the indenting and positioning of the code structure. Cicode has no indenting or positioning requirements, allowing you to design your own format - provided only that you follow the correct syntax order for each statement (see Cicode Function Syntax). However, it is a good idea to be consistent with your programming structure and layout, so that it can be easily read and understood.

For details about programming standards, see the section titled Using Cicode Programming Standards, which includes sections on:

  • Standards for constants, variable tags, and labels

  • Standards variables: declaration, scope, and naming

  • Standards for functions: naming , file headers, headers

  • Formatting of: declarations, statements, expressions, and functions

  • Use of comments

For information on problem solving, see the sections on Modular Programming, Defensive Programming, Function Error Handling, or Debugging Cicode.

The following is an example of a simple Cicode function:

/*

This function is called from a keyboard command. The operator

presses the key and enters the name of the page to be displayed. If

the page cannot be displayed, an error message is displayed at the

prompt AN.

*/

INT

FUNCTION

MyPageDisplay ( STRING sPage ) ! pass in the name of the page to be displayed

! declare a local integer to hold the results of the pagedisplay function

INT Status;

! call the page Cicode pagedisplay function and store the result

Status = PageDisplay ( sPage ) ;

! determine if the page display was successful

IF Status < > 0 THEN ! error was detected

! display an error message at the prompt AN

DspError ( "Cannot Display " + sPage ) ;

END

! return the status to the caller

RETURN Status;

END

The rules for formatting statements in Cicode functions are simple, and help the compiler in interpreting your code.

It is good practice to use white space to make your code more readable. In the example above, the code between the FUNCTION and END statements is indented, and the statement within the IF THEN conditional executor is further indented to make the conditions and actions clear. Develop a pattern of indentation - and stick to it. Extra blank lines in the code make it easier to read (and understand).

See Also

Writing Functions

Related Links
TitleResults for “How to create a CRG?”Also Available in