Announcement

Collapse
No announcement yet.

declaring primary file in fully free format RPGLE and *RNF7421

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

  • declaring primary file in fully free format RPGLE and *RNF7421

    Hi,

    How can we declare primary file in a fully free format RPGLE program also how to avoid *RNF7421-Operands are not compatible with the type of operator.
    for below piece of program:-


    If fld1 = 'ABCDEF' AND +
    %Date(fld2 : *CYMD) = %Date AND +

    (fld3 = 'AAA' or FLD3 = 'BBB');


    Thanks .....


  • #2
    1) "How can we declare primary file in a fully free format RPGLE" - You can't. The cycle is effectively deprecated in modern RPG so support in free-form file declarations made no sese.

    2) " ...also how to avoid *RNF7421" - Easy - code the statement correctly. There should not be a "+" sign at the end of the line. I am assuming that you think it is needed to continue the IF - it is not - a continuation character (+ or -) is only needed when splitting a literal across lines. The way you have coded it the compiler probably thinks you are trying to add the result of an expression to a date which makes no sense. So try:
    Code:
    If  ( fld1 = 'ABCDEF' ) and ( %Date(fld2 : *CYMD) = %Date )
       and  (fld3 = 'AAA' or FLD3 = 'BBB');

    Comment


    • #3
      i did the same now still *RNF7030- The name or indicator is not defined and *RNF7503 error is appearing,please refer attcahed program and error snapshots for the same.



      Thanks...
      Attached Files

      Comment


      • #4
        Look at your third line - there's a colon where it should say OR.

        If you still have a problem then check the data types of the fields concerned.

        P.S. You don't need the /Free and /End-Free stuff - it hasn't been needed for years.

        Comment


        • #5
          still same error ( when I placed OR instead of colon( at line number 8) at same line number 8 apart from *RNF7503-Expression contains an operand that is not defined apart from *RNF7030 on same line number 8:- 'the name or indicator AND is not defined.'


          thanks...

          Comment


          • #6
            Originally posted by John192 View Post
            still same error ( when I placed OR instead of colon : at line number 8) at same line number 8 apart from *RNF7503-Expression contains an operand that is not defined apart from *RNF7030 on same line number 8:- 'the name or indicator AND is not defined.'


            thanks...
            and data type of A4B6CE is character only.

            Thanks...

            Comment


            • #7
              If it is flagging "AND" as not defined then you haven't made the changes correctly. This compiles:
              Code:
              **free
              dcl-s fld1 char(6);
              dcl-s fld2 packed(7);
              dcl-s fld3 char(3);
              If fld1 = 'ABCDEF' AND
              ( %Date(fld2 : *CYMD) = %Date ) AND
              ( fld3 = 'AAA' or FLD3 = 'BBB');
              Endif;
              *InLr = *On;
              Compare your version and locate the difference(s).

              Comment


              • #8
                Now when i changed it as per advised syntax then getting new error at line no. 6 :*RNF0604 "The token is not valid;token is ignored."


                Also my A4B6CE field length is 10 and defined as character field in file y1.

                Please refer the attached screenshots of updated version of program and errors.



                Thanks...


                Attached Files

                Comment


                • #9
                  Hi,

                  Could someone please advise here how can I correct this error ?


                  Thanks much...

                  Comment


                  • #10
                    John, please stop posting screen shots of your code. Paste the actual code so anyone who wants to help you doesn't have to type all the code themselves.

                    Also, just paste in the relevant errors from the listing as text, not as screen shots.

                    Comment


                    • #11
                      Please find below program which I have been trying to compile and getting this error during compilation:-"*RNF0604 20 327 000600 The token is not valid; token is ignored. "

                      Code:
                      FY1 IP E K DISK RENAME(FA4REAM: Y1REC)
                      FY2 IF E K DISK
                      FY3 O E DISK RENAME(FA4REAM: Y3REC)
                      FY4 IF E K DISK RENAME(FARREAQ: Y4REC)
                      IF A4AJCD= 'ASVCIT' AND
                      ( %DATE(A4CRTD : *CYMD) = %DATE ) AND +
                      ( A4B6CE = 'API' OR A4B6CE = 'APC');
                      
                      SETLL (A4AKNB: '1') Y4;
                      if %equal;
                      write y3rec;
                      EndIf;
                      ENDIF;
                      EVAL *INLR=*ON;

                      Thanks...

                      Comment


                      • #12
                        I'd suggest you compare your source snippet with the solution JonBoy gave you. Then you should see what's wrong.

                        Comment


                        • #13
                          Both are same only he used some fixed variables whereas I have the field names defined in my files with different length and syntaxwise both seem same only, not sure what is wrong with my code yet.


                          Thanks..

                          Comment


                          • #14
                            What about the PLUS (+) after AND????

                            Comment


                            • #15
                              even if I remove that plus(+) i get the same error ..


                              Thanks..

                              Comment

                              Working...
                              X