cobol, Problems with a signed pic clause ******* (2023)

vinesDRK..
#1 / 9

cobol, Problems with a signed pic clause ******* (1)Problems with a signed pic clause *******

I am a student.......beating my head against the putter
for the last 3 nights......finally got the program to run with good
output. Went to pretty it up, and have tried everything that I can
find in my books (stern & stern / welburn & price)

the pic I have is : PIC SZZ,ZZZ,ZZ9V99 SIGN IS TRAILING SEPARATE
CHARACTER.

I have tried every variation of this that is imaginable.......in
addition to what is in the books. I am using microfocus on my pc at
home. This is the only error that I have, and it is killing me.

also - the requirements are calling for a right most fixed space and
CR symbol for a negative value.

if you can think of anything, please give me a shot back......

once again thank you,

Jason

Please remove the DRKDDD before replying by email.

***** Posted via the UK Online online newsreader *****

Go to http://www.*-*-*.com/ to find out
about other online services we offer our subscribers.

Tue, 02 Oct 2001 03:00:00 GMT

Howard Braze
#2 / 9

cobol, Problems with a signed pic clause ******* (2)Problems with a signed pic clause *******

Quote:


> I am a student.......beating my head against the putter
> for the last 3 nights......finally got the program to run with good
> output. Went to pretty it up, and have tried everything that I can
> find in my books (stern & stern / welburn & price)

> the pic I have is : PIC SZZ,ZZZ,ZZ9V99 SIGN IS TRAILING SEPARATE
> CHARACTER.

> I have tried every variation of this that is imaginable.......in
> addition to what is in the books. I am using microfocus on my pc at
> home. This is the only error that I have, and it is killing me.

> also - the requirements are calling for a right most fixed space and
> CR symbol for a negative value.

> if you can think of anything, please give me a shot back......

> once again thank you,

What's your error?
If you are supposed to use CR for the negative value, why isn't that
part of your picture? CR, DB, +, and _ are PICTURE symbols which are
used to display signs. B is a picture symbol which creates a space.

Your commas will print out, but they make it a display field, not a
number anymore. So you probably want a decimal point instead of a V
(implied decimal).

Generally, you use the V to show decimal point when you're going to do
calculations, then move it to something like PIC CRZZZ,999,999.99B to
display/print it.

Tue, 02 Oct 2001 03:00:00 GMT

Tom Morriso
#3 / 9

cobol, Problems with a signed pic clause ******* (3)Problems with a signed pic clause *******

Quote:

>I am a student.......beating my head against the putter
>for the last 3 nights......finally got the program to run with good
>output. Went to pretty it up, and have tried everything that I can
>find in my books (stern & stern / welburn & price)

>the pic I have is : PIC SZZ,ZZZ,ZZ9V99 SIGN IS TRAILING SEPARATE
>CHARACTER.

>I have tried every variation of this that is imaginable
[snip]

>also - the requirements are calling for a right most fixed space and
>CR symbol for a negative value.

>if you can think of anything, please give me a shot back......

Hmmm. I pick up my copy of Welburn & Price, Third Edition, look in the
_index_ for CR and am whisked away to Chapter 5. In my book Figure 5-18
(fixed insertion editing - credit (CR)) has almost exactly what you need.

You might also check Numeric Editing - Special Insertion, PICTURE Symbol .
(Decimal Point).

The PICTURE symbols S and V are _not_ editing symbols. Also, rid yourself
of the SIGN clause.

Regards,
Tom Morrison
Liant Software Corporation

Tue, 02 Oct 2001 03:00:00 GMT

Judson McClendo
#4 / 9

cobol, Problems with a signed pic clause ******* (4)Problems with a signed pic clause *******

You use the 'S' and 'V' PIC characters for a signed numeric data
item in internal format. You use '.' and either '-', '+', 'CR' or
'DB' for a numeric edited field for human readable output. Here
is how the sign editing characters work:

RECV VALUE IS VALUE IS
PIC NEGATIVE POSITIVE
---- -------- --------
'-' '-' ' '
'+' '-' '+'
'CR' 'CR' ' '
'DB' 'DB' ' '

The "SIGN IS TRAILING SEPARATE" has no effect on this PIC. That
phrase controls the way 'S' is stored for numeric data items, not
numeric edited items, where the PIC supplies the exact format.

Unless specifically instructed to do so, you should not place a fixed
sign to the left of a zero suppressed field as you have below. Look
at these pictures and the results when used on two consecutive fields
on a printed report, separated by one space:

PICTURES MOVE 12.34 and -56.78
-------------- -------------------------------
SZZ,ZZZ,ZZ9.99 ' 12.34 - 56.78'
---,---,--9.99 ' 12.34 -56.78'
ZZ,ZZZ,ZZ9.99- ' 12.34 56.78-'

As you can see, in the first example above, the negative sign for the
second value can easily be erroneously associated with the positive
12.34, or missed altogether when looking at the 56.78.

One other tip. Numeric data is naturally right justified, and alpha-
numeric data is naturally left justified. When formatting a report
with two adjacent, associated fields, one numeric and the other a long
alphanumeric field such as name, try to place the numeric field to the
left of the alphanumeric field, so the eye can easily associate the
two. Take a look at how some bonehead at my bank formatted part of
their checking account statements:

