COZZI-Copy Repeated to CL Var (CLREPEAT)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
  • Batch ILE CL module (*BMOD)
  • Interactive ILE CL module (*IMOD)
Threadsafe: No
Parameters
Examples
Error messages

The COZZI-Copy Repeated to CL Var (CLREPEAT) command copies a value repeated to the target CL variable. For example, you can move all X'00' to a field in a CL data structure so that it can be used properly with the many IBM i API interfaces. You can also move repeating patterns to target variables, for example: you can move 'ABC123' to a Type(*CHAR) Len(20) field and it fills it with 'ABC123ABC123ABC123AB'.

Restrictions:

Top

Parameters

Keyword Description Choices Notes
VAR CL variable name Character value Required, Positional 1
VALUE Char or Hex value to repeat Character value Required, Positional 2
Top

CL variable name (VAR)

Specifies the CL variable whose value is to be changed.

This is a required parameter.

character-value
Specify any CL variable with a length of 1 to 5000 characters.
Top

Char or Hex value to repeat (VALUE)

Specifies the value to be repeatedly stored in the VAR parameter. The value specified here is moved repeatedly to the target CL variable specified on the VAR parameter. Up to 5000 bytes may be specified but typically this value is a short value of 1 to 3 characters and is often specified using hexadecimal notation. For example: VALUE(X'00') moves all hex zeros to the target variable, while VALUE('ABC') repeats the pattern 'ABC' over and over until the target variable is filled. Any extra characters in the pattern that do not fit in the target variable are truncated.

This is a required parameter.

character-value
Specify the pattern to move repeatedly to the CL variable specified on the VAR parameter. This value is repeated in the target variable until the target variable is filled.
Top

Examples for CLREPEAT

Example 1:

  DCL &QUSEC TYPE(*CHAR) LEN(16)
  CLREPEAT  VAR(&QUSEC) VALUE(X'00')

This command sets the &QUSEC variable to all X'00'.

Example 2

DCL &DATE TYPE(*CHAR) LEN(7)
CLREPEAT  VAR(&DATE) VALUE('0')

This command moves zeros X'F0' to the field &DATE.

Example 3

DCL &DUP TYPE(*CHAR) LEN(10)
CLREPEAT  VAR(&DUP) VALUE('XYZ')

This command moves 'XYZXYZXYZX' the field &DUP.

Top

Error messages

Unknown
Top