Please enable JavaScript to view this site.

From version 6.2.87 - This Exit Program is useful if you need to output hexadecimal data, say for a barcode. If you pass in the hex equivalent in characters in PARM1, 2, 3, 4, 5, or 6 then each PARM will be converted into hex and returned back in the same parameter.

The reason this program is useful is that it is impossible to specify 'control characters' in the Cobwebb Designer and get it transferred successfully to the IBM i. Control characters are all the values between 0x00 and 0xFF that are not standard characters such as A-Z, 0-9 etc.

The returned hex can then be moved into a variable e.g. RS=?PARM1 and then added to the barcode data using the Multiple Variable & Parameter substitution technique to write the data out e.g. VAR1='TEST?RS?END'. VAR1 will then contain 8 bytes of data, 4 bytes for TEST, 1 byte of control character 0x1E and 3 bytes for END.

Notes:

The data in CPPD on the IBM i is EBCDIC but the data in the barcode is ASCII; so a translation is required. IBM converts the EBCDIC data to ASCII when it creates the barcode and it uses this table https://www.ibm.com/docs/en/iis/9.1?topic=tables-ebcdic-ascii. If you need to add a specific ASCII character to your barcode, look up the EBCIDIC equivalent in the table and use COBHEX to generate the correct EBCDIC character. This will then be converted to the desired ASCII in the barcode.

When adding the barcode output in the Cobwebb Designer it is recommended to set the barcode length to the maximum length required and tick "Trim trailing blanks" in the barcode Settings.

Parameter

In

Len

Out

Len

PARM1

Hex data as a character string e.g. 0E

32

Converted Hex output e.g. 0x1E

16

PARM2

As above

32

As above

16

PARM3

As above

32

As above

16

PARM4

As above

32

As above

16

PARM5

As above

32

As above

16

PARM6

As above

32

As above

16

Example

Parameter

Input

Output

PARM1

0E

0x1E

PARM2

1D

0x1D

PARM3

37

0x37

PARM4

0E1D

0x1E0x1D

PARM5



PARM6