What CoolSpools can do..

Download Report

Transcript What CoolSpools can do..

Creating professional PDF documents from
basic Spool Files, utilising report definitions,
maps and dynamic use of images.
(CVTSPLDBF & CVTSPLPDF)
Scenario:
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
 There is a Vehicle Stock Report and a professional document is required.
Scenario:
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
 From the Vehicle Stock Report you want to create a .PDF document as below:-
Scenario:
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
 The PDF document is to be produced, with the following : Company logo at the top of each page.
 Footer showing Car Make and Page Number.
 Bookmarks for quick access to each Make of Car.
 Distinctive Column Headings.
 Each different Make of Car on a separate page with it’s own badge.
 Spooled Data in a new font.
 Overall professional PDF document to publish.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
The creation of the .PDF document, is carried out in stages.
A
iSeries Spooled
File
CVTSPLDBF
Pages
Nos. &
Car
Makes
B
Report
Map A
Report
Map B
Loop through dB file
‘A’ to create a dynamic
INCLFILE parameter
for the CVTSPLPDF
command.
iSeries Spooled
File
iSeries Spooled
File
Car
Makes
Page Nos.
Report
Fields
CVTSPLDBF
Create a basic version
of the spool file,
stripping out the
headers.
CVTSPLPDF
A
Pages
Nos.
& Car
Makes
B
Car
Makes
Page Nos.
Report
Fields
CVTSPLPDF
CVTSPLDBF
The
file (B),
(A), is
created
used
to create
extract
earlier, isis
earlier
Car completed
read
used
the
Summarised
Makes,
record
to create
Page
by a
Pagedocument.
Numbers
record,
new
PDF
basic
Numbers
and
spool It
and with
Report
dynamically
file,
uses
Car
a logo
Fields.
Makes
no with
fromextracted
The
building
header
headings,
thethe
iSeries
spool
Spool
data
INCLFILE
information
file
data,
isFile
used
pre– and
latera
Vehicle
to
parameter.
footer
defined
define
containing
Stock
Car
the
This
Make
is
Report.
bookmarks
used
the
images
Car
to and
Make.
establish
Thefor
a
extracted
each
which
This
.TTF
spool
Font
Car
CarMake.
data
for
Make
filethe
isis
logo iswith
used
report
todata.
toestablish
be
theThe
what Car
printed
CVTSPLPDF
command
atMake
the
alsotop
logos
of
command
uses
each
the
arepage.
Car
to
at be
the
displayed
end
Make
oftothe
provide
at the
top of each page.
process.
Bookmarks.
Press any key.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
A report definition will be created, @ABC_RPT.
 To Create the Report Definition, either WRKRPTDFN is used, then F6, or
CRTRPTDFN.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 WRKRPTDFN is used to define the content of the report definitions
@ABC_RPT.
 The report ABC_STOCK has to have run and the spool file be available. Select
the report definition to design by entering ‘11’ next to the report definition.
 Locate the Spooled file you are defining (ABC_STOCK), and select it.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 When the spool file has been located, select it by taking option ‘1’.
 The report definition can now be created.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 Once the Spooled File (ABC_STOCK) has been selected, lines, sections and
items can be defined.
 To extract the Page Number, a line has to be defined.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 To define the first line for the Page Numbers, within this report definition
(@ABC_RPT), the cursor is positioned on the title line (line 1) and F10 is pressed.
 The Line name is set to PAGELINE1.
 F9 is pressed to save the Report Line.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 When you have saved PAGELINE1, the report definition will be updated.
PAGELINE1 will be highlighted in pink.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 To define the second line for the Car Makes, within this report definition
(@ABC_RPT), the cursor is positioned on the line 3 and F10 is pressed.
 The Line name is set to CARMAKE1.
 F9 is pressed to save the Report Line.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 When CARMAKE1 has been saved, the report definition will be updated.
 CARMAKE1 will be highlighted in pink.
 Now that the lines have been defined, a section needs to be created for the two
