Difference between revisions of "Program Status Data Structure"
(→Program Status Data Structure Available Information) |
m (Add to Programming Category) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
D SDS | D SDS | ||
− | List the sub-fields you need below that. They're described in the [http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ | + | List the sub-fields you need below that. They're described in the [http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/books/sc092508.pdf 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: | 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: | ||
Line 20: | Line 20: | ||
==Program Status Data Structure Available Information== | ==Program Status Data Structure Available Information== | ||
Numeric Data Length column contains the decimal places after the ",". | Numeric Data Length column contains the decimal places after the ",". | ||
+ | |||
+ | Certain fields can be specified by their name as the beginning buffer position, instead of an offset. These are noted as Alternate Location in the table: | ||
<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> | ||
Line 27: | Line 30: | ||
<th>Beginning Buffer Position</th> | <th>Beginning Buffer Position</th> | ||
<th>Ending Buffer Position</th> | <th>Ending Buffer Position</th> | ||
+ | <th>Alternate location</th> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 35: | Line 39: | ||
<td align="right">1</td> | <td align="right">1</td> | ||
<td align="right">10</td> | <td align="right">10</td> | ||
+ | <td alight="left">*proc</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 67: | Line 72: | ||
<td align="right">29</td> | <td align="right">29</td> | ||
<td align="right">36</td> | <td align="right">36</td> | ||
+ | <td align="left">*routine</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 75: | Line 81: | ||
<td align="right">37</td> | <td align="right">37</td> | ||
<td align="right">39</td> | <td align="right">39</td> | ||
+ | <td align="left">*parms</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 201: | Line 208: | ||
<pre> | <pre> | ||
Dpsds sds | Dpsds sds | ||
− | D pgmname 10a | + | D pgmname 10a |
+ | or d pgmname *proc | ||
+ | D pgmname | ||
D pgmsts 5s 0 | D pgmsts 5s 0 | ||
D pgmprvsts 5s 0 | D pgmprvsts 5s 0 | ||
D pgmsrcstmt 8a | D pgmsrcstmt 8a | ||
D pgmroutine 8a | D pgmroutine 8a | ||
+ | or D pgmroutine *routine | ||
D pgmparms 3s 0 | D pgmparms 3s 0 | ||
+ | or D pgmparms *parms | ||
D pgmmsgid 7a | D pgmmsgid 7a | ||
D pgmmi# 4a | D pgmmi# 4a | ||
Line 221: | Line 232: | ||
D pgmruntime 6s 0 | D pgmruntime 6s 0 | ||
</pre> | </pre> | ||
+ | ==Categories== | ||
+ | [[Category:RPG]] | ||
+ | [[Category:Quick Reference]] | ||
+ | [[Category:Programming]] |
Latest revision as of 13:52, 2 June 2008
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 ",".
Certain fields can be specified by their name as the beginning buffer position, instead of an offset. These are noted as Alternate Location in the table:
Seq | Value Contained | Data Type | Data Length | Beginning Buffer Position | Ending Buffer Position | Alternate location |
---|---|---|---|---|---|---|
1 | Program Name | Character | 10 | 1 | 10 | *proc |
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 | *routine |
6 | Program Number Of Parameters | Zoned Decimal | 3,0 | 37 | 39 | *parms |
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 or d pgmname *proc D pgmname D pgmsts 5s 0 D pgmprvsts 5s 0 D pgmsrcstmt 8a D pgmroutine 8a or D pgmroutine *routine D pgmparms 3s 0 or D pgmparms *parms 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