PDFService

Refer to shipped RPG source file QRPGLRSRC and CRTDEMO program source in QCLSRC source file.

 

      *

     D FieldDef1       S             60    DIM(11) CTDATA

     D FieldDefSize    S             10I 0 INZ(0)

     D FieldEntSize    S             10I 0 INZ(0)

     D ListDef1        S             60    DIM(1) CTDATA

     D ListDefSize     S             10I 0 INZ(0)

     D ListEntSize     S             10I 0 INZ(0)

     D ListCount       S             10I 0 INZ(0)

     D ListMaxCount    S             10I 0 INZ(0)

      *

     D JSMHDL          S              4    INZ(*BLANKS)

     D JSMSRV          S            100    INZ(*BLANKS)

     D JSMSTS          S             40    INZ(*BLANKS)

     D JSMMSG          S           4096    INZ(*BLANKS)

     D JSMCMD          S           2048    INZ(*BLANKS)

     D ZEROLENGTH      S             10I 0 INZ(0)

      *

     D FLD1            DS

     D  PRDID                        10A   INZ('CORD443')

     D  PRDAVL                      200A

     D  PRDDSC                      200A

     D  PRDAMTMP                     10P 2 INZ(499.99)

     D  PRDAMTYP                     10P 2 INZ(499.99)

     D  PRDAMTB10                    10P 2 INZ(431.99)

     D  PRDAMTB20                    10P 2 INZ(413.99)

     D  PRDAMTB30                    10P 2 INZ(359.99)

     D  PRDCOUNT                      3S 0 INZ(25)

     D  PRDDATE                        D   DATFMT(*ISO)

     D  PRDDATETIME                    Z

      *

     D LST1            DS                  OCCURS(10)

     D  TEXT                         30

      *

      * JSMX_BEGIN

      *

     C                   CALLB(D)  'JSMX_BEGIN'

     C                   PARM                    *OMIT

     C                   PARM                    ZEROLENGTH

      *

      * JSMX_OPEN

      *

     C                   CLEAR                   JSMSRV

     C                   EVAL      JSMSRV = 'LOCALHOST:4560'

     C                   CALLB(D)  'JSMX_OPEN'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMSRV

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SERVICE_LOAD

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SERVICE_LOAD' +

     C                                      ' SERVICE(PDFDocumentService)' +

     C                                      ' TRACE(*YES)'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * CREATE

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'CREATE' +

     C                                      ' DOCUMENT(product.pdf)' +

     C                                      ' CONTENT(product.xml)'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * ADD CONTENT - BIND FIELDS

      *

     C                   EVAL      PRDAVL = 'Available in 24 hours'

     C                   EVAL      PRDDSC = '18V Compact Hammer.' +

     C                                      ' Power output 350W.'

     C                   EVAL      PRDDATE = %DATE()

     C                   EVAL      PRDDATETIME = %TIMESTAMP()

      *

     C                   EVAL      FieldDefSize  = %SIZE(FieldDef1:*ALL)

     C                   EVAL      FieldEntSize  = %SIZE(FLD1)

     C                   CALLB(D)  'JSMX_BINDFLD'

     C                   PARM                    JSMHDL

     C                   PARM                    FieldDef1

     C                   PARM                    FieldDefSize

     C                   PARM                    FLD1

     C                   PARM                    FieldEntSize

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * ADD CONTENT - BIND LIST

      *

     C     1             OCCUR     LST1

     C                   EVAL      TEXT = '4-piece combo kit'

     C     2             OCCUR     LST1

     C                   EVAL      TEXT = '3-speed transmission'

      *

     C                   EVAL      ListDefSize  = %SIZE(ListDef1:*ALL)

     C                   EVAL      ListEntSize  = %SIZE(LST1)

     C                   EVAL      ListCount    = 2

     C                   EVAL      ListMaxCount = %ELEM(LST1)

     C                   CALLB(D)  'JSMX_BINDLST'

     C                   PARM                    JSMHDL

     C                   PARM                    ListDef1

     C                   PARM                    ListDefSize

     C                   PARM                    LST1

     C                   PARM                    ListEntSize

     C                   PARM                    ListCount

     C                   PARM                    ListMaxCount

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * ADD CONTENT

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'ADD' +

     C                                      ' CONTENT(product)'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * CLOSE

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'CLOSE'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SERVICE_UNLOAD

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SERVICE_UNLOAD'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * JSMX_CLOSE

      *

     C                   CALLB(D)  'JSMX_CLOSE'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * JSMX_END

      *

     C                   CALLB(D)  'JSMX_END'

      *

     C                   SETON                                        LR

 

**CTDATA FieldDef1

PRDID                                             A000001000

PRDAVL                                            A000020000

PRDDSC                                            A000020000

PRDAMTMP                                          P000001002

PRDAMTYP                                          P000001002

PRDAMTB10                                         P000001002

PRDAMTB20                                         P000001002

PRDAMTB30                                         P000001002

PRDCOUNT                                          S000000300

PRDDATE                                           A000001000

PRDDATETIME                                       A000002600

**CTDATA ListDef1

TEXT                                              A000003000