Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Leading Sign in Micro Focus Cobol 2.2

Status
Not open for further replies.

jmanj

Programmer
Joined
May 20, 2003
Messages
298
Location
US
I'm getting an error " SIGN not expected"

on 02 COUNT PIC S9(10)V99 SIGN IS LEADING.

I'm wondering if this is one of those version of micro focus
server express that does not accept leading sign.

Any help is greatly appreciated.

Thanks.

note: COUNT is part of an output record.
 
Shouldn't that be either

... SIGN IS LEADING SEPARATE [CHARACTER]
because this describes a DISPLAY picture,

or

... COMP SIGN IS LEADING

?

HTH
TonHu
 
I did both and it seems the compiler does not like the
SIGN clause. If I remove the SIGN clause everything went fine
but the sign is always trailing. I need a leading sign because
the bank (for positive pay) specs requires it.

If nothing else works, I may have to use an array and go from there.

Thanks for your reply.

 
Is the SIGN clause *also* specified at the group level (above this item)?

Can you show us "more context" (group level, items before and after).

What you coded SHOULD be valid - unless there is a different SIGN clause at a higher level of the hierarchy - or there is a USAGE clause problem.

Bill Klein
 
In my working storage:

01 MY-COUNT.
02 COUNTS PIC S9(10)V99 SIGN IS LEADING.
01 COMMON-ROUTINE.
02 ....ETC

I'm pretty sure this is allowable. I have no USAGE clause
and I'm out of option here.

note: I notice some of the tables(oracle), when I listed their specs, there are SIGN TRAILING clauses in some of the fields. After compiling and check the compiler listing I noticed the SIGN clause is not there. I was wondering if the compiler is stripping these clauses somehow before compiling.

Thanks.
 
Are you using a separate or integrated SQL "pre-compiler"?

Can you show the portion of the listing - WITH error message?

The code is definely "valid COBOL" - and should be in all dialects that I can think of.

Bill Klein
 
One point, if the code extract is exact you could have a problem because COUNT is a reservrd word in some dalects.
 
If you have that field within the DECLARE section of ESQL then you may have a problem with the ESQL pre-compiler.

If it is outside then it should work.

Try and create a small program with just that group on WS, and see if it still gives the error.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Just found out from our vendor that we are actually using an integrated tool called BIZMARK(anyone knows??) which integrates all cobol component into one compilable program.

In this tool we are supposed to supply only the PROCEDURE division and WORKING STORAGE section. Why it does not allow for a leading sign? Beats me!! The problem is we don't have any documentation about it. We have been train how to use GUI to enter cobol syntax and that's it. All along I thought I was directly compiling to micro focus!!!!

Thanks everyone for the respond. I'm working on a solution using loops. I'll post it here if it works..
 
As I have promised, here's the snipet I created to put a
floating leading sign to an amount which is 12 bytes long including assumed 2 decimal. I have tested with various
amount up to 100000000 and works great!! Just found out that
I could not even use intrinsic functions in this tool.


Somewhere in my pgm I test:

MOVE XUM-NETPAY to SUM-NETPAY.
IF (XUM-NETPAY < 0)
PERFORM 5000-LEADING-SIGN.



014500************************************************
014400 5000-LEADING-SIGN SECTION 50.
014500************************************************
014400 5000-START. Comment

MOVE 0 TO I1. Pic 99
MOVE 0 TO I2. Pic 99
MOVE 1 TO IX. pic 9(10) FROM 10 TO 100000000
MOVE 12 TO IY. Pic 99 total length OF VARIABLE
MOVE 2 TO IZ. Pic 99 account for decimal pos.

INITIALIZE WS-WHOLE.

COMPUTE WS-WHOLE = XUM-NETPAY * -1. WS-WHOLE is PIC 9(10) NO DECIMAL
XUM-NETPAY is PIC s9(10)v99 a negative value

PERFORM VARYING I1 FROM 1 BY 1
UNTIL (I1 > 9) UP TO 9 ONLY. ASSUMING NEG AMT IS < 1000000000.
OR (I2 > 0)
ADD 1 TO IZ
MULTIPLY IX BY 10 GIVING IX
IF (WS-WHOLE < IX)
MOVE I1 TO I2
END-IF

SUBTRACT IZ FROM IY GIVING I2.
MOVE "-" TO WS-SIGN (I2).

