Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Printing ASCII characters

173 views
Skip to first unread message

Peter Spieker

unread,
Sep 9, 1999, 3:00:00 AM9/9/99
to
Hi,

how can I print ascii character '1B' (ESC) from my AS/400 application
onto a KYOCERA laser printer via LAN (Ethernet)??

Thanks a lot.

Peter
--
Dr. Peter Spieker Tel. +49 (0) 2 51/4 14 62 20
Winkhaus Data GmbH Fax +49 (0) 2 51/4 78 08
Beldensnyderweg 24 mailto:peter....@winkhaus.de
D-48147 Muenster http://www.winkhaus.de/

Blair Hamren

unread,
Sep 9, 1999, 3:00:00 AM9/9/99
to
Peter,
I just did something similar today that may help. I had to send ASCII
control codes to a printer to change the CPI to 17 before printing and back
to 12 CPI when I was done. I did it as follows:

In the DDS for the prtf I defined a record format called INITCPI with 1
field (length 5) called CPISETTING and compiled it using the keyword
RPLUNPRT(*NO).

In the initialization subroutine of my RPGLE program I changed
CPISETTING to X'03031B4918' and did a WRITE INITCPI (1B4918 is the ASCII
string in hex that tells the printer to change to 17 cpi, utility mode).
When my program is done I change the printer back to 12 cpi by changing
CPISETTING to X'03031B4908' and WRITE INITCPI (1B4908 is the ASCII string
in hex that tells the printer to change to 12 cpi, utility mode). The first
2 characters in the hex string are 03 meaning ASCII transparent data
follows, and 03 meaning 3 bytes follow.

Actually the control codes for this were ESC I n where n is 8 for 12 CPI
and 26 for 17 CPI. I had to convert this to hex as follows:
ESC = 1B
I = 49
8 = 08
26 = 18

If you want to send just ESC I for example you would have a 4 character
field as follows:
X'03021B49'

I learned of these through 2 places:

1. a tip in http://www.bsing.com/bo400ng/as400asciirpg.htm
2. an IBM manual at
http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/QB3AUJ02/APPENDIX1.5.1

Hope that helps - it took me a few days to get this right (it didn't help
that I had the control codes for the wrong printer at first). If you need
more help you can email me but get rid of the NOSPAM in my email.

Blair Hamren


Peter Spieker <spi...@winkhaus.de> wrote in message
news:37D7A3E2...@winkhaus.de...

peter

unread,
Sep 9, 1999, 3:00:00 AM9/9/99
to
You cannot. Somwhere the AS/400 is converting the X'1B' into blanks. I have
tried it but cannot get it to work.
Now I use a PC with IdeaCom, send X'70' and let the PC software convert this
hex 70 into hex 1B. It works but does not win a price.

--
Peter

http://www.prym.nl
pe...@prym.nl

============================================================================
==========

Dietmar Vill

unread,
Sep 10, 1999, 3:00:00 AM9/10/99
to
Hello,

there are two ways to go:

1. Using hex-ASCII-codes (this can be found in an older thread:)

There is a DDS-keyword "TRNSPY" for printerfiles (ASCII-Transparency).

You can define fields with hex-ascii-values. They are transfered to the
printer without changing.

It could be easier to put the Escape-sequences into a WSCST-object, if
you need them only to set some initial settings.

Here is a short example for the DDS-file:

A INDARA
A R PRINT1
A FELD1 30A 2 1
A FELD2 30A 2 33
A TRNSPY
A FELD3 30A 2 33
A FELD4 30A 3 33
A TRNSPY
A FELD5 30A 3 33

The fields FELD2 and FELD4 are used to transfer ascii-hex-values. The
printerfile must be generated with the option RPLUNPRT(*NO).


2. Using Kyocera-functionality

Kyocera-Laserprinter offer a special printer-language called PRESCRIBE,
which you can easily use with the as/400.

The sequence !R! works as ESCAPE-command, all commands are pure
ascii-texts.


Hope this helps.
Dietmar Vill

Peter Spieker schrieb:

Henrik V Eriksson

unread,
Sep 12, 1999, 3:00:00 AM9/12/99
to
If you use internal printerfiles in your program, you can use the following:

Print:
X'03' X'nn' "Your ascii characters" (Where nn = number of ascii characters)

Example:
To send X'1B' to your printer, print the following:

X'03011B'

Best regards

Henrik V Eriksson
Denmark

web: www.image.dk/~hve
mail: h...@image.dk


Peter Spieker skrev i meddelelsen <37D7A3E2...@winkhaus.de>...

Nick Roux

unread,
Sep 13, 1999, 3:00:00 AM9/13/99
to
Peter,

You can tell the 400 not to translate the characters. Have a look at
my web page at
http://home.yebo.co.za/~10302602/tipprtpcl.html
for more information.

Nick

On Thu, 9 Sep 1999 23:59:00 +0200, "peter" <pe...@prym.nl> wrote:

>You cannot. Somwhere the AS/400 is converting the X'1B' into blanks. I have
>tried it but cannot get it to work.
>Now I use a PC with IdeaCom, send X'70' and let the PC software convert this
>hex 70 into hex 1B. It works but does not win a price.


---------------------------------
mailto:Nick...@Bigfoot.Com
http://www.bigfoot.com/~nick.roux

./spam>/dev/null
---------------------------------

0 new messages