× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Data Structure,
  • From: "Rolf Mittag" <rm@xxxxxxxxxxxx>
  • Date: Thu, 14 Jun 2001 17:01:19 +0200
  • Organization: r m e d v

RPG Reference

1.5.2.1 Program Status Data Structure




A program status data structure (PSDS) can be defined to make program
exception/error information available to an RPG IV program. The PSDS must be
defined in the main source section; therefore, there is only one PSDS per
module.


A data structure is defined as a PSDS by an S in position 23 of the data
structure statement. A PSDS contains predefined subfields that provide you
with information about the program exception/error that occurred. The
location of the subfields in the PSDS is defined by special keywords or by
predefined From and To positions. In order to access the subfields, you
assign a name to each subfield. The keywords must be specified,
left-adjusted in positions 26 through 39.


Information from the PSDS is also provided in a formatted dump. However, a
formatted dump might not contain information for fields in the PSDS if the
PSDS is not coded, or the length of the PSDS does not include those fields.
For example, if the PSDS is only 275 bytes long, the time and date or
program running will appear as *N/A*. in the dump, since this information
starts at byte 276. For more information see "DUMP (Program Dump)" in topic
4.4.32.


    ___ TIP ________________________________________________________________
   |
|
   | Call performance with LR on will be greatly improved by having no
|
   | PSDS, or a PSDS no longer than 80 bytes, since some of the information
|
   | to fill the PSDS after 80 bytes is costly to obtain.
|
   |
|

|________________________________________________________________________|



Table 9 provides the layout of the subfields of the data structure and the
predefined From and To positions of its subfields that can be used to access
information in this data structure.



____________________________________________________________________________
______________________
   | Table 9. Contents of the Program Status Data Structure
|
   |_______ _______ _______________ _______ ___________
______________________________________________|
   | From  | To    |               |       |           |
|
   | (Pos. | (Pos. |               |       |           |
|
   | 26-32)| 33-39)| Format        | Length| Keyword   | Information
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   1   |   10  | Character     | 10    | *PROC     | Name of the main
procedure, if there is one; |
   |       |       |               |       |           | otherwise, the name
associated with the main |
   |       |       |               |       |           | source section.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   11  |   15  | Zoned decimal | 5,0   | *STATUS   | Status code. For a
description of these      |
   |       |       |               |       |           | codes, see "Program
Status Codes" in         |
   |       |       |               |       |           | topic 1.5.2.1.1.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   16  |   20  | Zoned decimal | 5,0   |           | Previous status
code.                        |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |   21  |   28  | Character     | 8     |           | RPG IV source
listing line number or         |
 | |       |       |               |       |           | statement number.
The source listing line    |
 | |       |       |               |       |           | number is replaced
by the source listing     |
 | |       |       |               |       |           | statement number if
OPTION(*SRCSTMT) is      |
 | |       |       |               |       |           | specified instead
of OPTION(*NOSRCSTMT). The |
 | |       |       |               |       |           | full statement
number is included when it    |
 | |       |       |               |       |           | applies to the root
source member. If the    |
 | |       |       |               |       |           | statement number is
greater than 6 digits    |
 | |       |       |               |       |           | (that is, it
includes a source ID other than |
 | |       |       |               |       |           | zero), the first 2
positions of the 8-byte   |
 | |       |       |               |       |           | feedback area will
have a "+ " indicating    |
 | |       |       |               |       |           | that the rest of
statement number is stored  |
 | |       |       |               |       |           | in positions
354-355.                        |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   29  |   36  | Character     | 8     | *ROUTINE  | Name of the RPG IV
routine in which the      |
   |       |       |               |       |           | exception or error
occurred. This subfield   |
   |       |       |               |       |           | is updated at the
beginning of an RPG IV     |
   |       |       |               |       |           | routine or after a
program call only when    |
   |       |       |               |       |           | the *STATUS
subfield is updated with a       |
   |       |       |               |       |           | nonzero value. The
following names identify  |
   |       |       |               |       |           | the routines:
|
   |       |       |               |       |           |
|
   |       |       |               |       |           | *INIT     Program
initialization             |
   |       |       |               |       |           |
|
   |       |       |               |       |           | *DETL     Detail
lines                       |
   |       |       |               |       |           |
|
   |       |       |               |       |           | *GETIN    Get input
record                   |
   |       |       |               |       |           |
|
   |       |       |               |       |           | *TOTC     Total
calculations                 |
   |       |       |               |       |           |
|
   |       |       |               |       |           | *TOTL     Total
lines                        |
   |       |       |               |       |           |
|
   |       |       |               |       |           | *DETC     Detail
calculations                |
   |       |       |               |       |           |
|
   |       |       |               |       |           | *OFL      Overflow
lines                     |
   |       |       |               |       |           |
|
   |       |       |               |       |           | *TERM     Program
ending                     |
   |       |       |               |       |           |
|
   |       |       |               |       |           | *ROUTINE  Name of
program or procedure       |
   |       |       |               |       |           |           called
(first 8 characters).       |
   |       |       |               |       |           |
|
   |       |       |               |       |           | Note:  *ROUTINE is
not valid unless you use  |
   |       |       |               |       |           |        the normal
RPG IV cycle. Logic that   |
   |       |       |               |       |           |        takes the
program out of the normal   |
   |       |       |               |       |           |        RPG IV cycle
may cause *ROUTINE to    |
   |       |       |               |       |           |        reflect an
incorrect value.           |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   37  |   39  | Zoned decimal | 3,0   | *PARMS    | Number of
parameters passed to this program  |
   |       |       |               |       |           | from a calling
program. The value is the     |
   |       |       |               |       |           | same as that
returned by %PARMS. If no       |
   |       |       |               |       |           | information is
available, -1 is returned.    |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   40  |   42  | Character     | 3     |           | Exception type (CPF
for a OS/400 system      |
   |       |       |               |       |           | exception or MCH
for a machine exception).   |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   43  |   46  | Character     | 4     |           | Exception number.
For a CPF exception, this  |
   |       |       |               |       |           | field contains a
CPF message number. For a   |
   |       |       |               |       |           | machine exception,
it contains a machine     |
   |       |       |               |       |           | exception number.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   47  |   50  | Character     | 4     |           | Reserved
                    |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   51  |   80  | Character     | 30    |           | Work area for
messages. This area is only    |
   |       |       |               |       |           | meant for internal
use by the ILE RPG        |
   |       |       |               |       |           | compiler. The
organization of information    |
   |       |       |               |       |           | will not always be
consistent. It can be     |
   |       |       |               |       |           | displayed by the
user.                       |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   81  |   90  | Character     | 10    |           | Name of library in
which the program is      |
   |       |       |               |       |           | located.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |   91  |  170  | Character     | 80    |           | Retrieved exception
data. CPF messages are   |
   |       |       |               |       |           | placed in this
subfield when location        |
   |       |       |               |       |           | *STATUS contains
09999.                      |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  171  |  174  | Character     | 4     |           | Identification of
the exception that caused  |
   |       |       |               |       |           | RNX9001 exception
to be signaled.            |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  175  |  184  | Character     | 10    |           | Name of file on
which the last file          |
   |       |       |               |       |           | operation occurred
(updated only when an     |
   |       |       |               |       |           | error occurs). This
information always       |
   |       |       |               |       |           | contains the full
file name.                 |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  185  |  190  | Character     | 6     |           | Unused.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  191  |  198  | Character     | 8     |           | Date (*DATE format)
the job entered the      |
 | |       |       |               |       |           | system. In the case
of batch jobs submitted  |
 | |       |       |               |       |           | for overnight
processing, those that run     |
 | |       |       |               |       |           | after midnight will
carry the next day's     |
 | |       |       |               |       |           | date. This value is
derived from the job     |
 | |       |       |               |       |           | date, with the year
expanded to the full     |
 | |       |       |               |       |           | four years. The
date represented by this     |
 | |       |       |               |       |           | value is the same
date represented by        |
 | |       |       |               |       |           | positions 270 -
275.                         |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  199  |  200  | Zoned decimal | 2,0   |           | First 2 digits of a
4-digit year. The same   |
 | |       |       |               |       |           | as the first 2
digits of *YEAR. This field   |
 | |       |       |               |       |           | applies to the
century part of the date in   |
 | |       |       |               |       |           | positions 270 to
275. For example, for the   |
 | |       |       |               |       |           | date 1999-06-27,
UDATE would be 990627, and  |
 | |       |       |               |       |           | this century field
would be 19. The value in |
 | |       |       |               |       |           | this field in
conjunction with the value in  |
 | |       |       |               |       |           | positions 270 - 275
has the combined         |
 | |       |       |               |       |           | information of the
value in positions 191    |
 | |       |       |               |       |           | -198.
|
   |       |       |               |       |           |
|
 | |       |       |               |       |           | Note:  This century
field does not apply to  |
 | |       |       |               |       |           |        the dates in
positions 276 to 281, or |
 | |       |       |               |       |           |        positions
288 to 293.                 |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  201  |  208  | Character     | 8     |           | Name of file on
which the last file          |
   |       |       |               |       |           | operation occurred
(updated only when an     |
   |       |       |               |       |           | error occurs). This
file name will be        |
   |       |       |               |       |           | truncated if a long
file name is used. See   |
   |       |       |               |       |           | positions 175-184
for long file name         |
   |       |       |               |       |           | information.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  209  |  243  | Character     | 35    |           | Status information
on the last file used.    |
   |       |       |               |       |           | This information
includes the status code,   |
   |       |       |               |       |           | the RPG IV opcode,
the RPG IV routine name,  |
 | |       |       |               |       |           | the source listing
line number or statement  |
 | |       |       |               |       |           | number, and record
name. It is updated only  |
   |       |       |               |       |           | when an error
occurs.                        |
   |       |       |               |       |           |
|
   |       |       |               |       |           | Note:  The opcode
name is in the same form   |
   |       |       |               |       |           |        as *OPCODE
in the INFDS               |
   |       |       |               |       |           |
|
 | |       |       |               |       |           | The source listing
line number is replaced   |
 | |       |       |               |       |           | by the source
listing statement number if    |
 | |       |       |               |       |           | OPTION(*SRCSTMT) is
specified instead of     |
 | |       |       |               |       |           | OPTION(*NOSRCSTMT).
The full statement       |
 | |       |       |               |       |           | number is included
when it applies to the    |
 | |       |       |               |       |           | root source member.
If the statement number  |
 | |       |       |               |       |           | is greater than 6
digits (that is, it        |
 | |       |       |               |       |           | includes a source
ID other than zero), the   |
 | |       |       |               |       |           | first 2 positions
of the 8-byte feedback     |
 | |       |       |               |       |           | area will have a "+
" indicating that the    |
 | |       |       |               |       |           | rest of statement
number is stored in        |
 | |       |       |               |       |           | positions 356-357.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  244  |  253  | Character     | 10    |           | Job name.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  254  |  263  | Character     | 10    |           | User name from the
user profile.             |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  264  |  269  | Zoned decimal | 6,0   |           | Job number.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  270  |  275  | Zoned decimal | 6,0   |           | Date (in UDATE
format) the program started   |
 | |       |       |               |       |           | running in the
system (UDATE is derived from |
 | |       |       |               |       |           | this date). See
"User Date Special Words" in |
 | |       |       |               |       |           | topic 1.1.3 for a
description of UDATE. This |
 | |       |       |               |       |           | is commonly known
as the 'job date'. The     |
 | |       |       |               |       |           | date represented by
this value is the same   |
 | |       |       |               |       |           | date represented by
positions 191 - 198.     |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  276  |  281  | Zoned decimal | 6,0   |           | Date of program
running (the system date in  |
 | |       |       |               |       |           | UDATE format). If
the year part of this      |
 | |       |       |               |       |           | value is between 40
and 99, the date is      |
 | |       |       |               |       |           | between 1940 and
1999.  Otherwise the date   |
 | |       |       |               |       |           | is between 2000 and
2039. The 'century'      |
 | |       |       |               |       |           | value in positions
199 - 200 does not apply  |
 | |       |       |               |       |           | to this field.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  282  |  287  | Zoned decimal | 6,0   |           | Time (in the format
hhmmss) of the program   |
   |       |       |               |       |           | running.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  288  |  293  | Character     | 6     |           | Date (in UDATE
format) the program was       |
 | |       |       |               |       |           | compiled. If the
year part of this value is  |
 | |       |       |               |       |           | between 40 and 99,
the date is between 1940  |
 | |       |       |               |       |           | and 1999. Otherwise
the date is between 2000 |
 | |       |       |               |       |           | and 2039. The
'century' value in positions   |
 | |       |       |               |       |           | 199 - 200 does not
apply to this field.      |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  294  |  299  | Character     | 6     |           | Time (in the format
hhmmss) the program was  |
   |       |       |               |       |           | compiled.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  300  |  303  | Character     | 4     |           | Level of the
compiler.                       |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  304  |  313  | Character     | 10    |           | Source file name.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  314  |  323  | Character     | 10    |           | Source library
name.                         |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  324  |  333  | Character     | 10    |           | Source file member
name.                     |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  334  |  343  | Character     | 10    |           | Program containing
procedure.                |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  344  |  353  | Character     | 10    |           | Module containing
procedure.                 |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
   |  354  |  429  | Character     | 76    |           | Unused.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  354  |  355  | Zoned decimal | 2, 0  |           | Source Id matching
the statement number from |
 | |       |       |               |       |           | positions 21-28.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  356  |  357  | Zoned decimal | 2, 0  |           | Source Id matching
the statement number from |
 | |       |       |               |       |           | positions 228-235.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  358  |  367  | Character     | 10    |           | Current user
profile name.                   |

|_______|_______|_______________|_______|___________|_______________________
_______________________|
 | |  368  |  429  | Character     | 62    |           | Unused.
|

|_______|_______|_______________|_______|___________|_______________________
_______________________|

---------------------------
Dipl.Inf.(FH) Rolf P Mittag
IBM Partner in Development
Leipziger Str. 50
D-69214 Eppelheim
Fon: +49 (6221) 76 78 60
Fax: +49 (6221) 76 80 26
eMl: rm@r-m-e-d-v.de

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.