OS/400 physical file overridden

635 pts.
Tags:
AS/400
OS/400
Physical Files
Hi, I have two physical files File1 in library 1 and library2. What i am thinking of overriding FileX and FileY to lib1/file1 and lib2/file2 in CLP. In my RPG i am using FileX and FileY and reading records from FileX and writing to FileY. IS this possible?

Software/Hardware used:
OS/400
ASKED: January 10, 2011  11:16 AM
UPDATED: January 18, 2011  1:09 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Thank you for visiting ITKE.

We are happy to help you with solving specific IT questions, but need as
much information as possible to do so. Let us know about the problem you
are trying to solve, how you are approaching it and what work you’ve
done so far, and we can help guide you in the right direction.

Discuss This Question: 12  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    You should review existing items in the AnswerWiki before asking. The same (homework?) question was asked last week -- Same files in different AS/400 RPG library. Tom
    125,585 pointsBadges:
    report
  • Sangay
    Thanks for reply. The link posted below shows the method which i know already and i want alternatives for this case. The files(FILEX and FILEY) were overridden. Both file objects do not exists on the system. How to handle this in RPG program. Is there any precompiler commands as well?
    635 pointsBadges:
    report
  • CharlieBrowne
    If you are compiling a RPG program and the files are externally defined. They must be on the system or you will not be able to compile. If they are internally defined. that is not a problem.
    39,815 pointsBadges:
    report
  • Sangay
    Can you please tell me if there is any option to change the file name in the program during compilation. Suppose File1 to FileX during compilation and object Filex should not exist in the system.
    635 pointsBadges:
    report
  • CLKelly
    Sangay, You can type the override command(s) and then compile the program interactively rather then in batch. You could also write a CL program that does the overrides and then run the appropriate compile command. Carolyn
    120 pointsBadges:
    report
  • TomLiotta
    Can you please tell me if there is any option to change the file name in the program during compilation. There are two separate times to pay attention to when you are using externally-described files. First is when a program is compiled. The compiler uses the name on the F-spec to locate the external description. If there is no *FILE object with that name, the compiler cannot create the necessary structures to process the F-spec. So either you create a *FILE object with that name or you provide an override with OVRDBF in the job that runs the compilation. You can temporarily create a *FILE object with the F-spec name by running the CRTDUPOBJ command. This duplicate does not need any of the data; it is only a small container for the description of the file. When you create a duplicate file description, you don't need overrides. The only options "to change the file name in the program during compilation" are creating duplicate files with names that match the F-specs and running OVRDBF in the job that runs the compile. If the compile is submitted to batch, then any overrides must be submitted in the same job -- that usually requires writing a CL program that does the OVRDBFs and the compile in a single program. The second time that the F-spec file name is important is when the program runs. And again there are two options. You can run OVRDBF commands in the same job that runs the program or you can use the F-spec keywords to provide the external name and library. Any OVRDBF commands may be run in the job before the program is called or they may be run by the program by passing them to an API before the program opens the file. Files that are overridden by the RPG program must be specified with USROPN. This lets you delay opening the file until after the override is done. If the external name is changed by using a variable in the EXTFILE() keyword, then the file also must be specified as USROPN. This again lets you delay opening the file until after the variable value is set. Tom
    125,585 pointsBadges:
    report
  • Sangay
    HI Tom, Your approach is what i was looking for but i am afraid that i am not able to figure the steps to Override the files during compilation. Any help. Thanks, Siddharth
    635 pointsBadges:
    report
  • YuVa47
    Hi Sangay, Here is an example that you can use/test:
    FFILE1        IF   E           K DISK    EXTFILE(fileY ) 
    FFILE2        IF   E           K DISK    EXTFILE( fileX) 
    F                                                        Prefix(x_) Rename(Rfile2: xRfile2) 
    
    D fileY                s             21a   Inz('LIB1/FILE1') 
    D fileX                s             21a   Inz('LIB2/FILE2') 
    
    
    In this way you don't need to make any OVRDBF in the CL because its done in your RPG program. Good luck, YuVa
    1,285 pointsBadges:
    report
  • TomLiotta
    Both file objects do not exists on the system. Is this still true? If the objects don't exist, there is no way to override to point to them. The objects need to exist. The names don't matter; they only need to have the appropriate file descriptions. Then you can use overrides. Tom
    125,585 pointsBadges:
    report
  • Sangay
    hi All, the approach was simple, just had to override the file with a new file name(filex) which does not exist yet. RPG program will be compiled. For overhead of overidding again and again, created a new CL which overrides the file and then compile the programs. Thanks all for your responses and suggestion. Best, Sangay
    635 pointsBadges:
    report
  • TomLiotta
    ...just had to override the file with a new file name(filex) which does not exist yet. If FILEX is the F-spec name, it needs to exist unless you override the compile to point to another file that does exist. Further, if you override to another file, that file must have the same format-level identifier that FILEX will have. Otherwise there will be a level-check error when the program runs. That's why you would use a duplicate of the file description -- to ensure a format-level match. Tom
    125,585 pointsBadges:
    report
  • Sangay
    [...] 8. CharlieBrowne, TomLiotta, CLKelly, and YuVa47 talked out overridden OS/400 physical files. [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following