Skip to main content

Will GNT code catch various host abends?

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

We have found that INT code catches errors when debugging, but what can be done to catch errors in GNT code? We want to catch invalid data, bad subscripts and failing  arithmetic operations.

Resolution:

  After testing GNT code for various abends, it can be brought down to using a host dialect that will automatically pass most of the required directives by default and adding the following directives as 'Additional Directives' on the project's Build Settings window (at the project level or by individual program):

    CHECK CHECKNUM SSRANGE

For this example, the dialect used was Enterprise Cobol (ENTCOBOL).

The following Cobol program was used as the test case:

       Identification Division.

       Program-Id.  LORINCE.

       Environment Division.

       Data Division.

       Working-Storage Section.

       1   Abend-Fields.

        2   Milk        Pic 9(8).

        2   Soda        Pic 9(8) Comp.

        2   Water       Pic 9(8) Comp-3.

        2   Juice       Pic X(8).

        2   A           Pic 9(1).

        2   B           Pic 9(1).

        2   Dump-Code   Pic S9(4) Comp.

        2   Sub         Pic 9(2).

        2   Abend-Table.

         3   Ab-E1      Pic X(4) Occurs 5 Times.

       Linkage Section.

       1   L-1.

        2   Sys-Len     Pic 9(4) Binary.

        2   L21         Pic 9(2).

       Procedure Division Using L-1.

       Init1.

           Initialize Abend-Fields

           Move 1 to A

           Move Zero to B

           Move 7 to Sub

           Evaluate L21

               When 0

                    Perform S0C7

               When 1

                    Perform S0CB

               When 2

                    Perform Bad-Subscript

               When 3

                    Perform Bad-Ref-Mod

               When 4

                    Perform User-Abend

               When 5

                    Perform Set-Ret-Code

               When Other

                    Call 'Missing'

           End-Evaluate

            Stop Run.

       S0C7.

      *  Failing field is Pic 9(8)

           Move x'10105a5a00ff4081' to Juice

           Move Juice to Milk

           Add 25, Milk Giving Milk

           Display ' Milk = ' Milk

      *  Failing field is Pic 9(8) Comp

           Move x'10105a5a00ff4081' to Juice

           Move Juice to Soda

           Add 25, Soda Giving Soda

           Display ' Soda = ' Soda

      *  Failing field is Pic 9(8) Comp-3

           Move x'10105a5a00ff4081' to Juice

           Move Juice to Water

           Add 25, Water Giving Water

           Display ' Water = ' Water.

       S0CB.

           Divide B into A

           Display ' A = ' A.

       Bad-Subscript.

           Move 'gone' to Ab-E1 (Sub)

           Display ' Ab-E1 = ' Ab-E1 (Sub).

       Bad-Ref-Mod.

      *  Reference Modification with Zero length

           Move 'never' to Ab-E1 (5) (4:B)

           Display ' Ab-E1 (5) (4:B) = ' Ab-E1 (5).

       User-Abend.

           Move 1776 to Dump-Code

           Call 'ILBOABN0' Using Dump-Code.

       Set-Ret-Code.

           Move 16 to Return-Code.

Keywords for searches:

RTS048 RTS153 RTS163 RTS173 S0C7 S0CB user abend reference modification host emulation abends

Old KB# 2444

#MFDS
#EnterpriseDeveloper