IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

VS Cobol II 4.0 vs Enterprice Cob 5.2


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bewildered

New User


Joined: 02 Sep 2014
Posts: 7
Location: India

PostPosted: Mon Jul 27, 2015 5:12 pm
Reply with quote

Hello All,

I have a piece of code given below, which is giving SOC7 (as expected) in Ent Cob 5.2. But the same code is running with out issue in Vs Cobol II

Quote:
05 WS-TEST1-VAR PIC S9(6)V99 SIGN LEADING SEPARATE.
05 WS-TEST2-PKD PIC S9(10)V99 COMP-3.
05 WS-TEST3-ALP PIC X(9) VALUE '---------'.

PROCEDURE DIVISION.
MOVE WS-TEST3-ALP TO WS-TEST1-VAR
DISPLAY WS-TEST1-VAR
MOVE WS-TEST1-VAR TO WS-TEST2-PKD
DISPLAY WS-TEST2-PKD
GOBACK.


Output of VS Cob II is given below
Code:
WS-TEST1-VAR - +-----000
WS-TEST2-PKD - 000000000000


Why is this code running with out issue in Vs cob II. Could this be because of some compiler option? (i know this does not make any sense
icon_redface.gif )

Any help/pointers are highly appreciated
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Jul 27, 2015 6:26 pm
Reply with quote

I think you'll find that the VS Cobol II compiler generated an MVC (move character) to move the field that "should" contain packed decimal rather than the decimal instruction that Enterprise Cobol 5.2 is generating. You can check this out by compiling with the LIST option. An MVC will never get a S0C7 abend.

IIRC, the NUMPROC compiler option relates.


Garry. icon_smile.gif
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Jul 27, 2015 6:36 pm
Reply with quote

Bewildered,
In the future, please use Code tags to preserve accurate spacing.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 27, 2015 8:56 pm
Reply with quote

Far from running without issue, the code you have shown will be giving you garbage in VS COBOL II.

I don't have a VS COBOL II compiler handy, so you are going to have to generate the pseudo-assembler and show us what code the compiler creates.

Code:
05 WS-TEST1-VAR PIC S9(6)V99 SIGN LEADING SEPARATE.
05 WS-TEST2-PKD PIC S9(10)V99 COMP-3.
05 WS-TEST3-ALP PIC X(9) VALUE '---------'.

PROCEDURE DIVISION.
MOVE WS-TEST3-ALP TO WS-TEST1-VAR
DISPLAY WS-TEST1-VAR
MOVE WS-TEST1-VAR TO WS-TEST2-PKD
DISPLAY WS-TEST2-PKD


That's horrible code. I've never MOVEd an alpha-numeric to a field with decimal places. Add to that, the leading separate sign.

WS-TEST1-VAR will be positive (since the source is an alpha-numeric field). Then you'll get six "-"s. Then two zeros (for the decimal part).

So, expected result of the first DISPLAY would be:

Code:
+------00


You got:
Code:

+-----000


Without the leading sign I'd expect:

Code:

-----000


Which is a curious extra zero. Only the generated code will explain where that has come from.

It may be (probably is) that the compiler generates the same "sign-rectification" for the low-order digit when SIGN IS SEPARATE is specified. There is some sense in this, so that a comparison of fields with or without SEPARATE SIGN would be the same when the same data is MOVEd to those fields.

The hex for "-" is '60'. So when the above value is "packed" you'd expect to get zero, and the DISPLAY confirms.

No S0C7 expected for COBOL II.

Now, an issue is that you've put garbage into a numeric field.

If your data is good, V5.2 will give you the same results as older IBM COBOLs.

You say you get a S0C7, somewhere, with V5.2 and that you expect it.

I'd not expect it to S0C7 with V5.2 necessarily. So we need to see the generated code from that, and you need to identify where the abend occurs.

And, yes, we need to see the compile options you are using for both.

Inside the Code tags, as previously suggested.

Are you jumping from VS COBOL II to Enterprise COBOL V5.2?
Back to top
View user's profile Send private message
Bewildered

New User


Joined: 02 Sep 2014
Posts: 7
Location: India

PostPosted: Tue Jul 28, 2015 5:20 pm
Reply with quote

Terry - Will do that

Garry, as you mentioned, VS cob II is using MVC and Ent cob 5.2 is using PACK.
Compiler option for VS cob II is NUMPROC(MIG) and for Ent Cob 5.2 it is NUMPROC(NOPFD). MIG option is not available in Enterprise. Is there any option available in Ent 5.2, to make it work like Vs Cob?

Bill,
I hope below information is what you are looking for. (and yes we are moving to 5.2 :-) )

Compiler option for VS Cob II


Code:
INVOCATION PARAMETERS:
XREF,FLAG(I,I),RENT,NUMPROC(MIG),LIST 
                                                                             
