ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzalu_5.4.0.1/rzaluexternalexmp.htm

298 lines
12 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="dc.language" scheme="rfc1766" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<meta name="dc.date" scheme="iso8601" content="2005-09-06" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow"/>
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<title>Example: Using an externally described printer file with an application
program</title>
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
<link rel="stylesheet" type="text/css" href="ic.css" />
</head>
<body>
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
<a name="rzaluexternalexmp"></a>
<h3 id="rzaluexternalexmp">Example: Using an externally described printer file with an application
program</h3>
<p>This example shows how an application program calls and uses an externally
described printer file to control how your printed output will look.</p>
<p>This example consists of:</p>
<ul>
<li>An RPG-coded application program that produces mailing labels.</li>
<li>A printer file that is opened by the application program when the application
program runs.</li>
<li>A detailed listing of which parameters from the printer file are used
by the application program and at what point during the processing of the
application program they are used.</li>
<li>A detailed listing of the DDS keywords and an explanation of which DDS
keywords are used by the mailing label application program.</li></ul>
<p>This is the RPG-coded application program. The numbers within the program
correspond to the list on the following pages. That list explains how this
program works and specifically how the program opens and uses the printer
file.</p>
<ul>
<li>Part <span class="bold">(1)</span> opens the printer file.</li>
<li>Part <span class="bold">(2)</span> sends the output to the designated output
queue.</li>
<li>Part <span class="bold">(3)</span> closes the opened files.</li>
<li>Part <span class="bold">(4)</span> processes the data.</li></ul>
<p><span class="bold">Note:</span> Read the <a href="rzalucodedisclaimer.htm#rzalucodedisclaimer">Code disclaimer information</a> for
important legal information.</p>
<p></p>
<pre class="xmp">************************************************************************
FADDRESS IF E K DISK
<span class="bold">(1)</span> FLABELPR3O E PRINTER
************************************************************************
CTAR 20 1
CSAR 30 1
STAR 2 1
ZPAR 8 1
READ ADDRESS 10
************************************************************************
WRITEHEADNG
*IN10 DOWEQ'0'
EXSR CKCITY
<span class="bold">(2)</span> WRITEDETAIL1
ADD2 IFNE *BLANKS
WRITEDETAIL3
END
WRITEDETAIL4
READ ADDRESS 10
END
************************************************************************
************************************************************************
<span class="bold">(3)</span> MOVE '1' *INLR
************************************************************************
CKCITY BEGSR
MOVEA*BLANKS CTAR
MOVEA*BLANKS STAR
MOVEA*BLANKS ZPAR
MOVEA*BLANKS CSAR
MOVEACITY CTAR
MOVEAST STAR
MOVEAZIP ZPAR
Z-ADD1 X 20
Z-ADD1 Y 20
EXSR LOOKBL 1ST WORD</pre><p class="indatacontent"> </p>
<pre class="xmp"> ADD 1 X
CTAR,X IFGT *BLANKS 2ND WORD
MOVE ' ' CSAR,Y
ADD 1 Y
EXSR LOOKBL
ADD 1 X
CTAR,X IFGT *BLANKS 3RD WORD
MOVE ' ' CSAR,Y
ADD 1 Y
<span class="bold">(4)</span> EXSR LOOKBL
END
END
MOVE ',' CSAR,Y
ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
MOVE STAR,1 CSAR,Y
ADD 1 Y
MOVE STAR,2 CSAR,Y
ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
Z-ADD1 X
X DOWLT9
MOVE ZPAR,X CSAR,Y
ADD 1 Y
ADD 1 X
END
MOVEACSAR CTSTZP 30
MOVEACSAR CTSTZ2 30
ENDSR
LOOKBL BEGSR
CTAR,X DOWGT*BLANKS
MOVE CTAR,X CSAR,Y
ADD 1 X
ADD 1 Y
END
ENDSR
******************************************************************</pre>
<p><span class="bold">Open processing</span></p>
<p></p><blockquote>Part <span class="bold">(1)</span> of the application program opens files
that are called by the application program. Among those, and of particular
interest at this point, is the printer file whose name is LABELPR3. You can
locate LABELPR3 next to <span class="bold">(1)</span> in the program listing.
<p>A printer file is opened to prepare the system so that the application can
put data into a spooled file or print it out directly to a printer. Information
from the high-level language application program, the printer file, and any
printer file overrides is combined.</p>
<p>The printer file open operation
is controlled by parameters specified in the printer file, in the high-level
language program, and in printer file overrides (through the OVRPRTF command).
See <a href="rzaluoverride.htm#rzaluoverride">Printer file overrides</a> for more information on overrides.</p>
<p>As an example, if the printer file specified lines per inch (LPI) of 8, and
an Override with Printer File (OVRPRTF) command specified an LPI of 6, the
LPI of 6 would be used since the override value specified by the OVRPRTF command
takes precedence over the LPI value specified in the printer file.</p>
<p>The following list contains parameters from the printer file LABELPRT. These
are the parameters that the application program accesses or looks at when
it opens the printer file. They are the majority of the parameters in the
printer file, but not all of them. When the application looks at each parameter,
it finds a value specified for each parameter. For a description of each
parameter, see the Create Printer File (<a href="../cl/crtprtf.htm">CRTPRTF</a>)
CL command. </p>
<pre class="xmp">FILE
DEV
DEVTYPE
CVTLINDTA
PAGESIZE
LPI
UOM
CPI
OVRFLW
RPLUNPRT
FIDELITY
CTLCHAR
PRTQLTY
FORMFEED
DRAWER
OUTBIN
FONT
CHRID
DECFMT
FNTCHRSET
CDEFNT
PAGDFN
FORMDF
AFPCHARS
TBLREFCHR
PAGRTT
PRTTXT
JUSTIFY
DUPLEX
IPDSPASTHR
USRRSCLIBL
CORNERSTPL
EDGESTITCH
SADLSTITCH
FNTRSL
SPOOL
SCHEDULE
USRDTA
SPLFOWN
USRDFNOPT
USRDFNDTA
USRDFNOBJ
IGCDTA
IGCEXNCR
IGCCHRTT
IGCCPI
IGCSOSI
IGCCDEFNT
WAITFILE
SHARE
LVLCHK
AUT
TEXT</pre></blockquote>
<p><span class="bold">Output processing</span></p>
<p></p><blockquote>Part <span class="bold">(2)</span> of the application program performs
the operations of reading, compiling, and sending the output to the output
queue specified in the OUTQ parameter of the CRTPRTF command, or to the printer
specified in the DEV parameter of the CRTPRTF command. In this example, the
SPOOL parameter has a value of (*YES), which means the output will become
a spooled file in the designated output queue.
<p>The following printer file
parameters from the CRTPRTF command are parameters that are looked at by the
application program during the output processing. The DDS is compiled before
the application program runs. The application program never looks at the DDS
file and member, only at the compiled results.</p>
<p>Since this example uses
DDS, look at <span class="bold">(1)</span> in the program listing and see that
the name of the printer file is LABELPR3. LABELPR3 was compiled using the
source from the member and file that are listed here. </p>
<pre class="xmp">SRCFILE
SRCMBR
FOLD
ALIGN
CHLVAL
PRTTXT
REDUCE
MULTIUP
FRONTMGN
BACKMGN
FRONTOVL
BACKOVL
MAXRCDS
DFRWRT
OPTION
GENLVL</pre></blockquote>
<p><span class="bold">Data description specifications</span></p>
<p></p><blockquote>Below is the example of the compiled DDS used by the RPG program. You
can update the DDS; however, you must then recompile it.
<p></p>
<pre class="xmp">000100900115 R HEADNG
000200900115 3 2'MAILING LABELS'
000300900115
000400900115 R DETAIL1
000500900115 NAME 25 2 2UNDERLINE
000600900115 ADD1 25 3 2
000700900115 R DETAIL3
000800900115 ADD2 25 2SPACEB(1)
000900900115 R DETAIL4
001000900115 CTSTZP 30 2HIGHLIGHT SPACEB(1)</pre>
<p>This example uses three DDS keywords: SPACEB, UNDERLINE, and
HIGHLIGHT.</p>
<p>DDS and its associated keywords can only be used if the
SRCFILE parameter contains the name of the file and the SRCMBR parameter
contains the name of the member that the DDS source resides in.</p>
<p>For
a description of DDS keywords for printer files and more detailed information
on DDS source files, see <a href="../rzakd/kickoff.htm">DDS Reference: Printer files</a> in the Programming category.</p></blockquote>
<p><span class="bold">Close processing</span></p>
<p></p><blockquote>Part <span class="bold">(3)</span> of the application program performs
the close operations of the application program.
<p>When the application program
has finished the output processing part of the application program, it performs
a close operation on all the files it opened during the open processing of
the application program.</p>
<p>The application program looks at the SCHEDULE
parameter from the CRTPRTF command during the close portion of the application
program.</p></blockquote>
<p><span class="bold">Output from the example</span></p>
<p></p><blockquote>
<pre class="xmp"><span class="underlined">Ann White</span>
Box 123
RR 1
<span class="bold">Anytown, IA 12345</span>
<span class="underlined">Tom Smith</span>
123 Main St.
<span class="bold">Somewhere, IN 54321</span></pre></blockquote>
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
</body>
</html>