ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Program Status Data Structure

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Program Status Data Structure

    I am interested in finding out if there is a way to change the system date value in the program status data structure. I am having a problem with some programs bringing in an invalid date in this field. The date on the system is correct. Thanks.

  • #2
    Re: Program Status Data Structure

    use this to get the date


    Code:
    D ISODate         S               D
       isodate = %date()
    the problem with using the data structure is that the jobs may be running
    in batch and have the date they started running.

    welcome to code400
    jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Program Status Data Structure

      The date in the program status data structure is the "job date", which is the date the job entered the system. It shouldnt be an invalid date. But if you mean invalid as in it is not the current date, then that could be the case.
      Michael Catalani
      IS Director, eCommerce & Web Development
      Acceptance Insurance Corporation
      www.AcceptanceInsurance.com
      www.ProvatoSys.com

      Comment


      • #4
        Re: Program Status Data Structure

        The problem is that field has 222222 for a value. I suspect this field is being changed by some time zone software that was purchased from a vendor. We do not have access to the source code for this. This invalid date is causing an invalid date error in several programs. I am unable to change this value so the errors continue. Some of the errors happen on the *init part of the program. Any thoughts would be appreciated. Thanks.

        Comment


        • #5
          Re: Program Status Data Structure

          Apparently the purchased software is somewhat corrupted. What is this software supposed to do ?
          What sort of error do you get ? CPF, MCH, other ?
          Philippe

          Comment


          • #6
            Re: Program Status Data Structure

            Wow. That is pretty bizarre that an outside package can change the date that is passed into your program from the program data structure. (This should be controlled by the operating system, not some external package. Especially since your system date is correct) I would be more inclined to believe that you have the wrong field positions defined in your data structure.


            The positions you should be using are 191 through 198. Also, that value should be the same as what is in positions 270 through 275 (though they may be formatted differently.) I would put a DSPLY in the program before any kind of processing is done, and find out the value of both of those fields. I will be curious to see if they match.

            Comment


            • #7
              Re: Program Status Data Structure

              The error message is RNQ0112 Date, Time or Timestamp value is not valid (C G D F).

              I went through all of the fields in the program status data structure in the program and they are defined correctly. This definition in set up as a copy lib so it is the same in all programs. The field that is incorrect is 276 - 281. I will check the other values.

              Comment


              • #8
                Re: Program Status Data Structure

                Compare it to what you have in positions 191 through 198. I would be curious to see what the value is.

                Comment


                • #9
                  Re: Program Status Data Structure

                  Can you cut and paste the field definitions and the dump values into a post?

                  Comment


                  • #10
                    Re: Program Status Data Structure

                    Field ZZJDAT is position 270-275 and it has the correct system date. Field ZZSDAT is position 276-281 and it has all 2's as does ZZSTIM from positions 282-287.

                    This is the dump from the program with the error message:

                    RPGSDS DS
                    ZPGMNM CHAR(10) 'JOBLOG_STR' 'D1D6C2D3D6C76DE2E3D9'X
                    ZUSER CHAR(10) 'JCOVEY ' 'D1C3D6E5C5E840404040'X
                    ZZCDAT ZONED(6,0) 080999. 'F0F8F0F9F9F9'X
                    ZZCLVL CHAR(4) '0001' 'F0F0F0F1'X
                    ZZCTIM ZONED(6,0) 184742. 'F1F8F4F7F4F2'X
                    ZZDUM1 CHAR(26) ' 0127200920'
                    VALUE IN HEX '40404040404040404040404040404040F0F1F2F7F2F0F0F9F 2F0'X
                    ZZEXCP CHAR(4) ' ' '40404040'X
                    ZZFSTS CHAR(5) ' ' '4040404040'X
                    ZZJBNM CHAR(10) 'APTDAYPRTD' 'C1D7E3C4C1E8D7D9E3C4'X
                    ZZJDAT ZONED(6,0) 012709. 'F0F1F2F7F0F9'X
                    ZZJOBN ZONED(6,0) 074490. 'F0F7F4F4F9F0'X
                    ZZLFIL CHAR(8) ' ' '4040404040404040'X
                    ZZLFOP CHAR(5) ' ' '4040404040'X
                    ZZMSG1 CHAR(30) 'Date, Time or Timestamp value '
                    VALUE IN HEX 'C481A3856B40E389948540969940E3899485A2A381949740A 58193A48540'X
                    ZZMSG2 CHAR(30) 'is not valid. '
                    VALUE IN HEX '89A2409596A340A5819389844B40404040404040404040404 04040404040'X
                    ZZMSG3 CHAR(20) ' '
                    VALUE IN HEX '4040404040404040404040404040404040404040'X
                    ZZMSID CHAR(7) 'RNX0112' 'D9D5E7F0F1F1F2'X
                    ZZNPRM ZONED(3,0) 003. 'F0F0F3'X
                    ZZODT CHAR(4) '0000' 'F0F0F0F0'X
                    ZZPLIB CHAR(10) 'GENSYSRN13' 'C7C5D5E2E8E2D9D5F1F3'X
                    ZZPROCNM CHAR(10) 'JOBLOG_STR' 'D1D6C2D3D6C76DE2E3D9'X
                    ZZPSTS ZONED(5,0) 00000. 'F0F0F0F0F0'X
                    ZZRTNE CHAR(8) '*DETC ' '5CC4C5E3C3404040'X
                    ZZSDAT ZONED(6,0) 222222. 'F2F2F2F2F2F2'X
                    ZZSEQN CHAR(8) '00000230' 'F0F0F0F0F0F2F3F0'X
                    ZZSRCF CHAR(10) 'QRPGSRC ' 'D8D9D7C7E2D9C3404040'X
                    ZZSRCL CHAR(10) 'GENSRCRUNT' 'C7C5D5E2D9C3D9E4D5E3'X
                    ZZSRCM CHAR(10) 'JOBLOG_STR' 'D1D6C2D3D6C76DE2E3D9'X
                    ZZSTIM ZONED(6,0) 222222. 'F2F2F2F2F2F2'X
                    ZZSTS ZONED(5,0) 00112. 'F0F0F1F1F2'X
                    ZZSTSF CHAR(25) ' '
                    VALUE IN HEX '4040404040404040404040404040404040404040404040404 0'X
                    ZZWKMS CHAR(30) ' '
                    VALUE IN HEX '4040404040404040404040404040404040404040404040404 04040404040'X


                    This is the data structure definition:

                    ZZPROCNM 10A Procedure name
                    ZZSTS 5S 0 Status as a code field
                    ZZPSTS 5S 0 Previous status code
                    ZZSEQN 8A RPG source stmt sequence number
                    ZZRTNE 8A RPG routine name
                    ZZNPRM 3S 0 Number of parameters passed to the progr
                    ZZMSID 7A Exception MSGID
                    ZZODT 4A MI/ODT machine instruction
                    ZZWKMS 30A Work area for messages
                    ZZPLIB 10A Name of library where program exists
                    ZZMSG1 30A Message 1 when STSTS = 99999
                    ZZMSG2 30A Message 2 when STSTS = 99999
                    ZZMSG3 20A Message 3 when STSTS = 99999
                    ZZEXCP 4A Exception ID
                    ZZDUM1 26A Dummy field for unused positions
                    ZZLFIL 8A Name of file for last file operation
                    ZZFSTS 5A File status error code
                    ZZLFOP 5A Last file operation used if error
                    ZZSTSF 25A Status info on last file used
                    ZZJBNM 10A Job name
                    ZUSER 10A User name
                    ZZJOBN 6S 0 Job number
                    ZZJDAT 6S 0 Job date in UDATE format
                    ZZSDAT 6S 0 System date of job start in UDATE format
                    ZZSTIM 6S 0 System time of job running in hhmmss form
                    ZZCDAT 6S 0 Compile date in UDATE format
                    ZZCTIM 6S 0 Compile time in hhmmss format
                    ZZCLVL 4A Compiler level
                    ZZSRCF 10A Source file name
                    ZZSRCL 10A Source library name
                    ZZSRCM 10A Source member name
                    ZPGMNM 10A Program name

                    Comment


                    • #11
                      Re: Program Status Data Structure

                      Wow. wow wow wow. Everything looks right. I must admit I have never seen anything like this before. I just ran a quick test and found that the program DOES allow you to change the variable for system date, so I would try something like

                      ZZSDAT = UDATE;

                      and see if the date is correct after that. Of course if UDATE is screwed up you may need to use %date and convert it to the default format. Also, I would think the change would only be valid in the current program, not in called programs.

                      Comment


                      • #12
                        Re: Program Status Data Structure

                        The ZZSDAT value of 222222 is also being passed to the next program and that program gets the same error in *init. I'm not sure how to correct this problem. It certainly has to do with changing time zones. I am able to duplicate this problem by switching between time zones. Other than that, I don't know how this value is being initialized as 222222.

                        Comment


                        • #13
                          Re: Program Status Data Structure

                          Yep. Your only option may be to change each program that uses that field or dump the time zone software. Is there a way to disable the time zone software, reset your system date and see if it works? (That way you can confirm the source of the problem.) Or at least call the software provider?

                          Comment


                          • #14
                            Re: Program Status Data Structure

                            Sorry but I'm fairly sure that the PSDS def you show is wrong from pos. 81.
                            MI/ODT (4A) and Work Area (30A) for Messages shouldn't indeed be there.
                            All the subsequent fields are shifted of 34 char, that's why you get wrong values in fields.

                            Here is a correct def of the PSDS that I use nearly every day
                            PHP Code:
                                 D                SDS

                                 D PROC_NAME         
                            *PROC
                                  
                            *                                                 Procedure name
                                 D PGM_STATUS        
                            *STATUS
                                  
                            *                                                 Status code
                                 D PRV_STATUS             16     20S 0
                                  
                            *                                                 Previous status
                                 D LINE_NUM               21     28
                                  
                            *                                                 Src list line nu
                                 D ROUTINE           
                            *ROUTINE
                                  
                            *                                                 Routine name
                                 D PARMS             
                            *PARMS
                                  
                            *                                                 Num passed parms
                                 D EXCP_TYPE              40     42
                                  
                            *                                                 Exception type
                                 D EXCP_NUM               43     46
                                  
                            *                                                 Exception number
                                 D PGM_LIB                81     90
                                  
                            *                                                 Program library
                                 D EXCP_DATA              91    170
                                  
                            *                                                 Exception data
                                 D EXCP_ID               171    174
                                  
                            *                                                 Exception Id
                                 D DATE                  191    198
                                  
                            *                                                 Date (DATE fmt)
                                 
                            D YEAR                  199    200S 0
                                  
                            *                                                 Year (YEAR fmt)
                                 
                            D LAST_FILE             201    208
                                  
                            *                                                 Last file used
                                 D FILE_INFO             209    243
                                  
                            *                                                 File error info
                                 D JOB_NAME              244    253
                                  
                            *                                                 Job name
                                 D USER                  254    263
                                  
                            *                                                 User name
                                 D JOB_NUM               264    269S 0
                                  
                            *                                                 Job number
                                 D JOB_DATE              270    275S 0
                                  
                            *                                                 Date (UDATE fmt)
                                 
                            D RUN_DATE              276    281S 0
                                  
                            *                                                 Run date (UDATE)
                                 
                            D RUN_TIME              282    287S 0
                                  
                            *                                                 Run time (UDATE)
                                 
                            D CRT_DATE              288    293
                                  
                            *                                                 Create date
                                 D CRT_TIME              294    299
                                  
                            *                                                 Create time
                                 D CPL_LEVEL             300    303
                                  
                            *                                                 Compiler level
                                 D SRC_FILE              304    313
                                  
                            *                                                 Source file
                                 D SRC_LIB               314    323
                                  
                            *                                                 Source file lib
                                 D SRC_MBR               324    333
                                  
                            *                                                 Source file mbr
                                 D PROC_PGM              334    343
                                  
                            *                                                 Pgm Proc is in
                                 D PROC_MOD              344    353
                                  
                            *                                                 Mod Proc is in
                                 D CURR_USER             358    367
                                  
                            *                                                 Mod Proc is in 
                            Last edited by Mercury; January 30, 2009, 10:38 AM. Reason: typo
                            Philippe

                            Comment


                            • #15
                              Re: Program Status Data Structure

                              Check if you like the attached doc showing where the definitions don't match.
                              Attached Files
                              Last edited by Mercury; January 30, 2009, 10:14 AM. Reason: doc updated
                              Philippe

                              Comment

                              Working...
                              X