OPTIONS IN EFFECT:                     
      ADV                             
      APOST                           
      AWO                             
      BUFSIZE(4096)                   
    NOCMPR2                           
    NOCOMPILE(S)                       
      DATA(31)                         
    NODBCS                             
    NODECK                             
    NODUMP                             
      DYNAM                           
    NOEXIT         
      FASTSRT       
    NOFDUMP         
      FLAG(I,I)     
    NOFLAGMIG       
    NOFLAGSAA       
    NOFLAGSTD       
      LANGUAGE(UE) 
      LIB           
      LINECOUNT(60)
      LIST         
      MAP           
    NONAME         
    NONUMBER       
      NUMPROC(MIG) 
      OBJECT       
    NOOFFSET       
    NOOPTIMIZE     
      OUTDD(SYSOUT)
      RENT         
      RESIDENT     
      SEQUENCE     
      SIZE(4194304)
      SOURCE       
      SPACE(1)     
    NOSSRANGE       
    NOTERM         
    NOTEST         
      TRUNC(OPT)   
    NOVBREF         
    NOWORD         
      XREF(FULL)   
      ZWB   


Compiler option for Ent cob 5.2
Code:
Invocation parameters:               
 DYNAM,NUMPROC(NOPFD),ZONEDATA(MIG),
Options in effect:                   
 NOADATA                             
   ADV                               
   AFP(VOLATILE)                     
   APOST                             
   ARCH(10)                         
   ARITH(COMPAT)                     
   AWO                               
 NOBLOCK0                           
   BUFSIZE(32760)                   
 NOCICS                             
   CODEPAGE(1140)                   
 NOCOMPILE(E)                       
 NOCOPYRIGHT                         
 NOCURRENCY                         
   DATA(31)                         
 NODBCS                             
NODECK             
  DIAGTRUNC       
  DISPSIGN(COMPAT)
NODLL             
NODUMP             
  DYNAM           
NOEXIT             
NOEXPORTALL       
  FASTSRT         
  FLAG(I,I)       
NOFLAGSTD         
  HGPR(PRESERVE)   
  INTDATE(ANSI)   
  LANGUAGE(EN)     
  LINECOUNT(60)   
  LIST             
  MAP(HEX)         
  MAXPCF(60000)   
NOMDECK           
NONAME                                                 
  NSYMBOL(DBCS)                                         
NONUMBER                                               
  NUMPROC(NOPFD)                                       
  OBJECT                                               
NOOFFSET                                               
  OPTIMIZE(1)                                           
  OUTDD(SYSOUT)                                         
  PGMNAME(COMPAT)                                       
  QUALIFY(COMPAT)                                       
  RENT                                                 
  RMODE(AUTO)                                           
  RULES(NOENDPERIOD,NOEVENPACK,NOLAXPERF,NOSLACKBYTES) 
NOSERVICE                                               
NOSEQUENCE                                             
  SOURCE                                               
  SPACE(1)                                             
NOSQL                                                   
  SQLCCSID                                             
NOSQLIMS             
NOSSRANGE           
NOSTGOPT             
NOTERM               
  TEST(NOEJPD,SOURCE)
NOTHREAD             
  TRUNC(OPT)         
NOVBREF             
  VLR(STANDARD)     
NOWORD               
  XMLPARSE(XMLSS)   
  XREF(FULL)         
NOZONECHECK         
  ZONEDATA(MIG)     
  ZWB
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 28, 2015 5:41 pm
Reply with quote

Yes, thanks, those are the options, both sets, that I wanted to see.

You have LIST,NOOFFSET so you already have the generated pseudo-code in the listing. Find the line-numbers of your two MOVE statements in the source-listing, then find those line-numbers (which will show they are MOVEs) and copy/paste here.

You also need to indicate where the V5.2 abended.

You also need to establish why MOVEing nine dashes to a numeric field with decimal places, then further to a packed decimal with decimal places, was thought to be a good idea in the first place.

Going from NUMPROC(MIG) to NUMPROC(NOPFD) is interesting. Check that that setting of ZONEDATA is what you want.

Also compile the V5.2 with OPT(0) and see if the program still abends when you run it.
Back to top
View user's profile Send private message
Bewildered

New User


Joined: 02 Sep 2014
Posts: 7
Location: India

PostPosted: Tue Jul 28, 2015 6:19 pm
Reply with quote

Bill,

Please find details below

MOVE WS-TEST3-ALP TO WS-TEST1-VAR
Ent cob 5.2
Code:
00028A                     000063            SNAPSHOT STMT               
00028A  F245 D1D0 80AB     000063            PACK    464(5,R13),171(6,R8)
000290  F040 D1D0 0002     000063            SRP     464(5,R13),2,0     
000296  F374 8099 D1D0     000063            UNPK    153(8,R8),464(5,R13)
00029C  96F0 80A0          000063            OI      160(,R8),X'F0'     
0002A0  924E 8098          000063            MVI     152(,R8),X'4E'



VS Cob II
Code:
000264  D208 9000 C000          MVC  0(9,9),0(12) 
00026A  D205 9001 9013          MVC  1(6,9),19(9) 
000270  96F0 9006               OI   6(9),X'F0'


