Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

RPG won't accept a period in a database file name. How do I get around that?

The shop I am now working for has their database file naming standards as AA.BBBBxx.  In any version of RPG source, it won't let you use a period to define the file specs.  Is there anyway to do something like an override or rename in-line in the source so you only have to issue file overrides once before compile, and not every time it is executed?  That would be a pain and cause a lot of extra CL I'm trying to avoid.

Thanks!
0
RichEmpens
Asked:
RichEmpens
  • 5
  • 3
  • 2
  • +1
1 Solution
 
larksysCommented:
How do they do it now? It seems like you have a big renaming project in your future. Older RPG programs only accept 6 character file names. How are they getting around that? When I see a file name like yours, I think they are using the prefix and/or suffix to create "like" files. Mostly I use CMDEXEC to do file overides in the code. But, all of those files have to be USROPN. That's extra coding too.
0
 
RichEmpensAuthor Commented:
Yeah I see the same problem.  This whole system was written in RPGII and the file names were 6 or less.  The overrides occurred during the load and run proc.  I'm writing everything in RPG4 so more than 6 characters isn't a problem, but it still won't let me compile with a period in the name.  Yes, it was for grouping by use, such as PX.xxxx was a payroll file.  I know issuing overrides before compile or run will get me by, but that's a lot of CL overhead.  Was hoping there was something in the RPG4 language, like an alias, I could put in the source that would point to the file with the period.  Once compiled I wouldn't have to deal with it again.  Haven't found anything like that yet.
0
 
tliottaCommented:
RichEmpens:

Please supply the version/release of i5/OS (or OS/400 if it's that old) that's being used. If you're going to be using RPG, you gotta play by RPG rules. As it is, it sounds like RPG isn't the shop language; so, maybe you shouldn't be using RPG.

However, also keep in mind that most _basic_ jobs should use no OVRDBFs to start with. That means that you _shouldn't_ have much that will interfere. With that in mind, you _might_ get by with creating a single CL program that simply has nothing but a series of OVRDBFs:

  ==>  ovrdbf AABBBB01 tofile( AA.BBBB01 ) ovrscope( *JOB )
  ==>  ovrdbf AABBBB02 tofile( AA.BBBB02 ) ovrscope( *JOB )
  ==>  ovrdbf AABBBB03 tofile( AA.BBBB03 ) ovrscope( *JOB )
  ==>  ovrdbf AABBBB04 tofile( AA.BBBB04 ) ovrscope( *JOB )

Just call that as the first program in the job. It won't matter if file AABBBB04 is never referenced; but if it is, an override will be in effect.

Maybe that'll handle a big part of it. Maybe not. You can have quite a few overrides; they don't have to be used by any program in the job.

Tom
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
RichEmpensAuthor Commented:
We're on V5R1, and yes RPG is the shop language - it's all we use.  But the application software was developed on S/36, so it is all OCL and RPGII.  The application software is heavily used and still going strong, so no intent to upgrade it to the current platform is in sight.  However everything I've developed in the package since is native CL and RPG4.  Yep, I had already shelled out a global CL program to issue overrides to anything they might use, whether they do or not, everytime they signed on.   I had hoped there was a better, easier, and less forceful way, but it doesn't look like there is in RPG, unless of course defining aliases at compile time was a possibility, but so far I don't see that it is.
0
 
RichEmpensAuthor Commented:
Oh yeah and one more thing... all of the legacy code has the files defined within the program, so the need to override at compile time is not necessary.  Since all of my newer code uses native externally defined database files, I have to override the non-dot file name in the source to the dot file just to compile.  Another step I didn't want to take.

Unless there is some other way to fool IBM (sometimes not easily done), Tom's suggestion is what I've already set up as the only way to go.  I'll wait a couple of days just in case, but thanks Tom for confirming this and you'll get the points then.

Rich
0
 
tliottaCommented:
Rich:

Note that overrides are effective at compile-time as well as run-time... as long as the override is active in the compile job.

It's hard to imagine how "a better, easier, and less forceful way" could be defined. The S/36 environment really is a different system environment. The ability to swap out names by simple overrides seems pretty "a better, easier, and less forceful" already.

Of course, you don't want to be stuck with causing each individual to do the CALL to the program (and possibly forget), so you assign it as an "initial" program. Then the problem is that someone has to assign it to every user profile. It might be nicer if it were simply done automatically, eh?

One way to do that would possibly be to assign it as a "routing" program in the interactive subsystem.

Make a minor change so that the last executable instruction is TFRCTL QSYS/QCMD. This makes it fulfill the fundamental need of a routing program -- to start a command processor program. And QCMD is a very handy command processor since that's its fundamental purpose.

Look at the routing entries in QINTER (or whatever subsystem you want to affect) and you should see that the eventual target command processor for most routing entries that you use is QCMD. You can change any routing entry to call your program instead. As long as it does the TFRCTL before it ends, your routing program will do the steps that you wrote and then end up doing the normal QCMD stuff afterwards.

Once the appropriate routing entries are in place, interactive _or_ batch, your instructions will be automatic for _every_ job that's routed for work through those entries.

Making sense?

Tom
0
 
daveslaterCommented:
Hi
in RPGLE yo cn use the
EXTFILE(Filename)  parm on the F spec as a file override.

Dave
0
 
tliottaCommented:
Doh! Dave's right... EXTFILE() was added way back in V5R1. (Some PTFs _might_ be required for it to work correctly.)

Be aware that it compiles don't honor EXTFILE(); i.e., OVRDBFs must still be in place at compile-time.

Tom
0
 
daveslaterCommented:
Hi
what I use to do is create a library called "COMP_TIME".
Copy an empty version of  file into that library with the name you are going to use in the RPG, then simple add that library in the library list.

Saves all the overrides and you can still compile it in batch (as if  programmers would do anything else :) )
0
 
larksysCommented:
Dave - You da man.
0
 
RichEmpensAuthor Commented:
I'll be gone for a few days, but will pick up on what you all have said when I get back.  Thanks much for the input!  Rich
0
 
RichEmpensAuthor Commented:
Sorry it took so long for me to get back to this.  Tom, I did go with a CL program to issue the necessary overrides once the user signs on.  Since they all use an initial program in their user profile, I just added the call there.  Works good enough.  Since you were the first to suggest it, you get the points.  Thanks to all.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now