HP3000-L Archives

December 1996, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Stigers, Gregory - ANDOVER" <[log in to unmask]>
Reply To:
Stigers, Gregory - ANDOVER
Date:
Thu, 12 Dec 1996 10:21:43 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (54 lines)
Be aware (be very aware) that using octal values such as %33 makes your
code non-standard, and thus essentially unportable. If using the octal
strings seems the best solution to you, isolate them so that any code
using them gets them from one place. Then, if you need to port or
reengineer, you would only have to rework that single part in one place
rather than 27 places. Even that is not my idea of fun, but I have watch
COBOL systems stagnate because of some portability problem that others
felt were insurmountable.

>----------
>From:  Jeff Kell[SMTP:[log in to unmask]]
>Sent:  Wednesday, December 11, 1996 7:58 PM
>To:    [log in to unmask]
>Subject:       Re: [HP3000-L] cobol
>
>Curt Brimacomb wrote:
>> I have a programmer here who (in cobol) want to be able to send escape
>> sequences using the hex code for it.  He knows decimal (pic s9(4) comp
>> value 27) and octal (pic x value %33).
>
>If you do your "decimal", redefine it as pic x filler, pic x esc-code,
>then use "esc-code"; otherwise you get a leading null (you may not
>want).
>
>Easiest way is either do something like:
>   DISPLAY %33 "H" %33 "JTop line of a cleared screen".  (for terminal)
>or STRING %33 "H" %33 "JTop line of a cleared screen"
>       DELIMITED BY SIZE INTO some-record-buffer,     (for file buffer)
>
>Also, if you have a large block of codes you want to define in a lazy
>manner, you can do something like:
>
>   01  SOME-LENGTHY-SEQUENCE.
>       02  FILLER PIC X(nn)
>           VALUE "$H$J$&dBHeading line...".
>
>declare your "escape" chars with a substitute character (a '$' above)
>and in your program initialization add a:
>
>    EXAMINE[/INSPECT] some-lengthy-sequence replacing all "$" by %33.
>
>I have used this method to define custom f-key definitions, enabling me
>to define the values on consecutive, single lines as 02-levels under a
>grouping 01-name (makes it easy to edit and read).  You can then set the
>label definitions with a single "DISPLAY the-01-dataname" instead of a
>less efficient scheme to write individual key definitions.
>
>Those methods work, but I don't know of an "escaping" mechanism within a
>literal like C, such as printf("\033H\033JHello World"), you have to go
>to some effort to make it work.
>
>Jeff Kell <[log in to unmask]>
>

ATOM RSS1 RSS2