ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Default H-Specs for Compiles

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

  • Default H-Specs for Compiles

    Code:
    Can I set up some default values for my control (H) 
    specifications in an RPG program?
    
    
    Can I set up some default values for my control 
    (H) specifications in an RPG program?
    
    A: Yes, the RPG compiler looks for control (H) 
    specifications in two other locations, if 
    none are specified in the program's 
    source member: 
    
    A data area called RPGLEHSPEC anywhere in 
    the library list, and DFTLEHSPEC in 
    library QRPGLE. 
    
    For RPG/400, these data areas are called 
    RPGHSPEC in *LIBL and DFTHSPEC in QRPG. 
    To copy some RPG H specifications into 
    every ILE RPG program, create a data 
    area named RPGLEHSPEC and put the keywords 
    and values in it. The data area can be as 
    long as required to contain the keywords 
    and values. Since the compiler stops 
    looking as soon as it finds a valid 
    control specification, you can replace 
    the data area options by coding values 
    in the H specifications of an individual 
    program, or ignore everything in the data 
    area by including a blank H specification.
    
    Be very careful of this last one. I had 
    gotten out of the habit of using * on 
    blank comment lines since it is not 
    required in RPG IV, but a line with 
    just an H in column 6 anywhere will 
    ignore all the options in your data 
    area, so be sure to always use H* 
    for any blank lines. 
    You could use this command:
    
    CRTDTAARA DTAARA(RPGLEHSPEC) TYPE(*CHAR) LEN(112) 
    VALUE('Option(*SRCSTMT:*NODEBUGIO)') + 
    TEXT('Default Control (H) Specs for RPG IV')
    
    Select "work with data areas type options" 
    and press enter.
    
    On the compiler listing, the first pages 
    will show the defaults for all the options, 
    so it looks like your data area was ignored. 
    Look farther down past the last H specification 
    to see the effects of the override.
    
    And finally, be sure to document in your programs 
    that you are using the data area to avoid 
    driving maintenance programmers crazy in the 
    future trying to identify the source 
    of these compiler options.
    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

  • #2
    Re: Default H-Specs for Compiles

    OH My GOD! You're actually condoning the act of COMMENTS??? That's Blasphemy!

    Honestly.. I thought that was like being a memeber of a Fraternity... you were just supposed to pass "the lack of" commenting along to the newbies! <hehe>

    Comment


    • #3
      Re: Default H-Specs for Compiles

      On a v5r3 system, (RZKH.DE public)

      I have set up an area called RPGLEHSPEC

      Running DSPDTAARA DTAARA(RPGLEHSPEC) gives :

      Option(*SRCSTMT:*NOEXPDDS)

      But compiles are defaulting to the opposite of those options , and the compiler is also ignoring any HOPTION(...) clauses.

      I logged off / on again, my data area is still there, but the compiler is still ignoring it.

      Is it because I'm using option "14", and that has been setup with the "opposite" options ?

      If I enter CRTBNDRPG on the command line and press F4, then fill in the options I want, they do take effect but that's a pain

      *** DSPDTAARA DTAARA(QRPGLE/DFTLEHSPEC) gives
      "Data area DFTLEHSPEC in QRPGLE not found. "

      Mike

      Comment


      • #4
        Re: Default H-Specs for Compiles

        You example works for me on V5R3 and 6.1. Whatever is going on seems odd (or very obscure). It doesn't seem to be obvious.

        ...and the compiler is also ignoring any HOPTION(...) clauses.
        I assume that that means you have H-specs in your source that are ignored. That would be irrelevant to a library list problem for a data area, so it implies that something deeper is going on. It shouldn't have anything to do with "using option '14'". The OPTIONS() parameters of the compile commands don't have default values, so something like CHGCMDDFT won't set other values.

        I'd ask the providers of "(RZKH.DE public)" if perhaps a pre-compiler is being used or if compiler PTFs are up to date. Maybe they have a custom setup with their own CRTxxxxxx commands or they use the command-change exit point.

        Tom
        Tom

        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

        Comment


        • #5
          Re: Default H-Specs for Compiles

          If I enter CRTBNDRPG on the command line and press F4, then fill in the options I want, they do take effect but that's a pain
          Rats. I just re-read what you wrote and saw that sentence again. What happens if you specify CRTBNDRPG OPTIONS(*XREF) on the command line with your data area or with explicit H-specs?

          Tom
          Tom

          There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

          Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

          Comment


          • #6
            Re: Default H-Specs for Compiles

            What do you see when you type 14 and then prompt it? is it the same as when you type in the CRTBNDRPG?
            Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

            Comment


            • #7
              Re: Default H-Specs for Compiles

              I would not use the H spec data area. I would use a /COPY file instead.

              The H spec data area is only checked if you don't code an H spec. As soon as you code an H spec in one of your source files, the data area will be ignored, and you won't have your defaults.

              By using /COPY, you can add additional H spec keywords in any particular module. As a bonus, if you code the /COPY of your defaults in every source member, you'll prevent your compiles being affected by someone adding one of the H spec data areas to the system.

              When you say the compiler is ignoring the HOPTION clauses, do you mean the ones coded in the source file? The prolog at the top of the compile listing will show the options when the compile started. You have to look in the listing after the H spec to see the options in effect.

              Comment


              • #8
                Re: Default H-Specs for Compiles

                If you use /COPY for your default options, you might want to add some conditional-compile directives to allow some keywords to be specified a different way in a particular source member.

                Whether that's important depends on what keywords you're putting in the defaults. If it's just the OPTION keyword, it might not matter. But if it's something like say DATFMT, there might be some case where someone wants a different DATFMT (assuming you would allow that ... me, I think anything other than *ISO is crazy talk).

                Code:
                 /if not defined(HSPEC_SKIP_DATFMT)
                H    datfmt(*iso)
                 /endif
                 /if not defined(HSPEC_SKIP_TIMFMT)
                H    timfmt(*iso)
                 /endif
                 /if not defined(HSPEC_SKIP_CCSID_CHAR)
                H    ccsid(*char : *jobrun)
                 /endif
                 /if defined(*crtbndrpg)
                 /if not defined(HSPEC_SKIP_DFTACTGRP)
                H dftactgrp(*no)
                 /endif
                 /if not defined(HSPEC_SKIP_ACTGRP)
                H actgrp(*CALLER)
                 /endif
                 /endif
                Code:
                 /define HSPEC_SKIP_ACTGRP
                 /copy copysrc,dft_hspec
                H actgrp(*new)

                Comment


                • #9
                  Re: Default H-Specs for Compiles

                  I agree that /COPY is a better choice. I'm still curious what the specific problem is though.

                  Tom
                  Tom

                  There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                  Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                  Comment


                  • #10
                    Re: Default H-Specs for Compiles

                    Originally posted by tomliotta View Post
                    I agree that /COPY is a better choice. I'm still curious what the specific problem is though.

                    Tom
                    The problem was / is ... once again ..... PICNIC !!!!!

                    >You have to look in the listing after the H spec to see the options in effect.

                    Well "sorta" duh (to me).

                    I haven't used any compiler options before this, was just getting sick of slogging through the extra "junk" I didn't need to see

                    When I DID change the options I ASSumed they would only be listed ONCE, so I never really looked carefully enough to notice that there was a "SECOND" listing of the "over rides".

                    Everything is actually working as it should be ! :

                    - HOPTION(*SRCSTMT:*NOXREF:*NOEXPDDS)

                    or

                    - (No H specs), and I get :
                    Code:
                     *--------------------------------------------------------------------------
                     * DTAARA . . . . . . . . . . :  MSTRAM1/RPGLEHSPEC                         
                     *--------------------------------------------------------------------------
                    HOption(*SRCSTMT:*NOEXPDDS)                                                 
                     *--------------------------------------------------------------------*     
                     * Compiler Options in Effect:                                        *     
                     *--------------------------------------------------------------------*
                    or (just tried ... thanks Barbara !)

                    H/COPY HOPT1

                    Well it gave me a chance to cobble a simple compiler CL script /program, and to find out about how
                    Code:
                     MONMSG MSGID(RNS9310)
                    works.

                    Mike (the (sometimes ..) clumsy RPGLE / iSeries newbie

                    Comment


                    • #11
                      Re: Default H-Specs for Compiles

                      And I had /assumed/ that no expanded DDS was showing, so the *NOEXPDDS couldn't have been in effect. I should've asked right off how it was known that the options weren't active. Glad it's resolved.

                      Tom
                      Tom

                      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                      Comment

                      Working...
                      X