WS-SIGN is below:

02 SUM-NETPAY PIC ZZZZZZZZZ9V99 VALUE ZEROES.
02 WS-NUM1 REDEFINES SUM-NETPAY.
03 WS-NUM2 OCCURS 12 TIMES.
04 WS-SIGN PIC X.
 
Is SUM-NETPAY used for calculations?

Otherwise, just define SUM-NETPAY as

02 SUM-NETPAY PIC -(9)9.99.

and move XUM-NETPAY to it.

Then again maybe I missed something. It wouldn't be the first time.

&quot;Code what you mean,
and mean what you code!
But by all means post your code!&quot;

Razalas
 
SUM-NETPAY has to be zero suppress output field and the compiler gets an error when I use PIC -9(10)V99 but will accept PIC 9(10)V99-. I tried averything possible but it just don't accept any syntax of leading sign.

The bank wants every detail of checks(regular or void) to be
outputed as positive no sign but in the summary record of every acct# the check totals has to be either positive or negative. So if void checks are the only entries for a particular acct# then the total of the acct is negative with leading sign.
 
Here's how I would have tackled it:

Code:
77  IX             PIC 9(4) COMP.
01  SUM-NETPAY-X.
    02  SUM-NETPAY PIC Z(9)9.99.
MOVE XUM-NETPAY TO SUM-NETPAY
IF  XUM-NETPAY < ZERO
    MOVE ZERO TO IX
    INSPECT SUM-NETPAY-X TALLYING IX FOR LEADING SPACES
    IF  IX > ZERO
        MOVE "-" TO SUM-NETPAY-X (IX:1)
    ELSE
        MOVE ALL "*" TO SUM-NETPAY-X
    END-IF
END-IF

&quot;Code what you mean,
and mean what you code!
But by all means post your code!&quot;

Razalas
 
This tool does not like INSPECT either. From what I have seen in all delivered programs are using PERFORM VARYING most of the time. They have special routines but they are callable C++ programs.
 
How about this:
Code:
77  IX             PIC 9(4) COMP.
01  SUM-NETPAY-X.
    02  SUM-NETPAY PIC Z(9)9.99.
MOVE XUM-NETPAY TO SUM-NETPAY
IF  XUM-NETPAY < ZERO
    IF SUM-NET-PAY-X(1:1) NOT = SPACE
        MOVE ALL "*" TO SUM-NETPAY-X
    ELSE
        PERFORM VARYING IX FROM 1 BY 1 
                  UNTIL SUM-NETPAY-X(IX:1) NOT = SPACE
            CONTINUE
        END-PERFORM
        MOVE "-" TO SUM-NETPAY-X (IX - 1:1)
    END-IF
END-IF
 
Webrabbit,

This is how I did it in the first place(almost the same). The
problem is the sign is not going into where it supposed to be.
Sometimes it is correct and sometimes not. Maybe I need to reevaluate that routine again. I tried the INSPECT in the mainframe(TANDEM) and works perfectly but as I said this stupid tool does not like it.
 
Do you have any more information on this "BISMARK" software? I tried finding it on the web, but couldn't. Do you know the vendor?

It sounds to me as if it is REALLY restricting a lot of valid COBOL.

Bill Klein
 
I don't have anymore information about this Bismark tool. I guest I have to live with it. Here's another stumper that really amazes me with this tool. I have this defined:

01 EMPLOYEE. << THIS IS DATABASE TABLE
02 STATUS PIC X(01).
02 ....
02 ....

WORKING-STORAGE SECTION.

01 MY-DATA.
02 STATUS-TEST PIC X(01).
88 VALID-STAT VALUE "A", "B", "C", "D".


PROCEDURE:

DISPLAY STATUS.
MOVE STATUS TO STATUS-TEST.

IF (VALID-STAT)
DISPLAY "STAT IS " STATUS
ELSE
DISPLAY "NOT VALID " STATUS
END-IF.


RESULT: BEFORE TEST IT DISPLAY ALL VALID STATUS A TO D

DURING TEST: STAT IS A TO C
NOT VALID D

I really don't know why status D is not valid so I change the IF logic to:

IF (STATUS = "A" OR "B" OR "C" OR "D")

DISPLAY " STAT IS " STATUS
ELSE
DISPLAY " NOT VALID " STATUS
END-IF.

This time it display all valid status from A to D.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top