Program Status Data Structure

pts.
Tags:
Application development
AS/400
CLP
RPG
RPGLE
Hi All, For position 191 - 198 in the SDS, is this always the Date the Job Entered the system? For example, we have a CL that starts at 23:50 on say 5/10, it does some processing and on the way out it calls an RPG at say 0:35 on 5/11. Will the date in positions 191-198 reflect 5/10 or 5/11 when checked in the RPG? If it is 5/11 which portion of the SDS will give me the true start date of 5/10? Thanks for any input!

Answer Wiki

Thanks. We'll let you know when a new response is added.

Yes, positions 191-8 are always the Date the Job Entered the system. Not the “program”, but the “job”. Those positions should be the same in every RPG program called in the job for as many days as the job runs.

Positions 270-5 will be the same.

Positions 276-281 may change as different programs are called.

These fields might not be what is needed. If timestamps are needed for processing while the program runs, then resolve the date and time in the C-specs.

The PSDS is not intended for business processing; it’s intended for systems and application management. Debugging is an example usage.

But business processing has different needs. The current time when an order is written to the database is a different kind of ‘time’.

Tom

b=====================================================

here is a copy book I use to define the psds. Job entered system date starts at 270.

d/if defined(PSDS)
d/eof
d/endif

d/define PSDS

* program status data structure
d psds sds
* procedure/program name
d s#pgm 10 overlay(psds:1)
* status code
d s#stat 5 0 overlay(psds:11)
* previous status code
d s#psta 5 0 overlay(psds:16)
* source statement sequence number
d s#seq# 8 overlay(psds:21)
* routine
d s#rtn 8 overlay(psds:29)
* number of parameters
d s#parm 3 0 overlay(psds:37)
* exception message id
d s#exid 7 overlay(psds:40)
* exception type
d s#exct 3 overlay(psds:40)
* exception number
d s#exc# 4 overlay(psds:43)
* hi/odt number
d s#odt# 4 overlay(psds:47)
* message work area
d s#mwa 30 overlay(psds:51)
* library in which program is located
d s#lib 10 overlay(psds:81)
* exception data
d s#excd 80 overlay(psds:91)
* exception id
d s#exci 4 overlay(psds:170)
* first 2 digits of?*year
d s#year 2 overlay(psds:199)
* last file on which operation was performed
d s#file 8 overlay(psds:201)
* file status
d s#flst 35 overlay(psds:209)
* qualified job name
d s#qualjob 26 overlay(psds:244)
* job name
d s#job 10 overlay(psds:244)
* user profile
d s#user 10 overlay(psds:254)
* job number
d s#job# 6 0 overlay(psds:264)
* date job entered system
d s#edat 6 0 overlay(psds:270)
* system date
d s#sdat 6 0 overlay(psds:276)
* system time
d s#stim 6 0 overlay(psds:282)
* compile date
d s#cdat 6 overlay(psds:288)
* compile time
d s#ctim 6 overlay(psds:294)
* compiler level
d s#levl 4 overlay(psds:300)
* source file name
d s#srcf 10 overlay(psds:304)
* source file library
d s#srcl 10 overlay(psds:314)
* source file member
d s#srcm 10 overlay(psds:324)

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Senator46058
    My work partner and I have a slight disagreement on this one, so do a test. Create a cl driver that calls an rpg pgm. Start the driver before midnight and delay the call to the rpg pgm until after midnight. The purpose of the rpg pgm would be to just create a printout of the dates in question in the data structure. I would use both 191-198 and 270 - 275. This way you will know for sure what the dates are in each spot. I believe the rpg program will show the new day my partner says the original day. Please post results.
    0 pointsBadges:
    report
  • Pollywantsacracker
    I go with 5/10. The manual says the dates are both udate. UDATE is the date when the "job" starts running (not the RPG) as far as I remember. Of course, UDATE can also be overridden. BTW, the manual says that after the RPG program starts running, the UDATE fields are fixed even if you subsequently change the job date. Why fight with the SDS? If you want the job date, use UDATE. If you want the current date use %date(). In the past (15 years ago), I used UDATE extensively. Now I tend to use %date() or a date field initialized to *sys. Sometimes, I will even change the date and time on each page of long running reports that might have changes because of time differences.
    0 pointsBadges:
    report
  • RaydenR
    The Results Are IN! Thanks to everyone for their input, here is the code we ran. The CL was scheduled for 23:51:00... QCLSRC: PGM call pgm(rjrtst/sds.out) dlyjob 1200 call pgm(rjrtst/sds.out) ENDPGM The RPG simply dumped the contents of the SDS. I included the start/end positions of the DS for clarity as our field names my differ from yours, here are the spools: First Run: Print Program DS UDATE---> 5/15/06 Main procedure 1-10............SDS.OUT Status code 11-15..............00000 Previous Status code 16-20.....00000 RPG src line number 21-28......00000000 Routine during error 29-36.....*DETC Nbr of parms passed 37-39......000 Except type CPF,MCH 40-42...... Msg number 43-46............... Reserved 47-50.................0000 Wrk area for msg 51-80......... Program library 81-90..........RJRTST Exception id 171-174........... Unused 175-190................. Date job entered sys 191-198... 05152006 1st digits 4 digit y 199-200...20 Last file used 201-208......... Status on last file 209-243.... Job name 244-253...............QPGMRS User profile 254-263...........RROBERTS Job number 264-269.............836420 Date job started 270-275....... 5/15/06 System date 276-281............ 5/15/06 Time hhmmss 282-287............23:51:00 Date pgm compiled 288-293...... 051506 Time pgm compiled 294-299...... 090757 Level of compiler 300-303......0001 Pgm source file 304-313........QRPGLESRC Pgm source library 314-323.....RJRTST Pgm source member 324-333......SDS.OUT Pgm containing proc 334-343....SDS.OUT Mod containing proc 344-353....SDS.OUT Second Run: Print Program DS UDATE---> 5/15/06 Main procedure 1-10............SDS.OUT Status code 11-15..............00000 Previous Status code 16-20.....00000 RPG src line number 21-28......00000000 Routine during error 29-36.....*DETC Nbr of parms passed 37-39......000 Except type CPF,MCH 40-42...... Msg number 43-46............... Reserved 47-50.................0000 Wrk area for msg 51-80......... Program library 81-90..........RJRTST Exception id 171-174........... Unused 175-190................. Date job entered sys 191-198... 05152006 1st digits 4 digit y 199-200...20 Last file used 201-208......... Status on last file 209-243.... Job name 244-253...............QPGMRS User profile 254-263...........RROBERTS Job number 264-269.............836420 Date job started 270-275....... 5/15/06 System date 276-281............ 5/16/06 Time hhmmss 282-287............ 11:01 Date pgm compiled 288-293...... 051506 Time pgm compiled 294-299...... 090757 Level of compiler 300-303......0001 Pgm source file 304-313........QRPGLESRC Pgm source library 314-323.....RJRTST Pgm source member 324-333......SDS.OUT Pgm containing proc 334-343....SDS.OUT Mod containing proc 344-353....SDS.OUT So we find that the System Date holds the true current date. What is interesting is that UDATE does not change so must be getting set at the start of the CL. Hope someone else finds use in this experiment. Thanks, Rayden.
    0 pointsBadges:
    report
  • Dalejanus
    Thanks for running the tests. I was aware that Udate would not change over midngiht, but that rarely affects our processing. Plus, you can easily change Udate for re-runs if needed. Looks like System date is the 'real deal'. In the past, we used *time opcode to get the current system date. Thanks again from proving dates with your tests ---Dale
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following