Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Formats

&pagelevel(3)&pagelevel

A field is a section of the input/output record characterized by:

  • its start position in the record

  • its length

  • its format.

The format specifies how the record in the input record is to be interpreted or how it is to be modified for the output record when it is transferred. Keywords and literals have an implicitly fixed format. PERCON can process the following formats:

CHARACTER

The field designated by “character” either already contains characters or is to be provided with characters. The term “characters” is understood to include letters, numbers and special characters.

Example


Contents of input field
Input format CHARACTER

Contents of output field
Output format CHARACTER

X'C1C2F1F2F3F4' (length: 6 bytes)

C’AB1234’ (length: 6 bytes)


HEXADECIMAL

Output format only. The input field is edited in hexadecimal format and output to the designated output field, i.e. each character in the input field is converted to the corresponding hexadecimal code and occupies 2 bytes in the output field.

Example


Contents of input field
Input format CHARACTER

Contents of output field
Output format CHARACTER

X'C1C2F1F2F3F4' (length: 6 bytes)

C'C1C2F1F2F3F4' (length: 12 bytes)


BINARY

Output format only. The input field is edited in binary format and output to the designated output field, i.e. each character of the input field is converted to binary code and occupies 8 bytes in the output field.

Example


Contents of input field
Input format CHARACTER

Contents of output field
Output format BINARY

X'C1C2' (length: 2 bytes)

C'1100000111000010' (length: 16 bytes)


ZONED-DECIMAL

The designated field contains an unpacked decimal number in EBCDI code or is to accept such a number. The sign accompanying the number is ignored.

Example


Contents of input field
Input format ZONED-DECIMAL

Contents of output field
Output format ZONED-DECIMAL

X'F1F2F3F4' (length: 4 bytes)

C'1234' (length: 4 bytes)



Contents of input field
Input format PACKED-DECIMAL

Contents of output field
Output format ZONED-DECIMAL

X'123F' (length: 2 bytes)

C'123' (length: 3 bytes)


SIGNED-DECIMAL

Output format only. The output field is to accept an unpacked decimal number in which the sign +, or –) is always contained in the first byte of the field.

This must be taken into account for the length entry of the field.

Example


Contents of input field
Input format ZONED-DECIMAL

Contents of output field
Output format SIGNED-DECIMAL

X'F1F2F3F4' (length: 4 bytes)

C'+1234' (length: 5 bytes)



Contents of input field
Input format PACKED-DECIMAL

Contents of output field
Output format SIGNED-DECIMAL

X'123F' (length: 2 bytes)

C'+123' (length: 4 bytes)


DECIMAL

Output format only. The output field is to contain an unpacked decimal number whose sign is printed only if the number has a negative value. If it has a positive value, a space character is printed instead of the sign. This must be taken into account for the length entry.

Example


Contents of input field
Input format ZONED-DECIMAL

Contents of output field
Output format DECIMAL

X'F1F2F3F4' (length: 4 bytes)

C' 1234' (length: 5 bytes)



Contents of input field
Input format PACKED-DECIMAL

Contents of output field
Output format DECIMAL

X'123F' (length: 2 bytes)

C' 1234' (length: 4 bytes)


PACKED-DECIMAL

The designated field either contains a packed decimal number or is to accept one. The length of a packed number must not exceed 16 bytes.

Example


Contents of input field
Input format ZONED-DECIMAL

Contents of output field
Output format PACKED-DECIMAL

X'F1F2F3F4' (length: 4 bytes)

X’01234F' (length: 3 bytes)



Contents of input field
Input format PACKED-DECIMAL

Contents of output field
Output format PACKED-DECIMAL

X'123F' (length: 2 bytes)

C'123F' (length: 2 bytes)


ZONED-DECIMAL-LEFT

Output format; for keywords only. The output field is to contain an unpacked decimal number. The right-hand part of the output field is filled with space characters.

Example


Contents of

Output format ZONED-DECIMAL-LEFT

RECORD-COUNTER

C'82579   ' (length: 8 bytes)


TRANSLATION

This entry is only permissible within the field definition of the OUTPUT-FIELDS operand in the SET-RECORD-MAPPING statement. The individual characters are converted according to the code table.

NO-TRANSLATION

This specification is valid only within the field description of the OUTPUT-FIELDS operand in the SET-RECORD-MAPPING statement. NO-TRANSLATION must be used whenever the input field is not to be converted to the output character set, e.g. with packed numbers.

