|
 |
AFP Example
This example program is a very basic project tracking application.
I think the most useful part of this example is the *AFPDS printer output
created. It uses the AFP keywords for drawing boxes, vertical & horizontal
lines, multiple font changes and rotating text. This is all done with out
the use of any add-on products. If you download the Iseries save file
I have included data so that you will be able to see the output first
hand.
Just remember to compile the print file with the DEVTYPE(*AFPDS)
DOWNLOAD
IBM Sample AFP programs(DDS)
Download text files
Download Iseries save file
Figure 1.
Figure 2.
Print file source
A*%%***********************************************************************
A*%%TS RD 20010621 102326 JAMIEF REL-V4R4M0 5769-PW1
A*%%FI+10660100000000000000000000000000000000000000000000000000
A*%%FI 0000000000000000000000000000000000000000000000000
A*%%***********************************************************************
*
*
*
* DESCRIPTION: SAMPLE AFP KEYWORD USAGE
*
* CREATE COMMAND: CRTPRTF FILE(mylib/printfile)
* SRCFILE(mylib/QDDSSRC)
* DEVTYPE(*AFPDS)
*
* DRAW A BOX
*
A R DRAWBOX
A*%%***********************************************************************
A*%%RI 00000
A*%%***********************************************************************
A BOX(&STRY &STRX &ENDY &ENDX &LW)
A STRY 5S 3P
A STRX 5S 3P
A ENDY 5S 3P
A ENDX 5S 3P
A LW 5S 3P
*
* DRAW A HORIZONTAL LINE
*
A R HRZLINE
A*%%***********************************************************************
A*%%RI 00000
A*%%***********************************************************************
A LINE(&STRY &STRX &LLEN *HRZ &LW)
A STRY 5S 3P
A STRX 5S 3P
A LLEN 5S 3P
A LW 5S 3P
*
* DRAW A VERTICAL LINE
*
A R VRTLINE
A*%%***********************************************************************
A*%%RI 00000
A*%%***********************************************************************
A LINE(&STRY &STRX &LLEN *VRT &LW)
A STRY 5S 3P
A STRX 5S 3P
A LLEN 5S 3P
A LW 5S 3P
*
* DRAW TEXT USING A CODED FONT
*
A R TEXTFONT
A*%%***********************************************************************
A*%%RI 00000
A*%%***********************************************************************
A P1PRJ 30A
A FONT(16951 (*POINTSIZE 36))
A POSITION(&Y &X)
A Y 5S 3P
A X 5S 3P
*
* DRAW TEXT ROTATED 90 DEGREES
*
A R ROTTEXT
A*%%***********************************************************************
A*%%RI 00000
A*%%***********************************************************************
A TEXT 30A
A TXTRTT(90)
A FONT(2304 (*POINTSIZE 16))
A POSITION(&Y &X)
A Y 5S 3P
A X 5S 3P
A*
A* REPORT
A*
A R REPORT
A*%%***********************************************************************
A*%%RI 00000
A*%%FS 004
A*%%***********************************************************************
A FONT(2304 (*POINTSIZE 15))
A 5 8
A 'Code400 IT Projects'
A*
A FONT(2304 (*POINTSIZE 20))
A P1PROJECT 6A O 5 65
A*
A* Programmer
A*
A FONT(2304 (*POINTSIZE 20))
A 12 8
A 'Assigned To:'
A FONT(2304 (*POINTSIZE 15))
A P1USER 10A O 12 21
A FONT(2304 (*POINTSIZE 15))
A*
A* Notes:
A*
A 14 8
A 'Notes:'
A FONT(16951 (*POINTSIZE 25))
A P1NOTE1 50A O 16 8
A FONT(16951 (*POINTSIZE 15))
A P1NOTE2 50A O 17 8
A FONT(16951 (*POINTSIZE 15))
A P1NOTE3 50A O 18 8
A FONT(16951 (*POINTSIZE 15))
A P1NOTE4 50A O 19 8
A FONT(16951 (*POINTSIZE 15))
A P1NOTE5 50A O 20 8
A FONT(16951 (*POINTSIZE 15))
A P1NOTE6 50A O 21 8
A FONT(16951 (*POINTSIZE 15))
A*
A* Start the defining fields section
A*
A 26 8
A 'Project Definition'
A FONT(16951 (*POINTSIZE 25))
A 26 42
A 'Comments:'
A FONT(16951 (*POINTSIZE 25))
A*
A* Project definition - all fields:
A*
A 29 8
A 'Category . . . . :'
A FONT(2304 (*POINTSIZE 10))
A P1CAT 10A O 29 20
A FONT(2304 (*POINTSIZE 10))
A*
A 31 8
A 'Department . . . :'
A FONT(2304 (*POINTSIZE 10))
A P1DEPT 10A O 31 20
A FONT(2304 (*POINTSIZE 10))
A*
A 33 8
A 'Date Assigned . :'
A FONT(2304 (*POINTSIZE 10))
A P1ADATE 8 0O 33 20
A FONT(2304 (*POINTSIZE 10))
A EDTWRD(' / / ')
A*
A 35 8
A 'Date Due . . . . :'
A FONT(2304 (*POINTSIZE 10))
A P1DDATE 8 0O 35 20
A FONT(2304 (*POINTSIZE 10))
A EDTWRD(' / / ')
A*
A 37 8
A 'Priority . . . . :'
A FONT(2304 (*POINTSIZE 10))
A P1PTY 2 0O 37 20
A FONT(2304 (*POINTSIZE 10))
A*
A* The last 4 approval fields
A*
A 40 7
A 'Date Complete:'
A FONT(2304 (*POINTSIZE 08))
A*
A 43 7
A 'QC Approved:'
A FONT(2304 (*POINTSIZE 08))
A*
A 46 7
A 'User Approval:'
A FONT(2304 (*POINTSIZE 08))
A*
A 49 7
A 'Date Installed:'
A FONT(2304 (*POINTSIZE 08))
A*%%***********************************************************************
A*%%SS
A*%%SN P1PROJECT xxxxxx
A*%%CL 007
A*%%CL 002
A*%%CL 002
A*%%CL 001
A*%%CL 001
A*%%CL 001
A*%%CL 001
A*%%CL 001
A*%%CL 005
A*%%CL 003
A*%%CL 002
A*%%CL 002
A*%%***********************************************************************
A*
*
* EJECT THE CURRENT PAGE
*
A R PAGEND
A*%%***********************************************************************
A*%%RI 00000
A*%%***********************************************************************
A ENDPAGE
A*%%***********************************************************************
A*%%CP+999CRTPRTF
A*%%CP+ FILE(JJFLIB/APFP)
A*%%CP+ DEVTYPE(*SCS)
A*%%CP PAGESIZE(*N 198 *N )
A*%%***********************************************************************
|
| |
| |
Suggestions ©
Monday May 12, 2008 @ 7:56 AM
|
|