*> Copyright (c) 2005 - 2024 Veryant. Users of isCOBOL *> may freely modify and redistribute this program. program-id. CALLISQR. working-storage section. 77 opCode PIC 9. 88 opGen VALUE 0. | generate a QR code image from the given text 88 opRead VALUE 1. | read text out of a QR code image 77 imgPath PIC X ANY LENGTH. | opGen: pathname of the img to generate, opRead: pathname of the img to read 77 qrText PIC X ANY LENGTH. | opGen: text to be stored in the QR, opRead: text retrieved from the QR 77 imgWidth PIC 9(5). | Width in pixels of the image, evaluated only by opGen 77 imgHeight PIC 9(5). | Heigth in pixels of the image, evaluated only by opGen 77 exit-code pic s9. procedure division. main. display "Generating QR image" perform generate-code. display "Reading QR image" perform read-code. goback. generate-code. set opCode to 0 *During QR code generation, the image format is retrieved by the file extension specified by imgPath. *If the imgPath parameter doesn't include extensions, then the "PNG" format is assumed. *Supported image formats: JPEG, GIF, BMP, PNG. move "isc.png" to imgPath move "www.veryant.com" to qrText move 150 to imgWidth, imgHeight move spaces to exit-code call "isQR" using opCode, imgPath, qrText, imgWidth, imgHeight giving exit-code. . evaluate exit-code when 0 display "Success, isc.png created" when -1 display "Error, wrong number of arguments" when -2 display "Error, " qrText end-evaluate . read-code. set opCode to 1 move "isc.png" to imgPath move spaces to qrText, imgWidth, imgHeight, exit-code call "isQR" using opCode, imgPath, qrText, imgWidth, imgHeight giving exit-code. . evaluate exit-code when 0 display "Success, text is " qrText when -1 display "Error, wrong number of arguments" when -2 display "Error, " qrText end-evaluate .