For Programmers: Free Programming Magazines  


Home > Archive > Cobol > July 2006 > Comp-3









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Comp-3
GARY

2006-07-16, 6:55 pm

What is the ASCII equivalent of a field with a PIC of "S9(09)v99
Comp-3"?

HeyBub

2006-07-16, 6:55 pm

GARY wrote:
> What is the ASCII equivalent of a field with a PIC of "S9(09)v99
> Comp-3"?


There isn't one. There's no "ASCII equivalent" of any data definition.
Perhaps you could rephrase?

I can tell you the above PIC defines (usually) six bytes with a decimal
digit in each half-byte and the last half-byte contains the algebraic sign
of the number. i.e., 12 34 56 78 91 2S = 123,456,789.12


GARY

2006-07-16, 6:55 pm

How many text (ASCII) characters are contained in each of the following
fields?
In the "COMP-3" fields, how are negative numbers (for example,
-00000048612) shown?

PIC X(01)
PIC 9(09)
PIC 9(04)
PIC 9(02)
PIC 9(07)
PIC 9(02)
PIC 9(02)
PIC 9(04)
PIC 9(01)
PIC 9(06)
PIC 9(07)
PIC S9(09)V99 COMP-3
PIC S9(05)V99 COMP-3
PIC S9(02)V99 COMP-3
PIC S9(05)V99 COMP-3
PIC 9(04)
PIC 9(04)
PIC S9(09) COMP-3
PIC S9(09)V99 COMP-3
PIC S9(03)V99 COMP-3
PIC S9(03)V99 COMP-3
PIC S9(03)V99 COMP-3
PIC S9(09)V99 COMP-3
PIC 9(08)
PIC X(01)
PIC 9(02)
PIC X(02)
PIC S9(07)V99 COMP-3
PIC X(04)
PIC 9(07)
PIC 9(04)
PIC 9(05)
PIC S9(09)V99 COMP-3
PIC S9(09)V99 COMP-3
PIC S9(03)V99 COMP-3
PIC S9(03)V99 COMP-3
PIC S9(07)V99 COMP-3
PIC X(01)
PIC X(02)

William M. Klein

2006-07-16, 6:55 pm

What operating system? What compiler? What compiler options specified? and what
do you think the answers are?

--
Bill Klein
wmklein <at> ix.netcom.com
"GARY" <gcotterl@co.riverside.ca.us> wrote in message
news:1153077136.934457.120940@i42g2000cwa.googlegroups.com...
> How many text (ASCII) characters are contained in each of the following
> fields?
> In the "COMP-3" fields, how are negative numbers (for example,
> -00000048612) shown?
>
> PIC X(01)
> PIC 9(09)
> PIC 9(04)
> PIC 9(02)
> PIC 9(07)
> PIC 9(02)
> PIC 9(02)
> PIC 9(04)
> PIC 9(01)
> PIC 9(06)
> PIC 9(07)
> PIC S9(09)V99 COMP-3
> PIC S9(05)V99 COMP-3
> PIC S9(02)V99 COMP-3
> PIC S9(05)V99 COMP-3
> PIC 9(04)
> PIC 9(04)
> PIC S9(09) COMP-3
> PIC S9(09)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(09)V99 COMP-3
> PIC 9(08)
> PIC X(01)
> PIC 9(02)
> PIC X(02)
> PIC S9(07)V99 COMP-3
> PIC X(04)
> PIC 9(07)
> PIC 9(04)
> PIC 9(05)
> PIC S9(09)V99 COMP-3
> PIC S9(09)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(07)V99 COMP-3
> PIC X(01)
> PIC X(02)
>



GARY

2006-07-16, 6:55 pm

My "guess" is:

PIC X(01) 1
PIC 9(09) 9
PIC 9(04) 4
PIC 9(02) 2
PIC 9(07) 7
PIC 9(02) 2
PIC 9(02) 2
PIC 9(04) 4
PIC 9(01) 1
PIC 9(06) 6
PIC 9(07) 7
PIC S9(09)V99 COMP-3 11
PIC S9(05)V99 COMP-3 7
PIC S9(02)V99 COMP-3 4
PIC S9(05)V99 COMP-3 7
PIC 9(04) 4
PIC 9(04) 4
PIC S9(09) COMP-3 9
PIC S9(09)V99 COMP-3 11
PIC S9(03)V99 COMP-3 5
PIC S9(03)V99 COMP-3 5
PIC S9(03)V99 COMP-3 5
PIC S9(09)V99 COMP-3 11
PIC 9(08) 8
PIC X(01) 1
PIC 9(02) 2
PIC X(02) 2
PIC S9(07)V99 COMP-3 9
PIC X(04) 4
PIC 9(07) 7
PIC 9(04) 4
PIC 9(05) 5
PIC S9(09)V99 COMP-3 11
PIC S9(09)V99 COMP-3 11
PIC S9(03)V99 COMP-3 5
PIC S9(03)V99 COMP-3 5
PIC S9(07)V99 COMP-3 9
PIC X(01) 1
PIC X(02) 2



Note: The "Comp-8" LRECL = 160; the LRECL of my "guess" = 214

Richard

2006-07-16, 6:55 pm


GARY wrote:
> How many text (ASCII) characters are contained in each of the following
> fields?


It may be 'none' if this is on an EDCIDC machine. Fields need not be
represented as ASCII characters, for example binary or packed decimal
are bit patterns which need to be examined as bits or hexadecimal
nibbles. COMP-3 may be packed decimal* and thus each digit is a nibble
(4 bits - half byte).

> In the "COMP-3" fields, how are negative numbers (for example,
> -00000048612) shown?


