"Bruce Vining" <bvining@xxxxxxxxxx> wrote in message 
news:mailman.3151.1176824705.2544.cobol400-l@xxxxxxxxxxxxxxx
What information is it that you want to access?  Perhaps there's a better
way to get at that information as you're not really interested in program
status due to error conditions.
Bruce,
I can think of a lot of reasons why I would want most of this information 
available to the program during run-time. For the one particular item I am 
working on now, I need the program name and module name of the currently 
running program. This is so that I can call a sub-routine that calls the 
QlnDumpCobol API to get a formatted dump for a specific application program 
when it detects a "handled" (the program decides it can't continue) 
exception in the program logic.
What I mean by "handled exception" is not just a COBOL-type exceptions, but 
rather an exception as defined by the program logic. For example, you 
attempt to compute a date based on certain other values from a customer 
record and you end up with a date that is not "reasonable". You can't 
continue processing and need to force termination with an appropriate 
message. In our case, we also want to produce a formatted dump which would 
show all the working storage items used to make the calculation which would 
help answer the question as to how/why this happened?
It would be very helpful to have all that information as part of the 
formatted dump, as it would be IF it would be populated.
Is there some other API that I can call at the beginning of each program to 
get this data so that it would be available for later if a handled exception 
occurs and a dump is requested?
       SPECIAL-NAMES.
           PROGRAM STATUS IS PGM-STATUS-AREA.
           EJECT
       DATA DIVISION.
       FILE SECTION.
           EJECT
       WORKING-STORAGE SECTION.
           SKIP1
       01  PGM-STATUS-AREA  IS GLOBAL      VALUE SPACES.
           05  PGM-PROGRAM-NAME              PIC X(10).
           05  PGM-LIBRARY-NAME              PIC X(10).
           05  PGM-MODULE-NAME               PIC X(10).
           05  PGM-STATEMENT-NUMBER          PIC X(10).
           05  PGM-OPTIMIZATION-LEVEL        PIC X(6).
           05  PGM-EXCEPTION-MESSAGE         PIC X(7).
           05  PGM-JOB-NAME                  PIC X(10).
           05  PGM-JOB-NUMBER                PIC X(6).
           05  PGM-JOB-TYPE                  PIC X(1).
           05  PGM-EXECUTION-USER            PIC X(10).
           05  PGM-TIME-ERROR-OCCURRED       PIC X(14).
 
As an Amazon Associate we earn from qualifying purchases.