sponsored links

Collapse

Announcement

Collapse
No announcement yet.

How to write "EVAL" command in RPG source?

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

  • How to write "EVAL" command in RPG source?

    I am the new member of this forum and RPG, so I have many questions. I wonder how to use "EVAL" command and the comparation as AND, OR in RPG source code.
    In this cases, I have to use "ANDEQ" or "OREQ".... to do

    as the description:
    0303.00 C CLR BEGSR
    0303.01 C EVAL COUNT=1
    0304.00 C ENDSR
    ****************** END OF DATA ****************************************






    PROMPT TYPE . . . C SEQUENCE NUMBER . . . 0303.01

    LEVEL N01N02N03 FACTOR 1 OPERATION FACTOR 2 RESULT
    EVAL COUNT=1
    DECIMAL
    LENGTH POSITIONS H/N/P HI LO EQ COMMENT


    ------------------
    I try but dont know to to use this command as above topics.
    (Maybe I used the old RPG version????)


    Please help me.
    Thanks a lot.


  • #2
    First we need to find out your OS version

    Please do this

    Code:
    DSPDTAARA QSS1MRI
    This will tell us what version you are running.

    You may also see this by using the
    GO LICPGm
    then taking option 10


    --Or--

    Look at the top of any compiled RPG program.



    I would also like you to show the error messages you are recieving.


    Welcome to Code400


    Take care
    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
      In your prompt heading there is "N01N02N03" which would indicate to me older RPG type--non-ILE. ILE only has one conditioning indicator level, and if your not using RPG ILE, I don't think you can use the EVAL op code.

      The source type should be RPGLE (if you are using WRKMBRPDM) to view your source members--and you need to have a version of the QRPGLESRC file to work off of, which has a slightly different (longer) record type than the older RPG types.

      Comment


      • #4
        PJK I think you got it

        Your source fle type is RPG not RPGLE

        Code:
                                   Work with Members Using PDM                 ROCKFORD 
                                                                                        
         File  . . . . . .   QPGMSRC                                                    
           Library . . . .     AUTOPRO              Position to  . . . . .              
                                                                                        
         Type options, press Enter.                                                     
          2=Edit         3=Copy  4=Delete 5=Display       6=Print     7=Rename          
          8=Display description  9=Save  13=Change text  14=Compile  15=Create module...
                                                                                        
         Opt  Member      Type        Text                                              
              WKR32       RPGLE       Display current/pending Permit requirements       
              WKR32AD     DSPF        Display current/pending Permit requirements       
              WKR33       SQLRPGLE    Move routed pronumber(s)                          
              WKR33AD     DSPF        Move routed pronumber(s)
        Source files for RPG are created with rcdlen(92)

        you must create your source file for RPGLE as rcdlen(112)

        crtsrcpf testlib/qrpglesrc rcdlen(112)

        check out the command CVTRPGSRC This will allow you toconvert your RPG to RPGLE.


        Hope this helps
        Jamie
        thank God for the weekend!
        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


        • #5
          Thanks Mr jamief a lot
          Follow each of helping step:
          - CRTSRCPF MYLIB/QRPGLESRC RCDLEN(112)
          (i created the member QRPGLESRC)
          and I can write code with "EVAL" operator and some comparation simpler. (position for code edit longer than normal!

          but when I use:
          - CVTRPGSRC FROMFILE(PNEVJUN/BT0101) FROMMBR(QRPGSRC) TOFILE(PNEVJUN/BT0101B) TOMBR(QRPGLESRC)

          the compiler displayed error: "CONVERSION TERMINATED". I don't know what happened, maybe it can not convert???
          (BT0101 is very simple code)

          Can you explain more about the difference features between RPG and RPGLE!

          Thanks in advance!
          uidamt98

          Comment


          • #6
            There is a required message queue

            Lets get this conversion working forst then well play with some new functions.....

            Could you also modify your ID and let us know where you are from. And add an image or Ill pick one for you



            Take a look at this this is important part - QARNCVTLG

            Code:
            Because there are syntax differences, IBM has included the 
            CVTRPGSRC command to automatically convert RPG III source 
            code to RPG IV.  Before using this utility, you should create new 
            source files (or change your existing ones) to have a record 
            length of 112 bytes.  This is necessary  because the format of 
            source records was changed to support expanded field names 
            and op-codes.
            
            
            Enter the CVTRPGSRC command in the following format:
            
            
            CVTRPGSRC FROMFILE(library/source-file) FROMMBR(source-
            member)TOFILE(library/source-file) TOMBR(source-member)
            
            
            The FROMFILE and FROMMBR parameters should indicate the old 
            RPG III source file and member.  The TOFILE and TOMBR 
            parameters should indicate the name and location where the 
            enerated RPG IV source code will be placed.
            
            
            Note:  If this is the first time the CVTRPGSRC command has been 
            un on your system, you may get an error message stating "Log 
            file QRNCVTLG in library *LIBL not found".  If this is the case, 
            either (a) use the Create Duplicate Object command (CRTDUPOBJ) 
            command to copy the existing log file QARNCVTLG from library 
            RPGLE to a log file named QRNCVTLG in the library in your library 
            ist, or (b) specify LOGFILE(*NONE) on the CVTRPGSRC command.
            
            
            When the command completes, you will have an RPG IV version of
            the program in the specified location.  Note that if you have 
            any "/copy" statements in your program, the copy member(s) will 
            also need to be converted.
            
            The CVTRPGSRC command will simply convert your RPG III code 
            line-by-line to RPG IV syntax.  It will not automatically update 
            your code to use the enhanced RPG IV op-codes (such as Eval) .
            
            
            Note:  There are third party conversion utilities on the market 
            (reasonably priced) that will automatically convert your code to 
            use some of the RPG IV language elements.  These utilities do a 
            good job, but you should be careful, as there may be undesired 
            effects when switching to the new RPG IV op-codes.  We'll cover 
            some of these effects in the next few sections.
            
            
            Start by converting a small, working program that you are familiar
             ith and look at the results.  Use PDM option 14 to compile the 
            rogram.  Notice that the command CRTBNDRPG (Create Bound 
            RPG Program) is used instead of CRTRPGPGM (Create RPG 
            Program).  This is a one-step compile process, as opposed to the 
            two-step process we'll cover in the ILE section.  
            Your program should compile and run normally.
            
            
            Now, go back to the original RPG III program and add a data-
            structure and a table or array.  Perform the conversion again and 
            see how it converted those elements.

            Comment


            • #7
              Your syntax is wrong:

              CVTRPGSRC FROMFILE(PNEVJUN/BT0101) FROMMBR(QRPGSRC) TOFILE(PNEVJUN/BT0101B) TOMBR(QRPGLESRC)


              should be

              CVTRPGSRC FROMFILE(PNEVJUN/QRPGSRC) FROMMBR(BTO101) TOFILE(PNEVJUN/QRPGLESRC) TOMBR(BTO101B)


              The member is the source member name. The file is QRPGSRC/QRPGLESRC, etc

              Comment


              • #8
                Now, I I don't know my program written by RPGII, RPGIII or RPGIV. So When I compile as "arrow483" teach, screen display "NO MEMBERS TO CONVERT".

                I think my version is RPGII? Right?

                Please explain for new RPGer more :-)

                Thanks a lots,
                Attached Files

                Comment


                • #9
                  Looks like RPGII to me


                  Please add a location to your forum location field so we know where you are from.

                  Okay i think you may have replaced a *ZERO with the letter "O"

                  If the conversion cannot find the member then:[list=a][*]your library list does not contain PNEVJUN[*]You dont have Authority to source file or member[*]You miss typed the name of the member[/list=a]

                  I created your library added member BTO201
                  and did this
                  Code:
                  CVTRPGSRC FROMFILE(PNEVJUN/QRPGSRC) FROMMBR(BTO201) 
                  TOFILE(PNEVJUN/QRPGLESRC) TOMBR(BTO201)
                  it converted fine.

                  then I replaced the letter "O" with a *ZERO in FROMMBR like this
                  Code:
                  CVTRPGSRC FROMFILE(PNEVJUN/QRPGSRC) FROMMBR(BT0201) 
                  TOFILE(PNEVJUN/QRPGLESRC) TOMBR(BTO201)

                  and got this error
                  Code:
                  Previous commands and messages:                         
                     > CVTRPGSRC FROMFILE(PNEVJUN/QRPGSRC) FROMMBR(BT0201)
                              TOFILE(PNEVJUN/QRPGLESRC) TOMBR(BTO201)     
                       No members to convert.                             
                       Conversion terminated.
                  If you want send me the source to the entire program and i will try conversion here.


                  Jimmy

                  Comment


                  • #10
                    Looks like RPG III

                    I can't tell from the source you posted, but I don't believe RPG II supported LEAVE or ENDDO. But since the syntax for RPG II and RPG III are almost the same, I don't think I can say for sure.

                    However, that's prob not your problem. If you ran a RPG II source through CVTRPGSRC, it would either convert or give you a list of errors. The "NO MEMBERS" error indicates the converter can't find the source.

                    Did you get any spool output?

                    If you do a DSPJOBLOG after the failure, are there messages about the convert that indicates why it may not have run?

                    And, as suggested, make sure the letter O and number 0 are consistent.

                    BTW, If you are just starting with RPG, forget about using SEU to enter source. Install WDSc and/or CODE on your PC an use that. It gives instant syntax checking, color, and a one-button convert source to RPG-IV option.

                    Comment

                    sponsored links

                    Collapse

                    Working...
                    X