MOVE WS-TEST1-VAR TO WS-TEST2-PKD
Ent Cob 5.2
Code:
0002F8                     000065            SNAPSHOT STMT             
0002F8  F267 80A1 8099     000065            PACK    161(7,R8),153(8,R8)
0002FE  954E 8098          000065            CLI     152(,R8),X'4E'     
000302  A764 0006          000065            JNE     L0072             
000306  94FC 80A7          000065            NI      167(,R8),X'FC'     
00030A  A7F4 0008          000065            J       L0076             
00030E                     000065  L0072:    EQU     *                 
00030E  9560 8098          000065            CLI     152(,R8),X'60'     
000312  A764 0096          000065            JNE     L0074             
000316  94FD 80A7          000065            NI      167(,R8),X'FD'     
00031A                     000065  L0073:    EQU     *                 
00031A                     000065  L0076:    EQU     *                 
00031A  F844 80A3 80A3     000065            ZAP     163(5,R8),163(5,R8)


VS Cob II
Code:
00027E  F267 9009 9001          PACK 9(7,9),1(8,9) 
000284  954E 9000               CLI  0(9),X'4E'     
000288  58B0 C010               L    11,16(0,12)   
00028C  4770 B0E0               BC   7,224(0,11)   
000290  94F0 900F               NI   15(9),X'F0'   
000294  960C 900F               OI   15(9),X'0C'   
000298  47F0 B0FE               BC   15,254(0,11)   
00029C                 GN=8     EQU  *             
00029C  9560 9000               CLI  0(9),X'60'     
0002A0  4770 B0F4               BC   7,244(0,11)   
0002A4  94F0 900F               NI   15(9),X'F0'   
0002A8  960D 900F               OI   15(9),X'0D'           
0002AC  47F0 B0FE               BC   15,254(0,11)   
0002B0                 GN=10    EQU  *             
0002B0  58F0 21CC               L    15,460(0,2)   
0002B4  4110 A0AB               LA   1,171(0,10)   
0002B8  05EF                    BALR 14,15         
0002BA                 GN=11    EQU  *                 
0002BA                 GN=9     EQU  *                 
0002BA  F844 900B 900B          ZAP  11(5,9),11(5,9)


Job is abending in first move statement
Code:
CEE3207S - The system detected a data exception (System Completion Code=0C7). From compile unit IMBTEST at entry point IMBTEST at statement 63 at compile unit offset +000001DC at entry offset +000001DC at address 0C9001DC.


Well the real issue is happening between 'N' number of programs/subprograms icon_rolleyes.gif At the end the problem is this - one move to zoned decimal and then to packed . Iam also checking why ------- is coming in the first place.

Will check about ZONEDATA. I tried with OPT(0), but job is still abending
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 28, 2015 6:37 pm
Reply with quote

Thanks. That's the stuff.

I can see the abend (the SRP), although the abend you have quoted is for a different program (look at the failing offset).

Can you remove the decimal places from WS-TEST1-VAR?

The problem you have is having used bad data and a bad definition (the one like WS-TEST1-VAR) your program was "working" per COBOL II.

However, for Enterprise COBOL V5 there has been a substantial rewrite (I don't know the extent) and you can't rely on having been "saved" by the way an older COBOL operated in the past and now have the same behaviour in V5.

It's bad code with bad data. As I suggested previously, you're going to have to find out what the intention of it was, and do it a better way.

EDIT: I'm using "your" in the sense of it being the program you are working on, not a program that you wrote :-)
Back to top
View user's profile Send private message
Bewildered

New User


Joined: 02 Sep 2014
Posts: 7
Location: India

PostPosted: Tue Jul 28, 2015 8:26 pm
Reply with quote

Thanks Bill

Job ran successfully after removing the decimal from WS-TEST1-VAR.

Unfortunately this is not a option that I can use icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 28, 2015 10:21 pm
Reply with quote

Why can't you use that?

The code does not work with the bad data. If you have to give it bad data, you will have to fix the code.

If someone has said "do the conversion but don't change a line of code," then they've been "shortsighted".

If WS-TEST1-VAR (I know it is a dummy name, I hope) is not used for anything else, defining it without decimal-places is a much more accurate thing to do (an alpha-numeric can never have decimal places).
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Aug 03, 2015 3:51 pm
Reply with quote

Just an update on a couple of things here.

TS/OP is already using ZONEDATA(MIG). This is a new compiler option for V5.2 which, for comparisons only, forces the use of decimal instructions.

Since the problem was not with a comparison, ZONEDATA(MIG) has no effect.

Deliberately putting bad data into a zoned-decimal field and expecting it to "work" in the same way in V5 as in a previous compiler is not a sustainable idea.

To assist, a new compiler option for V5.2, ZONECHECK, is available via APAR.

This does an implicit NUMERIC test for each zoned-decimal field in a program. If a field is not NUMERIC, then depending on setting, a message is produced (ZONECHECK(MSG)) or a run-time user-abend (ZONECHECK(ABD)).

Full details can be found here.

This option will identify all "invalid" use of zoned-decimal fields, and such invalid use should be corrected.

Depending on the number of zoned-decimal fields in a program, and the amount of data, there will be a significant CPU impact, so, like SSRANGE, it is more of a "testing" option, than intended for Production.

EDIT: ZONECHECK and ZONEDATA are also available for V5.1, via APAR.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top