IBM Support

Information on Swiss QR Code Bar Code

How To


Summary

Apply the necessary PTFs.
Using DDS, create an *AFPDS or *IPDS printer file to include the BARCODE DDS keyword.
Ensure the Replace Unprintable Character Action for the printer file is *NO.
Use the correct CCSID for UTF-8 encoding.

Objective

Provide information on using DDS to generate a Swiss QR Code bar code

Environment

IBM i OS 7.3, 7.4 and 7.5 
IPDS or ASCII printer that is capable of printing the bar code

Steps

The PTFs for this APAR must be applied:
SE77556 - OSP-PRT ADD SUPPORT FOR THE SWISS QR BARCODE
PTFs are provided for V7R3, V7R4, and V7R5
**NOTE:  The PTFs are distribution-requisites, not pre-, or co-requisites.  Both need to be loaded and applied.
In the DDS of the printer file, modifier X'64' and keyword *NOCONVERT must be used like this:
     A          R QR                        SKIPB(005)                     
     A            SCQRDATA    1000A  O    27BARCODE(QRCODE 1 *HRZ +        
     A                                      X'64' (*SWIDTH 1.8) +          
     A                                      (*QRCODE 4 1 *NOCONVERT *TRIM +
     A                                       *NOESCAPE))                   
It is required to use keyword RPLUNPRT(*NO), when the printer file is created:
CRTPRTF FILE(LibraryName/SUISSEPRTF) SRCFILE(LibraryName/QDDSSRC) DEVTYPE(*AFPDS) 
  RPLUNPRT(*NO) TOSTMF('/PathName/') WSCST(*PDF)
In RPGLE, the conversion from the Job CCSID, which is EBCDIC, to the required UTF-8 encoding can be achieved by
scqrdata = %CHAR(%CHAR(scqrdatae:*UTF8)  : *HEX);
If ASCII encoding is preferred, CCSID 819 can be used instead:
scqrdata = %CHAR(%CHAR(scqrdatae:819)  : *HEX);
Here's an example program:
**FREE
   dcl-f suisseprtf printer;
   dcl-s cr  char(2) inz(x'0D25');
   dcl-s scqrdatae char(1024);

   scqrdatae = 'Suisse cross' + cr +
     %CHAR(%TIMESTAMP()) + cr +
     'Umlaut: ä ö ü Ä Ö Ü ß'+ cr +
     'Special: { [ ] } \';
   scqrdata = %CHAR(%CHAR(scqrdatae:*UTF8)  : *HEX);
   Write qr;
   *inlr = *on;
In paymentstandards.CH's FAQ it is explained, that a Linefeed is usually encoded as CR+LF, which is X'0D25' in EBCDIC, but coding only an LF = X'25' is accepted as well.
Running the example generates this QR Code:
image-20220705153729-1
The programming examples are provided as-is.  Programming assistance in United States and United Kingdom can be provided through IBM i Customized Services, and through Lab Services for other regions.

Additional Information

PaymentStandards.CH defines a standard ISO 20022 as the basis for a QR-bill, which becomes mandatory for suisse payments.
Part of this standard is a QR Code, which has a suisse cross in the middle as an identifying feature.
IBM i implemented a modifier for the DDS-keyword BARCODE, which enables this feature.

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CPnAAM","label":"Print-\u003EDDS-\u003EBARCODE"}],"ARM Case Number":"TS009876006","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.3.0;7.4.0;7.5.0;and future releases"}]

Document Information

Modified date:
10 January 2023

UID

ibm16601305