Difference between revisions of "Program Status Data Structure"

From MidrangeWiki
Jump to: navigation, search
(Program Status Data Structure Available Information)
(Program Status Data Structure Available Information)
Line 29: Line 29:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>1</td>
 
     <td>Program Name</td>
 
     <td>Program Name</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 36: Line 37:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>2</td>   
 
     <td>Program Status</td>
 
     <td>Program Status</td>
 
     <td>Zoned Decimal</td>
 
     <td>Zoned Decimal</td>
Line 43: Line 45:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>3</td>
 
     <td>Program Previous Status</td>
 
     <td>Program Previous Status</td>
 
     <td>Zoned Decimal</td>
 
     <td>Zoned Decimal</td>
Line 50: Line 53:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>4</td>
 
     <td>Program Source Statement</td>
 
     <td>Program Source Statement</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 57: Line 61:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>5</td>
 
     <td>Program Routine</td>
 
     <td>Program Routine</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 64: Line 69:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>6</td>
 
     <td>Program Number Of Parameters</td>
 
     <td>Program Number Of Parameters</td>
 
     <td>Zoned Decimal</td>
 
     <td>Zoned Decimal</td>
Line 71: Line 77:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>7</td>
 
     <td>Program Message ID</td>
 
     <td>Program Message ID</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 78: Line 85:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>8</td>
 
     <td>Program MI Instruction Code</td>
 
     <td>Program MI Instruction Code</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 85: Line 93:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>9</td>
 
     <td>Program Work</td>
 
     <td>Program Work</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 92: Line 101:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>10</td>
 
     <td>Program Library</td>
 
     <td>Program Library</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 99: Line 109:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>11</td>
 
     <td>Program Error Data</td>
 
     <td>Program Error Data</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 106: Line 117:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>12</td>
 
     <td>Program RPG Message</td>
 
     <td>Program RPG Message</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 113: Line 125:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>13</td>
 
     <td>Program Job Name</td>
 
     <td>Program Job Name</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 120: Line 133:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>14</td>
 
     <td>Program User ID</td>
 
     <td>Program User ID</td>
 
     <td>Character</td>
 
     <td>Character</td>
Line 127: Line 141:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>15</td>
 
     <td>Program Job Number</td>
 
     <td>Program Job Number</td>
 
     <td>Zoned Decimal</td>
 
     <td>Zoned Decimal</td>
Line 134: Line 149:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>16</td>
 
     <td>Program Job Date</td>
 
     <td>Program Job Date</td>
 
     <td>Zoned Decimal</td>
 
     <td>Zoned Decimal</td>
Line 141: Line 157:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>17</td>
 
     <td>Program Run Date</td>
 
     <td>Program Run Date</td>
 
     <td>Zoned Decimal</td>
 
     <td>Zoned Decimal</td>
Line 148: Line 165:
 
   </tr>
 
   </tr>
 
   <tr>
 
   <tr>
 +
    <td>18</td>
 
     <td>Program Run Time</td>
 
     <td>Program Run Time</td>
 
     <td>Zoned Decimal</td>
 
     <td>Zoned Decimal</td>

Revision as of 21:00, 29 April 2007

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 ",".

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