Compiler directives

Compiler directives

Post by Henry Wallac » Fri, 15 Dec 2000 15:55:38



Is it possible by using the /if /elseif /else compiler directives to
compile for a target release e.g.

if tgtrls = 4.4  or higher compile      
evalr x = z

else if lower

move z     x

All of this in one program ?

thanks

 
 
 

Compiler directives

Post by Ken S » Sat, 16 Dec 2000 11:29:44


Hi Henry -

On Thu, 14 Dec 2000 08:55:38 +0200, Henry Wallace


>Is it possible by using the /if /elseif /else compiler directives to
>compile for a target release e.g.

You could do it, but you would have to put in the program /if
directives for each possible possible release or set of releases that
you would want to detect, and you would have to specify the
appropriate condition-name(s) on the CRTBNDRPG or CRTRPGMOD command to
activate the proper directives.

Ken
http://www.ke9nr.org/
Opinions expressed are my own and do not necessarily represent the views of my employer or anyone in their right mind.

 
 
 

Compiler directives

Post by Thomas Raddat » Sat, 16 Dec 2000 04:24:11


I do not think that it is possible since I think that there is no way to
get the target release information into the program so that you can query
it with a IF compiler directive. In addition there is no way to use a
GREATER AS statement.

What you may do is:

IF DEFINED new_releases
        do this
ELSE IF
        do that
ENDIF

For that you have to pre-define "new_releases" at the DEFINE keyword of the
CRTBNDRPG or CRTRPGMOD command. Probably you can write a command shell for
the CRTRPDMOD command that pre-defines "new_releases" after having looked
at the target release specified. RTVCMDSRC made by Dave McKenzie may give
you a good start.

But that is nothing new for you, I guess.

Lets see if some else has a better idea for that interesting problem.

Thomas Raddatz.

Henry Wallace schrieb:

Quote:

> Is it possible by using the /if /elseif /else compiler directives to
> compile for a target release e.g.

> if tgtrls = 4.4  or higher compile
> evalr x = z

> else if lower

> move z     x

> All of this in one program ?

> thanks

--
*=====================================================*

   e-mail Adresse:

   Homepage:
        http://www.tools400.de

*=====================================================*

 
 
 

Compiler directives

Post by B Morri » Sun, 17 Dec 2000 06:15:06


If this is a once-only thing, or only related to one release (say V4R4),
then something like Thomas suggests is reasonable.

If you have a lot of target-release specific code, for several different
releases, you could compile like this:
  CRTBNDRPG TGTRLS(V3R2M0) DEFINE(V3R2M0)
and then use a /copy file like this, with a 4-line block in order for
each release that you're interested in.  Defining releases would end
when the release that was define on the command was reached.  So if you
said DEFINE(V3R2M0), it would skip the first /IF, it would define
V3R1M0, and then it would jump out at the second /IF /EOF, and not
define V3R6M0 etc.

Note that it has to be a /COPY file, otherwise /EOF would terminate the
whole compile.

  /IF DEFINED(V3R1M0)
  /EOF
  /ENDIF
  /DEFINE V3R1M0
  /IF DEFINED(V3R2M0)
  /EOF
  /ENDIF
  /DEFINE V3R2M0
  etc.

then in your code
  /IF DEFINED(V4R4M0)
 C           EVALR    
  /ELSE
 C           MOVE
  /ENDIF

By the way, there will probably be support for this in the next release
of RPG, so I wouldn't advise people to set this up unless they have a
lot of release-specific code.

And anyway, supporting release-specific code can get very ugly very
fast, and easily become practically unmaintainable.  If the MOVE code
produces the same result as the EVALR code, I wouldn't recommend trying
to keep two versions of the code.  You could put in a comment like
  * CHG-V4R4  change the next 4 lines to EVALR
and then when you didn't need to compile earlier than V4R4, you could
scan for CHG-V4R4 and change the code.

Barbara Morris


> I do not think that it is possible since I think that there is no way to
> get the target release information into the program so that you can query
> it with a IF compiler directive. In addition there is no way to use a
> GREATER AS statement.

> What you may do is:

> IF DEFINED new_releases
>         do this
> ELSE IF
>         do that
> ENDIF

> For that you have to pre-define "new_releases" at the DEFINE keyword of the
> CRTBNDRPG or CRTRPGMOD command. Probably you can write a command shell for
> the CRTRPDMOD command that pre-defines "new_releases" after having looked
> at the target release specified. RTVCMDSRC made by Dave McKenzie may give
> you a good start.

> But that is nothing new for you, I guess.

> Lets see if some else has a better idea for that interesting problem.

 
 
 

1. HTTP Protect directives

Hi,

I'm testing to protect some document directories on a http-server.

When I start the server, I get to login window, but the server always
refuses access.
I cannot find out where I misconfigured the server.
Can someone point me out.

I'm at V4R3 ptf level uptodate untill 24/9.
Following are the protect subdirectives.
I'm using the default HTTP user.
Has it to do with mismatching CCSIDs ? Are are there other things to define
or are there special gotcha's ?

Thanks in advance.

Luc

        00010     Protection ANNEX

        00020     AuthType Basic
        00030     ServerId TESTAnnex
        00040     PasswdFile QUSRSYS/ABVVVLDL
        00050     Groupfile /home/abvvgrp.grp
        00060     GetMask informatica, entreprise, secretariaat
        00070     PostMask informatica, entreprise, secretariaat
        00080     Mask all
        00090     }
        00100     Protect /home/annex/*  ANNEX

2. Acrobat Reader 4.05 Problem

3. Web Server Directives

4. MPI_Pack question?

5. Directives map exec

6. Send mail bypassing ISP's SMTP server.

7. WRKHTTPCFG problem - directives not recognised?

8. using your psion to administer Solaris boxes

9. BASIC compiler on Version 5 !!??

10. prev. RPG-compiler

11. RPG IV - ILE Compiler

12. RPG compiler for PC's

13. Help required on ILE C compiler