× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: How do you send HP PCL from COBOL to spool file
  • From: Jon.Paris@xxxxxxxxxx
  • Date: Tue, 11 Jan 2000 11:50:37 -0500



Robert,

you code won't work the way you have it coded.  The defintion of

10 SIG-A1 PIC 9 COMP-4.

should be

10 SIG-A1 PIC X. or PIC X Value X'1B'.

I think if you run the code in debug you will see that the escape value is never
being set.  Your definition has two problems - first the COMP-4 definition will
create not a 1 byte but a two byte field.  Second the Pic 9 definition will
cause the compiler to generate code to truncate the result to a single digit.
So the result of your "Add 16 to 11" is not decimal 27 (X'1B') but decimal 7
(X'07') which since it is in a two byte field will be seen by the printer as
X'0007'.  While there is an option to prevent this truncation from taking place
it would only solve part of the problem.  If you really need to calculate values
into a single byte field you should code it like so:



  01  ConvertToBin.

     05 TwoByte      Pic 9(3) Comp-4 Value Zero.

     05 Filler Redefines BigValue.

        10 Filler    Pic X.

        10 OneByte   Pic X.



            Add 16 to 11 Giving TwoByte.

           Move OneByte to WhereYouNeedIt



Hope this helps.


+---
| This is the COBOL/400 Mailing List!
| To submit a new message, send your mail to COBOL400-L@midrange.com.
| To subscribe to this list send email to COBOL400-L-SUB@midrange.com.
| To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---END



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.