TIRFTRIM

TIRFTRIM is a called module supplied with CA Gen. TIRFTRIM is called every time an CA Gen action diagram uses the TRIM function.

TRIM removes trailing spaces from a text field. It is usually used in conjunction with the Concat function or the Length function.

TRIM generates the following COBOL statements:

Statement

Quantity

Call

1

Compute

1

Move

6

Initialize

1

IF

2

 

Heavy use of TRIM can drastically increase CPU costs.

Example 1

The following example concatenates an employee's last name and first name into one text field. TRIM removes the trailing spaces from the last name before concatenating the ", " and the first name.

 

SET local employee full_name TO

concat(concat(trim(local employee last_name), ", "),

local employee first_name)

Example 2

The following example calculates the number of characters in the employee's full name (without counting the trailing spaces).

 

SET local work_set nbr_of_characters TO

length(trim(local employee full_name))

Hints

If an action diagram uses TRIM more than once for the same input:

  • use TRIM once for the desired input

  • save the result in a local view

  • use the local view instead of TRIM for the remaining instances

  • pass the local view to the import view of any called action diagrams that need it.

If TRIM is used in an action diagram that uses several CA Gen functions, or the action diagram has high CPU usage due to TRIM, consider converting the action diagram to an external action block.