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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group level isue between NetCobol and MicroFocus

Status
Not open for further replies.

bivbivbiv

Programmer
Feb 28, 2006
9
NL
Next source is a snippet of a sample application compiled with MF and NetCobol. MF returns 'equal' and NC 'not equal'. What's going on? We are investigating a port from MF to NC.

03 TABEL1 VALUES ZEROES.
05 XITAB1 PIC S9 OCCURS 10 TIMES INDEXED BY XI1.
03 TABEL2 VALUES ZEROES.
05 XITAB2 PIC S9 OCCURS 10 TIMES.

PROCEDURE DIVISION.
HOOFDPROGRAMMA SECTION.
HOOFD.

PERFORM VARYING XI1 FROM 1 BY 1 UNTIL XI1 > 10
COMPUTE XITAB1(XI1) = XITAB1(XI1) + 0
END-PERFORM.

IF TABEL1 = TABEL2
DISPLAY "EQUAL"
ELSE
DISPLAY "NOT EQUAL"
END-IF.
 
Check the default option on MF and NetCobol for the sign (TRAILING vs LEADING, SEPARATE or not, ...)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the suggestion. We have tested all 4 combinations giving the same result. Move zeroes fills all area with binary zero, where the addition of 0 causes a sign in NC and leaves the binary zero in MF. At least that's what seems to be happening.
 
[My previous reply was rather brief, due to incoming customer call. I will try to be more helpful now.]

So you have the following
Code:
   03 TABEL1 VALUES ZEROES.
      05 XITAB1 PIC S9 OCCURS 10 TIMES  INDEXED BY XI1.
Absent any other information, including unseen compiler configuration directives, this will cause 10 octets (characters) to be initialized to ASCII zeros, not zeros that conform to the PIC clause (which specify combined sign). Then, in your [tt]PERFORM[/tt] loop you do arithmetic on this improperly described data. To expect consistent behavior in this circumstance is probably expecting too much.

Tom Morrison
 
Did you look this up in the Ebbinkhuijsen Cobol-'Bible'? (he's dutch as well) Guess he has something usefull to say about this.
Personally I agree with k5tm. It can't be determined properly and so is compiler-config-dependent.

HTH
TonHu
 
Please confirm that the line that reads as follows

COMPUTE XITAB1(XI1) = XITAB1(XI1) + 0

should actually have been more like

Code:
COMPUTE XITAB2(XI1) = XITAB1(XI1) + 0

because otherwise, as Tom said
Why do you think they should be equal?

Or maybe that's why we haven't heard back from him?

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

Razalas
 
The answer was satisfactory. It's not a matter of what is right or wrong, problem is that we want to migrate from MicroFocus to Fujitsu and where testing the internal form of numbers, especially the sign. When we migrate, we must be sure that things keep working as they do now, and we need to know where to 'adjust' the source. What Fujitsu is doing is similar as I'm used to see in the early days with HP and IBM cobol's, so I think that MF is doing something 'wrong'. In fact, moving zeroes to a grouplevel should be considered as an alphanumeric move of chr(40) ('0') and the calculation of adding 0 to a field is done by implicit converting the ascii value to its binary representation and is stored in the binary representation. I don't know what ebbinkhuizen is telling about this, I couldn't find it in the 2002 manual, but I'll try to search again. In fact, to my feeling Fujitsu is doing it as I would expect and the table should be initialized with 'initialize', but all is old code. I think this thread can be closed. Thanks to all.

albert
 
Given the code snippet

Code:
   03 TABEL1 VALUES ZEROES.
      05 XITAB1 PIC S9 OCCURS 10 TIMES  INDEXED BY XI1.
   03 TABEL2 VALUES ZEROES.
      05 XITAB2 PIC S9 OCCURS 10 TIMES.

My guess is that you (or the original coder) is not (was not aware that with any ANSI '85 Standard conforming compiler (and both the Micro Focus and Fujitsu compilers are), that it is entirely valid (and I would sy BETTER) to code:

Code:
   03 TABEL1.
      05 XITAB1 PIC S9 OCCURS 10 TIMES  INDEXED BY XI1
                 Value Zero.
   03 TABEL2.
      05 XITAB2 PIC S9 OCCURS 10 TIMES
                 Value Zero.

My PERSONAL recomendation would be to NEVER code a VALUE clause on a "group item" with subordinate numeric (any usage) items. If you made this change, then I think this problem (and potentially several other) "migration issues" would go away.

Bill Klein
 
I agree. However I would opt for initialize.

albert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top