lines.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 To create the section, the cursor is positioned on Line 1 and F11 is pressed.
 The section is named S_PAGEMAKE.
 Start Line is PAGELINE1, End Line is CARMAKE1.
 Included Lines are PAGELINE1, CARMAKE1.
 F9 is pressed to save the section.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 To get the Page Number from the report line, a report item has to be defined.
 F15 is used, from the Report Definition screen, to Work with Lines.
 To add the Page Number item, PAGELINE1 is selected and option 9 is entered.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 F6 is used to add the new Report item.
 An item name is specified along with the line and section.
 The character position and length is specified to extract the page number.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 To get the Car Make from the report line, a report item has to be defined.
 F15 is used, from the Report Definition screen, to Work with Lines.
 To add the Car Make item, CARMAKE1 is selected and option 9 is entered.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 F6 is used to add a new Report item.
 An item name is specified along with the line and section.
 The character position and length is specified to extract the car make.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 Now the report definition @ABC_RPT has been defined, a map has to defined,
for use with the CVTSPLDBF command.
 To create the map, WRKRPTDBF is used.
 F6 creates a map.
 When enter is pressed, Report Items are assigned.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 (1) PAGENO1 and (2) CARMAKE1, are selected to be included in the map.
 The first Spool file  Database map has been created.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting summarised Page Numbers and Car Makes.
 CVTSPLDBF is then used to create a summary of Page Numbers and Car
Makes.
 The resulting database file created will look as follows.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 A report definition will be created, @ABC_RPT2.
 To Create the Report Definition, either WRKRPTDFN is used, then F6, or
CRTRPTDFN.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 WRKRPTDFN is used to define the content of the report definitions
@ABC_RPT2.
 The report ABC_STOCK has to have run and the spool file be available. Select
the report definition to design by entering ‘11’ next to the report definition.
 Locate the Spooled file you are defining (ABC_STOCK), and select it.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 When the spool file has been located, it is selected by taking option ‘1’.
 The report definition can now be created.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 Once the Spooled File (ABC_STOCK) has been selected, the lines, sections
and items can be defined.
 To extract the Page Number, a line has to be defined.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 To define the first line for the Page Numbers, within this report definition
(@ABC_RPT2), the cursor is positioned on the title line (line 1) and F10 is
pressed.
 The Line name is set to PAGELINE2.
 F9 is pressed to save the Report Line.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 When you have saved PAGELINE2, the report definition will be updated.
PAGELINE2 will be highlighted in pink.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 To define the second line for the Car Makes, within this report definition
(@ABC_RPT2), position the cursor on the title line (line 1) and press F10.
 The Line name is set to CARMAKE2.
 F9 is pressed to save the Report Line.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 When CARMAKE2 has been saved, the report definition will be updated.
 CARMAKE2 will be highlighted in pink.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 To define the third line for the detail, within this report definition (@ABC_RPT2),
the cursor is positioned on line 7 and F10 is pressed.
 The Line name is set to DETAIL2.
 F9 is pressed to save the Report Line.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 When DETAIL2 has been saved, the report definition will be updated.
 DETAIL2 will be highlighted in pink.
 Now that the lines have been defined, a section needs to be created for the
three lines.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 To create the section, the cursor is positioned on Line 1 and F11 is pressed.
 The section is named S_PMD.
 Start Line is PAGELINE2, End Line is DETAIL2.
 Included Lines are CARMAKE2, DETAIL2 and PAGELINE2.
 F9 is pressed to save the section.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 To get the Page Number from the report line, a report item has to be defined.
 F15 is used, from the Report Definition screen, to Work with Lines.
 To add the Page Number item, PAGELINE2 is selected by entering option 9.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 F6 is used to add a new Report item.
 An item name is specified along with the line and section.
 The character position and length is specified to extract the page number.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 To get the Car Make from the report line, a report item is defined.
 F15 is used, from the Report Definition screen, to Work with Lines.
 The Car Make item is added, by selecting CARMAKE2 and entering option 9.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 F6 is used to add a new Report item.
 An item name is specified along with the line and section.
 The character position and length is specified to extract the car make.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 To get the report fields from the report line, report items have to be defined.
 F15 is used, from the Report Definition screen, to Work with Lines.
 To add the Report Fields, DETAIL2 is selected by entering option 9.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 F6 is used to add a new Report item.
 An item name for the MODEL@ is specified along with the line and section.
 The character position and length is specified to extract the Model.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 F6 is used to add a new Report items for the following.
Report Item
Character Pos.
Character Len.
MILEAGE@
FUELTYPE@
ENGINESZ@
COLOUR@
REGIST@
18
33
48
64
80
7
10
6
15
10
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 Now the report definition @ABC_RPT2 has been defined, a map has to
defined, for use with the CVTSPLDBF command.
 To create the map, WRKRPTDBF is used.
 F6 will create the map.
 When enter is pressed, Report Items are assigned.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 Select
