:TAIL_PROCESS, TAIL_PROCESS

Use TAIL_PROCESS to take lines from the end of the text. You can use this scripting element only with process handles.

Note: The terms Data Sequences and Text Containers are used interchangeably.

This scripting element can be used as both, a script statement and a script function:

  • When used as a script statement, it modifies the text container of the input handle and provides the result in that text container. This is useful for stacking commands to modify text containers, thus avoiding reallocating new process handles.

  • When used as a script function, the text container of the process handle is provided read-only, and the result is provided in a new text container as a return value of the function.

Syntax

When used as a script statement:

:TAIL_PROCESS Handle[, Line_number]

When used as a script function:

TAIL_PROCESS (Handle[, Line_number])

Parameters

  • Handle

    Process handle of a text container

    Format: script literal or script variable

  • Line_Number

    (Optional) Defines the number of the line to take.

    Allowed values:

    • >= 0: Picks the specified number of lines from the end

    • <0: Picks all lines from the end but starts at the number of lines specified

    Default value: 10

Examples

These examples combine the script elements CAT_PROCESS, CUT_PROCESS, HEAD_PROCESS, TAIL_PROCESS and SWAP_PROCESS in and Include Job (JOBI) and a Job (JOBS) aiming to get different information from a financial report:

Include object (081.INC.PRINT_AND_SUM_NUMBERS) Process page definition:

!* Input:

!* &YEAR# ... year

!* &HND_NUMBERS# ... with numbers

!* Get revenue numbers in the second column from character position 12 to 35

:SET &HND_COL2# = CUT_PROCESS(&HND_NUMBERS#, , "12-35")

!* Get revenue numbers in the second column from character position 12 to 35

:CUT_PROCESS &HND_COL2#, 1, , "d/ /"

!* Output

:PRINT Quarterly results of year &YEAR#:

:DEFINE &TOTAL#, FLOAT

:SET &TOTAL# = 0

:PROCESS &HND_COL2#

: SET &REP_NUMBER# = GET_PROCESS_LINE(&HND_COL2#)

: PRINT &REP_NUMBER#

: SET &TOTAL# = &TOTAL# + &REP_NUMBER#

:ENDPROCESS

:DEFINE &TOTAL_STRING#,STRING

:SET &TOTAL_STRING# = FORMAT(&TOTAL#, "00.0")

:PRINT Total revenue of year &YEAR#: &TOTAL_STRING#

:CLOSE_PROCESS &HND_COL2#

Job Post Process page definition:

!* Get numbers from report

!* Load report to text container

:SET &HND_REPORT# = PREP_PROCESS_REPORT()

!* Cut off job messenger header

:SET &HND_TABLE# = TAIL_PROCESS(&HND_REPORT#, -9)

!* Cut off job messenger trailer

:HEAD_PROCESS &HND_TABLE#, -11

!* Cut off table header

:SET &HND_NUMBERS# = TAIL_PROCESS(&HND_TABLE#, -2)

!* Get numbers of 2022 only and put them into a separate text container &HND_NUMBERS_2022#

:SET &YEAR# = "2022"

:SET &REGEX_QSYEAR# = "Q. &YEAR#"

:SET &HND_NUMBERS_2022# = GREP_PROCESS(&HND_NUMBERS#, &REGEX_QSYEAR#)

!* Get numbers of 2023 only and filter for them in the same text container &HND_NUMBERS#

:SET &YEAR# = "2023"

:SET &REGEX_QSYEAR# = "Q. &YEAR#"

:GREP_PROCESS &HND_NUMBERS#, &REGEX_QSYEAR#

!* Print and sum numbers of &YEAR# 2022 in text container &HND_NUMBERS_2022#

!* As output routine in include works with script variable &HND_NUMBERS#, we have to swap the containers first

:SWAP_PROCESS &HND_NUMBERS#, &HND_NUMBERS_2022#

:INC 081.INC.PRINT_AND_SUM_NUMBERS

!* Print and sum numbers of &YEAR# 2023 that have been swapped to text container &HND_NUMBERS_2022#

!* As output routine in include works with script variable &HND_NUMBERS#, we have to swap the containers first

:SWAP_PROCESS &HND_NUMBERS#, &HND_NUMBERS_2022#

:PRINT

:INC 081.INC.PRINT_AND_SUM_NUMBERS

!* Combine both text containers to &HND_NUMBERS# in reverse order:

:CAT_PROCESS &HND_NUMBERS#, &HND_NUMBERS_2022#, "r"

!* Summarize both years and print numbers in reverse order

:SET &YEAR# = "2023 + 2022"

:PRINT

:PRINT Both years combined in reverse order:

:INC 081.INC.PRINT_AND_SUM_NUMBERS

After executing the Job, the Post process report (POST) shows the following information:

2025-08-07 14:35:21 - U00020408 Quarterly results of year 2023:
2025-08-07 14:35:21 - U00020408 7.7
2025-08-07 14:35:21 - U00020408 8.1
2025-08-07 14:35:21 - U00020408 8.5
2025-08-07 14:35:21 - U00020408 8.9
2025-08-07 14:35:21 - U00020408 Total revenue of year 2023: 33.2
2025-08-07 14:35:21 - U00020408 
2025-08-07 14:35:21 - U00020408 Quarterly results of year 2023:
2025-08-07 14:35:21 - U00020408 8.9
2025-08-07 14:35:21 - U00020408 8.7
2025-08-07 14:35:21 - U00020408 8.8
2025-08-07 14:35:21 - U00020408 9.3
2025-08-07 14:35:21 - U00020408 Total revenue of year 2023: 35.7
2025-08-07 14:35:21 - U00020408 
2025-08-07 14:35:21 - U00020408 Both years combined in reverse order:
2025-08-07 14:35:21 - U00020408 Quarterly results of year 2023 + 2022:
2025-08-07 14:35:21 - U00020408 9.3
2025-08-07 14:35:21 - U00020408 8.8
2025-08-07 14:35:21 - U00020408 8.7
2025-08-07 14:35:21 - U00020408 8.9
2025-08-07 14:35:21 - U00020408 8.9
2025-08-07 14:35:21 - U00020408 8.5
2025-08-07 14:35:21 - U00020408 8.1
2025-08-07 14:35:21 - U00020408 7.7
2025-08-07 14:35:21 - U00020408 Total revenue of year 2023 + 2022: 68.9

The Job report (REP) shows the following information:

See also: