ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Another Dumb Question

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

  • Another Dumb Question

    Good afternoon,

    converting an existing program from using SQL to regular Do/Enddo read cycle. I am reading a Logical PRMSTRL3 with one key, MSSNO and using that value to read from another file and process records.

    File is stated as below:



    *---------------------------------------------------------*
    * *
    *---------------------------------------------------------*
    R PRMSTRF PFILE(PRMSTR)

    K MSSNO

    *--------------------------------------------------------*

    * ---------------------------------------------------------

    In the program:

    H Option(*NoDebugIO:*SRCSTMT)


    FCSTHST IF E K Disk
    FEMP125L3 IF E K Disk
    FPRMSTRL3 IF E K Disk
    F*

    //set compiler options
    exec sql set option COMMIT = *NONE,
    COMPILEOPT = 'DFTACTGRP(*no) ACTGRP(*new)';


    Main Code:

    Dou %EOF(PRMSTRL3);
    Read PRMSTRL3;
    If not %EOF(PRMSTRL3);

    @Print = ' ';

    If mssno <> savesocial;
    savesocial = mssno;
    else;
    iter;
    Endif;

    Setll SaveSocial Emp125L3;
    Dou %EOF(Emp125L3);
    Reade SaveSocial Emp125L3;
    If not %EOF(Emp125L3);


    If EFFDAT < Begyear and TRMDAT <> 0 and
    TRMDAT < BegYear;
    iter;
    Endif;

    If @Print <> ' ';
    Exsr $Write;
    Endif;

    Endif;
    EndDo;

    Endif;
    EndDo;

    Write EndRpt;

    Exsr $Eoj;


    The only field I can see when in debug is MSSNO, EFFDAT & TRMDAT. EFFDAT & TRMDAT are from the second file. Can't see any of the other fields. Compile debug value is *SOURCE. It is set as a SQLRPGLE pgm type. I changed that and it did not help. I took out the compiler options and that didn't help either. I would like to see the other field values of the record that was read. Any input would be appreciated.

    Thanks

  • #2
    I'm fascinated as to why on earth you would want to downgrade a program but ...

    You don't tell us why you want this info in debug so we are limited in our suggestions. One way of doing it is to add a DS defined as being LIKEREC the record in the main file. The add that DS name to the end of the READ i.e. Read PRMSTRL3 DSName;

    Comment


    • #3
      Originally posted by 64waves View Post
      The only field I can see when in debug is MSSNO, EFFDAT & TRMDAT. EFFDAT & TRMDAT are from the second file.
      What do you mean by this? What happens if you try an EVAL on the other fields?

      Comment


      • #4
        Good morning, I get 00000 or blanks when I EVAL on any other field in the files.

        I downgraded it due to the amount of records in each file for a specific Social. The structure of the files and what I have to check warrant this approach.

        thanks.

        Comment


        • #5
          I just added a small amount of code to check the value of another field. Now I can see the value. I guess I never noticed this before, or worked with CHAINs more than READs. I never recall having to specify the field in the program to see a value. Once you had a record, you should be able to see the value of any field in the record, was my thought.

          thanks for all the input.

          Comment


          • #6
            RPG only reads fields that you actually use in your program. The values of all of the other fields are blank. This is done for performance reasons -- if you don't use a field, there's no reason to do the extra work of copying it from the file.

            However, if you want to force RPG to always read all fields, you can add DEBUG(*INPUT) to your H-spec or CTL-OPT.

            Code:
                   ctl-opt DEBUG(*INPUT);

            Comment

            Working...
            X