ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Excpt

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

  • Excpt

    Hi

    I'm in the process of learning RPG.
    I would like some help understading the EXCPT command.
    For example, when I use EXCPTCALC in the C-SPEC, which records are written in CALC??
    Do I define the CALC before or after the records I want to write into it??
    Is it possible to include a record in the O-SPEC, under CALC, even though I didn't define it in the C-SPEC (before or after CALC)??

    Thanks a lot
    Stephanie

  • #2
    Re: Excpt

    Hi, the except can be used for printer out put so;

    PHP Code:
    C                   Except    Head 

    Oqsysprt   E            Head           1  1           
    O                       NowIso              12        
    O                       NowTime             
    +2        
    O                       ctlnam              80        
    O                                           
    +'Page' 
    O                       page          Z     +2        
    O                       df_user            120        
    O                       df_pgm             132 

    It can also be used to just update certain fields in a file, instead of updating all fields in the file.

    PHP Code:
    C                   EXCEPT    UPHDR 

    O          E            UPHDR 
    O                       RPSCDS
    O                       RPWHSE 
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Excpt

      Originally posted by Alligator View Post
      Hi

      I'm in the process of learning RPG.
      I would like some help understading the EXCPT command.
      For example, when I use EXCPTCALC in the C-SPEC, which records are written in CALC??


      Thanks a lot
      Stephanie
      Please tell me you mis-spelled that and you meant EXCEPT - you're not learning RPG III surely?

      No records are written to CALC - CALC is the name of the exception group. That group can reference records in multiple files.

      On the EXCEPT you name the exception group. The records that will be written are _all_ of those in the O-specs identified as exception output (the "E" in column whatever) and having the exception name "CALC".

      Comment


      • #4
        Re: Excpt

        EXCEPT or EXCPT writes exception output to a file, whether printer or disk, as opposed to output being written at detail or total time by the RPG cycle. The name after the EXCEPT or EXCPT is a label which appears again in the output specifications and identifies the fields to be written out and the file they are to go to.. No indicators are used on the label in the output specs, but indicators can be used to condition the EXCEPT or EXCPT.

        John McKay
        jmckay@mckaysoftware.ie
        We offer website development and custom software on AS400. We also create spreadsheets.
        John McKay
        jmckay@mckaysoftware.ie
        http://www.rpglanguage.com

        Comment


        • #5
          Re: Excpt

          Thanks for your replys, but that is not exactly what I meant.
          If I have a database with columns from A to I.
          I have 3 excpt lines.
          How do I define/know which of the columns goes under which excpt line.
          I can see no direct link between all the calculations done before the first excpt line, and the output it generates.
          For example, I only calculate column D, put in an excpt line, but in the output of that excpt line I use columns F to H.
          Thanks

          Comment


          • #6
            Re: Excpt

            To start with, the terminology we use in AS400 RPG is records and fields, not columns and rows.
            Each EXCPT or EXCEPT will write out one record, or it wil update one record, depending on the structure of the program. The fields which are changed in the calcs bear no relationship to those written out.

            To write out field D onto a new record, use code like ...

            FFILENAME O A DISK

            C EXCEPT EXCLABEL

            OFILENAME EADD EXCLABEL
            O D

            To update field D onto an existing record, use code like ...

            FFILENAME UF K DISK


            C ANYKEY CHAIN FILENAME

            C EXCEPT EXCLABEL

            OFILENAME E EXCLABEL
            O D


            If you still have a problem, you may email me. But I wil need to know more about your program in that case.

            John McKay mba
            jmckay@mckaysoftware.ie
            We offer website development and custom software on AS400. We also create spreadsheets.
            John McKay
            jmckay@mckaysoftware.ie
            http://www.rpglanguage.com

            Comment


            • #7
              Re: Excpt

              hey Alligator, please paste a small snipit of code for us to look at.
              Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

              Comment

              Working...
              X