Results 1 to 10 of 10

Thread: How to write "EVAL" command in RPG source?

  1. #1
    Code400 Newbie uidamt98's Avatar
    Join Date
    Nov 2004
    Location
    Vietnam
    Age
    33
    Posts
    27
    Rep Power
    0

    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. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Age
    21
    Posts
    1,000,000
     

  3. #2
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12604

    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

  4. #3
    Moderator pjk's Avatar
    Join Date
    Sep 2004
    Location
    Wisconsin USA
    Posts
    144
    Rep Power
    929
    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.

  5. #4
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12604

    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

  6. #5
    Code400 Newbie uidamt98's Avatar
    Join Date
    Nov 2004
    Location
    Vietnam
    Age
    33
    Posts
    27
    Rep Power
    0
    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

  7. #6
    Registered User jimmyoctane's Avatar
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    210
    Rep Power
    0

    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.

  8. #7
    Experienced Forum Member arrow483's Avatar
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    1,741
    Rep Power
    4217
    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

  9. #8
    Code400 Newbie uidamt98's Avatar
    Join Date
    Nov 2004
    Location
    Vietnam
    Age
    33
    Posts
    27
    Rep Power
    0
    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 Attached Files

  10. #9
    Registered User jimmyoctane's Avatar
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    210
    Rep Power
    0

    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

  11. #10
    Experienced Forum Member arrow483's Avatar
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    1,741
    Rep Power
    4217

    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.

  12. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

Facebook Comments


Similar Threads

  1. RPGLE program that edits rpg source code
    By gtank in forum RPG/RPGLE
    Replies: 5
    Last Post: March 30th, 2011, 07:47 AM
  2. disable write to thumb drive from XP
    By jamief in forum Whatever (not programming related)
    Replies: 0
    Last Post: August 2nd, 2006, 04:53 PM
  3. Write Text, XML, HTML to the IFS
    By kpmac in forum JAVA
    Replies: 0
    Last Post: February 21st, 2006, 10:00 PM
  4. QCMDEXC question
    By slabadie in forum RPG/RPGLE
    Replies: 5
    Last Post: October 31st, 2005, 10:07 AM
  5. Example of free program
    By jamief in forum ANY THING GOES
    Replies: 0
    Last Post: September 16th, 2005, 09:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •