:CUT_PROCESS, CUT_PROCESS
Use CUT_PROCESS to cut out a row or range of code points — for example, to cut out columns you specify from any text or table. You can use this scripting element with process handles to select specific columns and work only within them.
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:
:CUT_PROCESS Handle[, Column[, Range[, Flags]]]
When used as a script function:
CUT_PROCESS (Handle[, Column[, Range[, Flags]]])
Parameters
| Parameter | Description | Format | Allowed Values | Default Value |
|---|---|---|---|---|
| Handle | Process handle of a text container. | Script literal or script variable | n.a. | n.a. |
| Column
(Optional) |
The index indicates which column to search, beginning with 1. Use 0 to search the entire line. If the text container (data sequence) was loaded with columns defined, you can select a specific column and use this script element to work within that column. Make sure you know which column delimiter was used when the text container was loaded. If needed, you can define the delimiter using the 'd' flag. |
Script literal, script variable, or number without quotation marks | n.a. | 0 |
| Range
(Optional) |
Defines the code point range. When you specify a column, the range is applied to the selected column. |
n.a. |
|
n.a. |
| Flags
(Optional) |
Use flags to modify the operation. The available flags are:
Flags can be combined and provided in any order. For example, if you combine flag v with flag d/ /, you can do so using "vd/ /" or "d/ /v", or the script variable &FLAG#. |
n.a. | n.a. | n.a. |
Examples
The following examples combine CAT_PROCESS, CUT_PROCESS, HEAD_PROCESS, TAIL_PROCESS, and SWAP_PROCESS in an Include Job (JOBI) and a Job (JOBS) to retrieve different information from a financial report.
Include object (081.INC.PRINT_AND_SUM_NUMBERS) Process page definition:
!* Input:
!* &YEAR# ... year
!* &HND_NUMBERS# ... text container with numbers
!* Get revenue numbers in the second column from character position 12 to 35
:SET &HND_COL2# = CUT_PROCESS(&HND_NUMBERS# ,, "12-35")
!* Cut to column 1 using space as delimiter
: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 ®EX_QSYEAR# = "Q. &YEAR#"
:SET &HND_NUMBERS_2022# = GREP_PROCESS(&HND_NUMBERS#, ®EX_QSYEAR#)
!* Get numbers of 2023 only and filter for them in the same text container &HND_NUMBERS#
:SET &YEAR# = "2023"
:SET ®EX_QSYEAR# = "Q. &YEAR#"
:GREP_PROCESS &HND_NUMBERS#, ®EX_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#
: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 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: