Difference between revisions of "Program Status Data Structure"
(→Program Status Data Structure Available Information) |
(→Program Status Data Structure Available Information) |
||
Line 22: | Line 22: | ||
<table border="normal" class="sortable"> | <table border="normal" class="sortable"> | ||
<tr> | <tr> | ||
+ | <th>Seq</th> | ||
<th>Value Contained</th> | <th>Value Contained</th> | ||
<th>Data Type</th> | <th>Data Type</th> |
Revision as of 21:00, 29 April 2007
Contents
Program Status Data Structure
This structure contains subfields that hold a lot of information about the current program and the job it's running in. It provides the easiest way to get the program name, the job name, user ID, exception information and more.
You declare it in the data definition section of the program like this:
* Program Status Data Structure D SDS
List the sub-fields you need below that. They're described in the ILE RPG language reference.
Declaring an externally described data structure allows you to use any of the information in the program status data structure without worrying about sub-field locations. You just add a declaration like this to your program:
* Program Status Data Structure D PSDS ESDS
Place the data structure template file in the library list during the compile. Create the template file by compiling PSDS from the source as a normal data file with no members. Use the subfields as you would any other variable in your program.
Program Status Data Structure Available Information
Numeric Data Length column contains the decimal places after the ",".
Seq | Value Contained | Data Type | Data Length | Beginning Buffer Position | Ending Buffer Position |
---|---|---|---|---|---|
1 | Program Name | Character | 10 | 1 | 10 |
2 | Program Status | Zoned Decimal | 5,0 | 11 | 15 |
3 | Program Previous Status | Zoned Decimal | 5,0 | 16 | 20 |
4 | Program Source Statement | Character | 8 | 21 | 28 |
5 | Program Routine | Character | 8 | 29 | 36 |
6 | Program Number Of Parameters | Zoned Decimal | 3,0 | 37 | 39 |
7 | Program Message ID | Character | 7 | 40 | 46 |
8 | Program MI Instruction Code | Character | 4 | 47 | 50 |
9 | Program Work | Character | 30 | 51 | 80 |
10 | Program Library | Character | 10 | 81 | 90 |
11 | Program Error Data | Character | 80 | 91 | 170 |
12 | Program RPG Message | Character | 4 | 171 | 174 |
13 | Program Job Name | Character | 10 | 244 | 253 |
14 | Program User ID | Character | 10 | 254 | 263 |
15 | Program Job Number | Zoned Decimal | 6,0 | 264 | 269 |
16 | Program Job Date | Zoned Decimal | 6 | 270 | 275 |
17 | Program Run Date | Zoned Decimal | 6 | 276 | 281 |
18 | Program Run Time | Zoned Decimal | 6 | 282 | 287 |
Here is a Sample Program Status Data Structure in RPG III Style:
Dpsds sds D pgmname 1 10a D pgmsts 11 15s 0 D pgmprvsts 16 20s 0 D pgmsrcstmt 21 28a D pgmroutine 29 36a D pgmparms 37 39s 0 D pgmmsgid 40 46a D pgmmi# 47 50a D pgmwork 51 80a D pgmlib 81 90a D pgmerrdta 91 170a D pgmrpgmsg 171 174a D pgmjob 244 253a D pgmuser 254 263a D pgmjobnum 264 269s 0 D pgmjobdate 270 275s 0 D pgmrundate 276 281s 0 D pgmruntime 282 287s 0
Here is a Sample Program Status Data Structure in RPG IV Style:
Dpsds sds D pgmname 10a D pgmsts 5s 0 D pgmprvsts 5s 0 D pgmsrcstmt 8a D pgmroutine 8a D pgmparms 3s 0 D pgmmsgid 7a D pgmmi# 4a D pgmwork 30a D pgmlib 10a D pgmerrdta 80a D pgmrpgmsg 4a D Filler_01 69a D pgmjob 10a D pgmuser 10a D pgmjobnum 5s 0 D pgmjobdate 6s 0 D pgmrundate 6s 0 D pgmruntime 6s 0