HP3000-L Archives

November 2000, Week 1

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:
Reply To:
Date:
Mon, 6 Nov 2000 17:31:48 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
Palmer, Elmo L <[log in to unmask]> wrote:
> I need to generate as the first two characters of a record
> the hexidecimal characters "0C".  Does anyone know how to
> do this in COBOL 85.  I see there is some new features that
> will allow me to do that in COBOL 2000 but I don't have that.

Assuming you mean the first character, not the first two
characters, I think the best way is to use the SYMBOLIC CHARACTERS
clause to define your own figurative constant.  It's a feature
of the 1985 ANSI standard, so it's a lot more standard than
using an octal literal or a cheat with REDEFINES.  In the
following example, I've called it FORM-FEED, because I'm guessing
that's what you want to use it for.  Note that hexadecimal 0C
is decimal 12.  For the symbolic character value you add 1,
getting 13, since COBOL wants the ordinal position of the character
in the character set (starting from 1).

      IDENTIFICATION DIVISION.
      PROGRAM-ID. COBTEST.
      ENVIRONMENT DIVISION.
      CONFIGURATION SECTION.
      SPECIAL-NAMES.
          SYMBOLIC CHARACTERS FORM-FEED IS 13.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01  SOME-RECORD    PIC X(133).
      PROCEDURE DIVISION.
      BEGIN.
     *    Set first byte to hex 0C.
          MOVE FORM-FEED TO SOME-RECORD (1:1)
          STOP RUN.
      END PROGRAM COBTEST.

Walter Murray
Hewlett-Packard
COBOL II/iX project

ATOM RSS1 RSS2