Feb 28, 2006
Using the FIELD Command to Generate Constant Text in Conjunction with an ASCII Data File
Question:
I am printing an ASCII data file using a page definition and form definition to format the pages. To print the data, I use a code page with ASCII character mappings. I want to print some constant text using a FIELD Command. Do I need to code the constant text using ASCII hex values?
Answer:
You can code the constant text string as ASCII hex values. However, it is not necessary to do that. You can simply define a font (or fonts) in your font using the EBCDIC code mappings to print the static text. For example your font list might look like this:
FONT FONT01 CS H40080 CP 000437;
FONT FONT02 CS H40080 CP V10500;
And your FIELD commands might look like this:
PRINTLINE
POSITION 0.00 IN 0.00 IN
REPEAT 1
CHANNEL 1;
FIELD /* ACCOUNT NUMBER TEXT (CONSTANT TEXT) */
TEXT 'Account Number '
POSITION 2.80 IN 12.60 IN
FONT FONT02;
FIELD /* ACCOUNT NUMBER 1st 3 BYTES (FROM DATA) */
START 5
LENGTH 3
POSITION CURRENT CURRENT
FONT FONT01;
FIELD /* ACCOUNT NUMBER DASH (CONSTANT TEXT) */
TEXT '-'
POSITION CURRENT CURRENT
FONT FONT02;
FIELD /* ACCOUNT NUMBER 2nd 4 BYTES (FROM DATA) */
START 8
LENGTH 4
POSITION CURRENT CURRENT
FONT FONT01;
FIELD /* ACCOUNT NUMBER DASH (CONSTANT TEXT) */
TEXT '-'
POSITION CURRENT CURRENT
FONT FONT02;
FIELD /* ACCOUNT NUMBER LAST 3 BYTES (FROM DATA)*/
START 12
LENGTH 3
POSITION CURRENT CURRENT
FONT FONT01;
Check out the Page Printer Formatting Aid (PPFA) reference materials available from IBM at:
http://www.ibm.com/Search/?q=S544-5285&v=11&lang=en&cc=zz&Search.x=37&Search.y=11 .
If you would like additional information on AFP Tips and Techniques, please feel free to contact COPI at: 1-888-999-COPI.
Or, you can also view the archive of past AFP related articles by clicking here.