UNICODE-TRANSLATION

This specification is valid only within the field description of the OUTPUT-FORMAT operand in the SET-RECORD-MAPPING statement. The input file and/or output file must have a Unicode format assigned. This statement enables individual sections of a record to be converted and/or (if the Unicode variant UTF-16 is being used) normalized. If the OUTPUT-FORMAT=*UNICODE-TRANSLATION specification is missing, no conversion or normalization of the section concerned takes place.

When a non-Unicode format is converted to a Unicode format or vice versa, it must be borne in mind that the length of the section to be output can change (see "Use of UNICODE character sets in PERCON ").

Formatted numbers with an editing mask

Output format: for numerical output fields only. In addition to the output formats ZONED-DECIMAL, SIGNED-DECIMAL and ZONED-DECIMAL-LEFT, it is also possible to specify an editing mask for numerical output fields. In such a mask, leading zeros can be suppressed, trailing positions displayed or numeric grouping carried out.

A mask is defined in the SET-GROUP-ATTRIBUTES or SET-RECORD-MAPPING statement using the operand OUTPUT-FORMAT=<c-string>. In addition, the OUTPUT-LENGTH operand must have the value *STD.

The following characters can be used in a mask:

Fill characters (fillers)  :  all printable characters
Numeric characters         :  digit selector ('Z')
                              significance starter ('N')
Insertion characters       :  characters not included under 'Z' and 'N'
  • Mask structure

    The first character of the mask is interpreted as a fill character (filler). The following conditions apply to mask characters to the right of the filler: the number of numeric characters must be odd and no more than one significance starter may be present. If these conditions are not kept to, the mask is rejected as containing a syntax error. Insertion characters may be located between the numeric characters.

  • Mask size

    If the mask contains more numeric characters than are present in the number to be edited, the number to be edited is filled to the left with zeros.

    If the number of digits in the number to be edited is greater than the number of numeric characters in the mask, the number to be edited is shortened (starting from the left). If relevant digits (!= leading zeros) are cut off during this shortening procedure, the conversion step is immediately terminated abnormally (see message PER0042).

    In the case of the previous output formats of PERCON, the following restriction still applies: the number of digit positions in the output field must be greater than or equal to that of the input field.

  • Mask processing

    The mask is processed from left to right. All characters before the first numeric character (’Z’, ’N’) are replaced by the fill character.

    As processing continues, all characters (the insertion characters, too) continue to be replaced by the fill character until either a digit selector is replaced by a digit != 0 or a significance starter occurs in the mask.

    Afterwards, the numeric characters are replaced by the corresponding digits, characters to be inserted remaining unchanged.

    Characters to be inserted after the last numeric character remain unchanged if the number to be edited is negative, otherwise they are replaced by the fill character.

Example 1

FIELD (INPUT-POSITION=...,- 
       INPUT-LENGTH=5,- 
       INPUT-FORMAT=*PACKED-DECIMAL,- 
       OUTPUT-POSITION=...,- 
       OUTPUT-LENGTH=*STD,- 
       OUTPUT-FORMAT='*ZZNZ.ZZZ-') 

The following conversion procedure is carried out:


Field to be edited:      0 0 0 0 0 0 0 3 8 C 
Mask specified:          * Z Z N Z . Z Z Z - 
Output field:            * * * * 0 . 0 3 8 * 


The packed number is positive; therefore, the minus sign after the number is replaced by the fill character. In the field to be edited, the leading byte (which contains zero) is cut off to adapt the number to the mask. If field elements not equal to zero were to be cut off, this would lead to abnormal termination accompanied by the error message PER0042.

Example 2

FIELD (INPUT-POSITION=...,- 
       INPUT-LENGTH=4,- 
       INPUT-FORMAT=*ZONED-DECIMAL,- 
       OUTPUT-POSITION=...,- 
       OUTPUT-LENGTH=*STD,- 
       OUTPUT-FORMAT='xZ ZNZ,ZZZ -') 

The following conversion procedure is carried out:


Field to be edited:                  F 3 F 9 F 7 D 1 
Mask specified:            x Z   Z N Z , Z Z Z   - 
Output field:              x x x x x 3 , 9 7 1   - 


Because the zoned number is negative, the space character and minus sign after the number are transferred to the output field.