10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.11 RPG BindingPDFlib provides a /copy module that defines all prototypes and some useful constantsneeded to compile ILE-RPG programs with embedded PDFlib functions.Function names. All PDFlib functions have been renamed for RPG binding. Instead ofthe PDF_ prefix you must use RPDF_ as prefix for all function names. However, the originalfunction names as provided in PDFlib versions earlier than 7 are still available (withoutUnicode treatment of string parameters).Unicode string handling. Since all functions provided by PDFlib use Unicode stringswith variable length as parameters, you have to use the %UCS2 builtin function to converta single-byte string to a Unicode string. All strings returned by PDFlib functions areUnicode strings with variable length. Use the %CHAR builtin function to convert theseUnicode strings to single-byte strings.Note The %CHAR and %UCS2 functions use the current job’s CCSID to convert strings from and toUnicode. The examples provided with PDFlib are based on CCSID 37 (US EBCDIC). Some specialcharacters in option lists (e.g. {[]} ) may not be translated correctly if you run the examplesunder other codepages.Since all strings are passed as variable length strings you must not pass the length parametersin various functions which expect explicit string lengths (the length of a variablelength string is stored in the first two bytes of the string).Compiling and Binding RPG Programs for PDFlib. Using PDFlib functions from RPG requiresthe compiled PDFLIB and PDFLIB_RPG service programs. To include the PDFlibdefinitions at compile time you have to specify the name of the /copy member in the Dspecs of your ILE-RPG program:d/copy QRPGLESRC,PDFLIBIf the PDFlib source file library is not on top of your library list you have to specify the libraryas well:d/copy PDFsrclib/QRPGLESRC,PDFLIBBefore you start compiling your ILE-RPG program you have to create a binding directorythat includes the PDFLIB and PDFLIB_RPG service programs shipped with PDFlib. Thefollowing example assumes that you want to create a binding directory called PDFLIB inthe library PDFLIB:CRTBNDDIR BNDDIR(PDFLIB/PDFLIB) TEXT('PDFlib Binding Directory')After creating the binding directory you need to add the PDFLIB and PDFLIB_RPG serviceprograms to your binding directory. The following example assumes that you want toadd the service program PDFLIB in the library PDFLIB to the binding directory createdearlier.ADDBNDDIRE BNDDIR(PDFLIB/PDFLIB) OBJ((PDFLIB/PDFLIB *SRVPGM))ADDBNDDIRE BNDDIR(PDFLIB/PDFLIB) OBJ((PDFLIB/PDFLIB_RPG *SRVPGM))2.11 RPG Binding 41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!