Sign is probably in last in last nibble.



* COMP-3 can be anything the compiler writer wants it to be. You need
to specify the compiler and possibly the system it is used on. In many
cases COMP-3 is packed decimal with the sign in the last nibble.

William M. Klein

2006-07-16, 6:55 pm

(On an IBM mainframe - and many - not all - other platforms)

PIC S9(09)V99 COMP-3 11

takes 6 bytes AS DOES

PIC S9(08)V99 COMP-3

Can you figure out why?

There is NOTHING about any of this that has to do with "ASCII CHARACTERS" - but
it does have to do with "information contained" (10 or 11 digits and a sign) and
how many bytes it takes to store it.

--
Bill Klein
wmklein <at> ix.netcom.com
"GARY" <gcotterl@co.riverside.ca.us> wrote in message
news:1153080213.610225.323410@p79g2000cwp.googlegroups.com...
> My "guess" is:
>
> PIC X(01) 1
> PIC 9(09) 9
> PIC 9(04) 4
> PIC 9(02) 2
> PIC 9(07) 7
> PIC 9(02) 2
> PIC 9(02) 2
> PIC 9(04) 4
> PIC 9(01) 1
> PIC 9(06) 6
> PIC 9(07) 7
> PIC S9(09)V99 COMP-3 11
> PIC S9(05)V99 COMP-3 7
> PIC S9(02)V99 COMP-3 4
> PIC S9(05)V99 COMP-3 7
> PIC 9(04) 4
> PIC 9(04) 4
> PIC S9(09) COMP-3 9
> PIC S9(09)V99 COMP-3 11
> PIC S9(03)V99 COMP-3 5
> PIC S9(03)V99 COMP-3 5
> PIC S9(03)V99 COMP-3 5
> PIC S9(09)V99 COMP-3 11
> PIC 9(08) 8
> PIC X(01) 1
> PIC 9(02) 2
> PIC X(02) 2
> PIC S9(07)V99 COMP-3 9
> PIC X(04) 4
> PIC 9(07) 7
> PIC 9(04) 4
> PIC 9(05) 5
> PIC S9(09)V99 COMP-3 11
> PIC S9(09)V99 COMP-3 11
> PIC S9(03)V99 COMP-3 5
> PIC S9(03)V99 COMP-3 5
> PIC S9(07)V99 COMP-3 9
> PIC X(01) 1
> PIC X(02) 2
>
>
>
> Note: The "Comp-8" LRECL = 160; the LRECL of my "guess" = 214
>



Howard Brazee

2006-07-17, 7:55 am

On 16 Jul 2006 10:37:35 -0700, "GARY" <gcotterl@co.riverside.ca.us>
wrote:

>What is the ASCII equivalent of a field with a PIC of "S9(09)v99
>Comp-3"?


Your question doesn't make any sense.
HeyBub

2006-07-17, 7:55 am

GARY wrote:
> How many text (ASCII) characters are contained in each of the
> following fields?


None. ASCII has nothing to do with it.

> In the "COMP-3" fields, how are negative numbers (for example,
> -00000048612) shown?


A hex F, A, C, or E in the last nibble indicates a positive number, D and B
indicate negative.

>
> PIC X(01)
> PIC 9(09)
> PIC 9(04)
> PIC 9(02)
> PIC 9(07)
> PIC 9(02)
> PIC 9(02)
> PIC 9(04)
> PIC 9(01)
> PIC 9(06)
> PIC 9(07)
> PIC S9(09)V99 COMP-3
> PIC S9(05)V99 COMP-3
> PIC S9(02)V99 COMP-3
> PIC S9(05)V99 COMP-3
> PIC 9(04)
> PIC 9(04)
> PIC S9(09) COMP-3
> PIC S9(09)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(09)V99 COMP-3
> PIC 9(08)
> PIC X(01)
> PIC 9(02)
> PIC X(02)
> PIC S9(07)V99 COMP-3
> PIC X(04)
> PIC 9(07)
> PIC 9(04)
> PIC 9(05)
> PIC S9(09)V99 COMP-3
> PIC S9(09)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(07)V99 COMP-3
> PIC X(01)
> PIC X(02)



charles hottel

2006-07-17, 9:55 pm


"GARY" <gcotterl@co.riverside.ca.us> wrote in message
news:1153077136.934457.120940@i42g2000cwa.googlegroups.com...
> How many text (ASCII) characters are contained in each of the following
> fields?
> In the "COMP-3" fields, how are negative numbers (for example,
> -00000048612) shown?
>
> PIC X(01)
> PIC 9(09)
> PIC 9(04)
> PIC 9(02)
> PIC 9(07)
> PIC 9(02)
> PIC 9(02)
> PIC 9(04)
> PIC 9(01)
> PIC 9(06)
> PIC 9(07)
> PIC S9(09)V99 COMP-3
> PIC S9(05)V99 COMP-3
> PIC S9(02)V99 COMP-3
> PIC S9(05)V99 COMP-3
> PIC 9(04)
> PIC 9(04)
> PIC S9(09) COMP-3
> PIC S9(09)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(09)V99 COMP-3
> PIC 9(08)
> PIC X(01)
> PIC 9(02)
> PIC X(02)
> PIC S9(07)V99 COMP-3
> PIC X(04)
> PIC 9(07)
> PIC 9(04)
> PIC 9(05)
> PIC S9(09)V99 COMP-3
> PIC S9(09)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(03)V99 COMP-3
> PIC S9(07)V99 COMP-3
> PIC X(01)
> PIC X(02)
>


How about DISPLAYing LENGTH OF


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com