(1) PAGENO2
(3) MODEL@
(5) FUELTYPE@
(7) COLOUR@
 These fields will be included in the map.
(2) CARMAKE2
(4) @MILEAGE
(6) ENGINESZ@
(8) REGIST@
 The second Spool file  Database map has been created.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Extracting Page Numbers, Car Makes and Report Fields.
 CVTSPLDBF is then used to create a database file of Page Numbers, Car
Makes and Report fields.
 The resulting database file created will look as follows.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Dynamically build the INCLFILE parameter.
 Within the controlling CL program, a variable is used to store the CVTSPLPDF
command.
 At this stage, the contents of the command contains the following.
CVTSPLPDF FROMFILE(ABC_STOCK2) SPLNBR(*LAST)
STMFOPT(*REPLACE) EMAIL(*YES) EMAILTO(([email protected]))
BOOKMARK(*KEY) BMARKPOS((64 21 9))
BMARK KEY(('STOCK LIST FOR :' * FIRSTPAGE 16 9))
CVTFONTID(((*CPI) ('/HOME/LORDG/TALL_LEAN.TTF' 18)))
INCLFILE(('/HOME/LORDG/ABC_MOTORS.JPG' *JPG *EMBEDDED
* ALL 170 28 *MM *NONE *NONE 1)
('/HOME/LORDG/ABC_MOTORS2.JPG' *JPG *EMBEDDED *ALL 2
26 *MM *NONE *NONE 1)
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Dynamically build the INCLFILE parameter.
 The following piece of code is required to dynamically add to the INCLFILE
parameter.
 Database file ‘A’ that was created earlier, is used to add a jpg to the parameter for
each entry within the file.
RCVF
MONMSG
CHGVAR
CHGVAR
CHGVAR
GOTO
ENDMAKE :
MSGID(CPF0864) EXEC(GOTO CMDLBL(END_MAKE))
VAR(&BADGE) VALUE(&MAKEOFCAR *TCAT &JPG)
VAR(&PGN)
VALUE(&PAGENO)
VAR(&THECMD) VALUE(&THECMD *TCAT &SOB *TCAT +
&SQ *TCAT &MAKE1 *TCAT &BADGE *TCAT &SQ +
*TCAT &MAKE2 *TCAT &PAGENO *TCAT &SCB)
CMDLBL(GET_MAKE)
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Create a basic spool file without the headers.
 To enable the CVTSPLPDF command, to show the detail from the report and not
the report headings, a new basic spool file required.
 A print file is created (ABC_STOCK2).
R HDR
13
R DTLR
MODEL@
MILEAGE@
FUELTYPE@
ENGINESZ@
COLOUR@
REGIST@
15
7
10
6
15
10
1 ' '
8
20
33
49
61
70
SPACEA(2)
R PAGN
CARMAKE2
#PAGE
20
4
0
64 7'Stock List for :'
64 22
64 74'Page :'
64 80 EDTCDE(4)
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Create a basic spool file without the headers.
 To create the basic spool file a simple RPG program is created.
FABC_STOCK2O
E
FABC_STK2 IF
E
D
DS
D
c
movel
c
movel
c
read
*
* Check for change of page
*
c
if
c
write
c
endif
*
c
dow
c
write
c
movel
c
movel
c
read
PRINTER OFLIND(*IN99)
DISK
rename(ABC_STK2:@ABCSTCK2)
'9999'
'****'
abc_stk2
PAGE_TEMP
MAKE_TEMP
4
20
88
page_temp <> PAGENO2
hdr
*in88 = '0'
DTLR
PAGENO2
CARMAKE2
abc_stk2
page_temp
make_temp
88
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Create a basic spool file without the headers.
 RPG program continued.
c
*
* Check for change
*
c
c
c
c
c
c
*
c
c
c
*
* Program End
*
C
C
read
abc_stk2
88
of page
if
movel
movel
write
write
endif
enddo
movel
write
MOVE
RETURN
page_temp <> PAGENO2
page_temp
#page
make_temp
carmake2
pagn
hdr
page_temp
pagn
#page
'1'
*INLR
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Create a basic spool file without the headers.
 The basic spool file is created as follows.
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Using CVTSPLPDF to create the PDF document.
 Before the PDF document can be produced, the following needs to be placed on
the iSeries within the Integrated File System (IFS).
o
o
o
o
Tall and Lean True Type Font (TALL_LEAN.TTF), this can be downloaded from the internet.
The header image showing the Company logo and column heading (ABC_MOTORS.JPG), needs copying to the IFS.
The footer image showing a separator line and the bottom of the page (ABC_MOTORS2.JPG), needs copying to the
IFS.
All Car Make Badge logos needs copying to the IFS.
 The command will then be passed to the program QCMDEXC as follows.
o
CVTSPLPDF FROMFILE(ABC_ST OCK2) SPLNBR(*LAST) STMFOPT(*REPLACE)
EMAIL(*YES) EMAILTO(([email protected])) BOOKMARK(*KEY) BMARKPOS((64 21 9))
BMARK KEY(('STOCK LIST FOR :' * FIRSTPAGE 16 9))
CVTFONTID(((*CPI) ('/HOME/LORDG/T ALL_LEAN.TTF' 18)))
INCLFILE.......... (INCLFILE contains all the images)
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Using CVTSPLPDF to create the PDF document.

The complete CL program is as follows.
PGM /* DECLARE FILE FOR READING IN PAGE NUMBERS AND MAKE OF CARS */
DCLF
FILE(CS_GLLIB/ABC_STK)
/* DECLARE &SP - SPACE */
DCL
VAR(&SP) TYPE(*CHAR) LEN(1) VALUE(X'40')
/* DECLARE &SQ - SINGLE QUOTE ' */
DCL
VAR(&SQ) TYPE(*CHAR) LEN(1) VALUE(X'7D')
/* DECLARE &DCB - DOUBLE CLOSE BRACKET */
DCL
VAR(&DCB) TYPE(*CHAR) LEN(2) VALUE('))')
/* DECLARE &SCB - SINGLE CLOSE BRACKET */
DCL
VAR(&SCB) TYPE(*CHAR) LEN(1) VALUE(')')
/* DECLARE &SOB - SINGLE OPEN BRACKET */
DCL
VAR(&SOB) TYPE(*CHAR) LEN(2) VALUE(' (')
/* DECLARE &CMDL - PARAMETER NEED FOR THE QCMDEXC CALL */
DCL
VAR(&CMDL) TYPE(*DEC) LEN(15 5) VALUE(6000)
/* DECLARE &THECMD - PARAMETER USED TO PROCESS THE COMMAND */
DCL
VAR(&THECMD) TYPE(*CHAR) LEN(6000)
/* DECLARE &TITLE1/2 - LOGO IMAGE AT THE TOP OF EACH PAGE */
DCL
VAR(&TITLE1) TYPE(*CHAR) LEN(100) +
VALUE('/HOME/LORDG/ABC_MOTORS.JPG')
DCL
VAR(&TITLE2) TYPE(*CHAR) LEN(100) VALUE(' +
*JPG *EMBEDDED *ALL 170 28 *MM *NONE +
*NONE 1')
/* DECLARE &FOOTER1/2 - LOGO IMAGE AT THE FOOT OF EACH PAGE */
DCL
VAR(&FOOTER1) TYPE(*CHAR) LEN(100) +
VALUE('/HOME/LORDG/ABC_MOTORS2.JPG')
DCL
VAR(&FOOTER2) TYPE(*CHAR) LEN(100) VALUE(' +
*JPG *EMBEDDED *ALL 2 26 *MM *NONE *NONE 1')
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Using CVTSPLPDF to create the PDF document.
 The complete CL program continued.
/* DECLARE &MAKE1/2 - BASIS OF EACH IMAGE PATH */
DCL
VAR(&MAKE1) TYPE(*CHAR) LEN(100) +
VALUE('/HOME/LORDG/')
DCL
VAR(&MAKE2) TYPE(*CHAR) LEN(100) VALUE(' +
*JPG *EMBEDDED *PAGNBR 170 3 *MM *NONE +
*NONE .5 *NONE *ABS *FIRST *KEEP ')
/* DECLARE &INCLF - BASIS OF EACH INCLFILE PARAMETER, FOR THE IMAGES */
DCL
VAR(&INCLF) TYPE(*CHAR) LEN(1024)
DCL
VAR(&PATH1) TYPE(*CHAR) LEN(5000) VALUE(' +
INCLFILE((')
/* DECLARE &BADGE - THE NAME OF THE JPG FOR THE CAR MAKE IMAGE */
DCL
VAR(&BADGE) TYPE(*CHAR) LEN(30)
DCL
VAR(&JPG) TYPE(*CHAR) LEN(4) VALUE('.JPG')
/* DECLARE &PGN - THE PAGE NUMBER WHERE THE CAR MAKE IMAGES WILL APPEAR */
DCL
VAR(&PGN) TYPE(*DEC) LEN(4 0)
/* DECLARE &THECMD - QCMDEXC WILL BE USED WITH &THECMD TO PROCESS THE */
/*
CVTSPLPDF COMMAND */
DCL
VAR(&THECMD) TYPE(*CHAR) LEN(6000)
/*
/*
/*
/*
/*
SETUP THE CVTSPLPDF COMMAND */
1. SPECIFY THE BASIC SPOOL FILE
*/
2. SPECIFY THE EMAIL ADDRESS
*/
3. USE THE REPORT FOOTER (CAR MAKE) FOR BOOKMARKS
*/
4. USE THE TALL AND LEAN TRUE TYPE FONT FOR THE REPORT DETAIL */
CHGVAR
VAR(&THECMD) VALUE('CVTSPLPDF +
FROMFILE(ABC_STOCK2) SPLNBR(*LAST) +
STMFOPT(*REPLACE) EMAIL(*YES) +
EMAILTO(([email protected])) +
BOOKMARK(*KEY) +
BMARKPOS((64 21 9)) BMARKKEY((''STOCK +
LIST FOR :'' *FIRSTPAGE 16 9)) +
CVTFONTID(((*CPI) +
(''/HOME/LORDG/TALL_LEAN.TTF'' 18)))')
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Using CVTSPLPDF to create the PDF document.
 The complete CL program continued.
/* ADD THE HEADER AND FOOTER IMAGES TO PATH1. &PATH1 WILL BE USED IN &THECMD */
CHGVAR
VAR(&PATH1) VALUE(&PATH1 *TCAT &SQ *TCAT +
&TITLE1 *TCAT &SQ *TCAT &TITLE2 *TCAT &SCB)
CHGVAR
VAR(&PATH1) VALUE(&PATH1 *BCAT &SOB *TCAT &SQ +
*TCAT &FOOTER1 *TCAT &SQ *TCAT &FOOTER2 +
*TCAT &SCB)
/* ADD THE &PATH1 TO &THECMD */
CHGVAR
VAR(&THECMD) VALUE(&THECMD *TCAT &PATH1)
/* CREATE SPOOL FILE BEING USED TO CREATE THE PDF DOCUMENT */
CALL
PGM(ABC_STKR1)
/* PAGES AND MAKES */
CVTSPLDBF
FROMFILE(ABC_STOCK) SPLNBR(*LAST) +
MAPNAME(ABC_DB_MAP1) +
TOFILE(CS_GLLIB/ABC_STK) MBROPT(*REPLACE)
/* DETAIL */
/* PAGES AND MAKES */
CVTSPLDBF FROMFILE(ABC_STOCK) SPLNBR(*LAST) +
MAPNAME(ABC_DB_MAP2) +
TOFILE(CS_GLLIB/ABC_STK2) MBROPT(*REPLACE)
/* LOOP THROUGH THE SUMMARISED PAGE NUMBER AND CAR MAKE FILE TO DYNAMICALLY */
/*
BUILD THE INCLFILE PARAMETER */
GET_MAKE:
RCVF
MONMSG
MSGID(CPF0864) EXEC(GOTO CMDLBL(END_MAKE))
CHGVAR
VAR(&BADGE) VALUE(&MAKEOFCAR *TCAT &JPG)
CHGVAR
VAR(&PGN)
VALUE(&PAGENO)
CHGVAR
VAR(&THECMD) VALUE(&THECMD *TCAT &SOB *TCAT +
&SQ *TCAT &MAKE1 *TCAT &BADGE *TCAT &SQ +
*TCAT &MAKE2 *TCAT &PAGENO *TCAT &SCB)
GOTO
CMDLBL(GET_MAKE)
END_MAKE:
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
Using CVTSPLPDF to create the PDF document.
 The complete CL program continued.
/*BUILD NEW BASIC REPORT*/
CALL
PGM(ABC_STKR2)
/* PROCESS THE CVTSPLPDF COMMAND, USING QCMDEXC */
CHGVAR
VAR(&THECMD) VALUE(&THECMD *TCAT &SCB)
CALL
PGM(QCMDEXC) PARM(&THECMD &CMDL)
ENDPGM
Creating professional .PDF documents
from basic Spool Files
(CVTSPLDBF & CVTSPLPDF)
The completed PDF document is shown below.