DATE DESCRIPTION AMOUNT
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99
99/99/99 XXXXXXXXXXXXXXXX 999.99

On a long listing, you need a straight edge of some sort to associate
the often short descriptions on the left with the amounts on the right.

Here is how it should have been formatted:

AMOUNT DATE DESCRIPTION
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX
999.99 99/99/99 XXXXXXXXXXXXXXXX

Because of their proximity, the eye has no difficulty in associating
the amount with the correct date and description, even when they are
very short.

Remember: reports are meant for human eyes; always format your reports
for easy and accurate visual assimilation. The same applies equally,
or even more so, to formatting your source code, which is also meant
for human eyes. The compiler doesn't care, your eyes and brain do.
--

Sun Valley Systems http://personal.bhm.bellsouth.net/~judmc
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."

Quote:


>I am a student.......beating my head against the putter
>for the last 3 nights......finally got the program to run with good
>output. Went to pretty it up, and have tried everything that I can
>find in my books (stern & stern / welburn & price)

>the pic I have is : PIC SZZ,ZZZ,ZZ9V99 SIGN IS TRAILING SEPARATE
>CHARACTER.

>I have tried every variation of this that is imaginable.......in
>addition to what is in the books. I am using microfocus on my pc at
>home. This is the only error that I have, and it is killing me.

>also - the requirements are calling for a right most fixed space and
>CR symbol for a negative value.

>if you can think of anything, please give me a shot back......

>once again thank you,

>Jason

>Please remove the DRKDDD before replying by email.

>***** Posted via the UK Online online newsreader *****

> Go to http://www.ukonline.co.uk to find out
> about other online services we offer our subscribers.

Tue, 02 Oct 2001 03:00:00 GMT

Twym
#5 / 9

cobol, Problems with a signed pic clause ******* (5)Problems with a signed pic clause *******

it has been a while since I have messed around with MF Cobol, but it used to be
that this version would only accept SIGN LEADING SEPERATE. I remember this
because our UNIX version had SIGN TRAILING and in oredr to test in on the PC
side using MF Cobol we had to change every statement to read SIGN LEADING.

Do not know if this helps, but if anyone knows if MicroFocus has changed this,
I would appreciate knowing.

TW

Tue, 02 Oct 2001 03:00:00 GMT

Robert M. Pritchet
#6 / 9

cobol, Problems with a signed pic clause ******* (6)Problems with a signed pic clause *******

Where separate signs come in handy is for conversions, especially to
different platforms and character codes, where you don't want to trust that
the internal formats will be correctly converted. Sign overpunch codes (and
sign nybbles for packed fields) could be mistranslated, especially if
numeric display fields are converted from EBCDIC to ASCII (because they're
character fields after all) but different overpunch codes are used in that
particular cobol.

The safest (and probably most time-consuming) way to convert e.g. IBM
mainframe data to Unix or PC is to first reformat each file (copy from old
to new) converting ALL numeric fields (whether binary, packed decimal, or
numeric/zoned display) to e.g. Pic S9(m)V9(n) Sign Separate. Your choice of
leading or trailing but be consistent. Floating point fields of course need
to be converted to an appropriate format, I'm not sure what, may need more
custom tailoring in each case. The idea is to produce a format that's still
numeric rather than numeric edited, but still has a separate sign so
there's no overpunch characters. If your target Cobol compiler supports
de-editing or the new functions that return the numeric value of a numeric
edited data item, that's even better, you can convert to an appropriate
numeric edited format so it's easier for people to read too. You could
insert a space or suitable delimiter e.g. | between each field if you like
on output.

Then you'll have a simple all-character file that you can just run through
a dumb EBCDIC to ASCII character translator, and on the target machine,
just write the reverse program from the original (or a different one if
needed) to reformat the data to what you need. Since you're doing a
downsizing conversion in the first place, you might want to do some
conversion anyway while you're at it (e.g. date fields for Y2K) so take the
opportunity. You might be feeding the character data file (especially if
you used commas for delimiters) to a database loader anyway. You can also
do error checking and special conversions on fields that are flags or codes
or values from a certain list or involve a table lookup function - any
needed data cleanup.

Robert M. Pritchett, President - RMP Consulting Partners LLC

"Quality means doing it right the first time!"
See http://www.headhunter.net/jobstv/0j/j04651mjxt8trch80j.htm?ShowJob
Contractors: tired of hearing "W-2 only"? Join us and let us help you get
that same contract on a 1099 as a self-employed independent contractor!

Tue, 02 Oct 2001 03:00:00 GMT

Thane Hubbe
#7 / 9

cobol, Problems with a signed pic clause ******* (7)Problems with a signed pic clause *******


Quote:

>if you can think of anything, please give me a shot back......

>once again thank you,

Go to http://www.barnesandnoble.com and search for "Teach Yourself
COBOL in 24 Hours". Read the sample chapter there - Chapter 3. It
will explain EXACTLY how to do what you reqire, including the CR!

If you like the book, buy it!

Wed, 03 Oct 2001 03:00:00 GMT
Top Articles
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated: 02/13/2023

Views: 5857

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.