ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Display file using a message file

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

  • Display file using a message file

    Morning,
    I have to update a program written by a cave man. It was originally a S36 RPG program but has been converted using the convert source utility.

    There is a display file which uses messages from a message file. The appropriate message id for each error as found in the RPG is passed as a character field to a field defined in the DDS like this '0212U1'.

    Now, from what I have picked up from the IBM DSPF manual, the first 4 are the USR msg id and the U1 indicates that first level message text should be returned.

    In the display file, there is an output field (ERROR) with these keywords; DSPATR(RI) with indicator 91 on the line. MSGID(&MIC001 HISLIB/HISMSGF) with indicator 91 on the line. Another keyword MSGID(*NONE) without the indicator and a defined field called MIC001 7A P. (Indicator 91 is seton in the program when an error is encountered.)

    Now, apparently something is missing somewhere because when there's an error, the screen shows the ERROR field in reverse image and rather than the first level message text, it only shows the passed value '0319??' (or whatever the specific id is for the error encountered but always with 2 question marks at the end)

    I've located the message file and it is in the library list.

    I cannot express how much time I waste every time someone enters an invalid value on in a field and I have to stop what I'm doing to search the program for the code displayed in the ERROR field to tell them what they did wrong. Did I mention that there are no PC keywords used on any of the fields, that's right. The cursor goes to the first input field when there's an error and the same code can be used in multiple places in the program. It's a ton of fun!

    Anyone out there familiar with this setup and can tell me what's missing?

    Mike.
    Everyday's a school day, what grade are you in?

  • #2
    Since the program is running natively (not running in the S/36 environment), the MIC001 variable has to contain the 7 character message ID. Assuming the message IDs start with USR, the MIC001 variable should contain USR0212 before the record format is displayed. The U1 part is only used if the program is running in the S/36 environment.

    Comment


    • #3
      Brian,
      I updated the program to supply the full message id in the MIC001 field but I'm still not getting the message text, only the message id shows on the error line.

      Mike.
      Everyday's a school day, what grade are you in?

      Comment


      • #4
        Does your DDS looks something like this:
        Code:
        A  91        ERROR         78A    24  2DSPATR(RI)
        A  91                                  MSGID(&MIC001 HISLIB/HISMSGF)
        A                                      MSGID(*NONE)
        A            MIC001         7A  P
        If so, then the only time it fails to work for me is if I load the MIC001 variable with a message ID that is not in the message file or if the message file does not exist at run time (since you qualified the message file in the DDS, it will only look in that library for the message file at run time, the library list isn't used). If your DDS is different, then perhaps posting the relevant parts of your DDS would be helpful.

        Comment


        • #5
          Brian,
          The code looks exactly like yours but doesn't behave the same way. I've checked that the message file is in the library list and it is and I've verified that the message id's exist in the file and they do.

          I must be missing something else but until I figure out how to post code like you did, I'll have to wait.

          Mike
          Everyday's a school day, what grade are you in?

          Comment


          • #6
            To post code, insert [ CODE ] and [ /CODE ] tags around the code (without the spaces) or click on the # button to do it for you. I usually just click on the # button and insert the code between the code tags to preserve the spacing.

            Originally posted by redvan View Post
            I've checked that the message file is in the library list...
            Does the message file exist in HISLIB and do the message IDs exist in that message file? As I said in a previous post, the library list doesn't matter since you've qualified the message file in the DDS.


            Comment


            • #7
              Brian,
              Apologizes for the long delay ,other things came up...
              Did everything you recommended in this post and still not getting the message, only the message id.

              I think it's time to post code. How do I do that?

              Mike.
              Everyday's a school day, what grade are you in?

              Comment


              • #8
                To post code, insert [ CODE ] and [ /CODE ] tags around the code (without the spaces) or click on the # button to do it for you. I usually just click on the # button and insert the code between the code tags to preserve the spacing.

                One thing I would try first is to take out the variable &MIC001 from the DDS and hard code the message ID to see if that works.

                Comment

                Working...
                X