Different files same fields, can’t I use them without renaming?

2505 pts.
Tags:
AS/400
AS/400 file field usage
I have 10 files and I am making a report out of these files, I have 10 record formats in my printer file each corresponds to each file. I have used 10 subroutine for each files and writing to report independently. My program is working well but I need a clarification, is this a fair approach?

Software/Hardware used:
As400

Answer Wiki

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

Your subject line  and the text do not seem to match.Subject lines indicates it does not work, but the text says it does.

If is difficult to answer you question without more information about the process.

But, if it is working, I would say it is a fair approach.

Discuss This Question: 10  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
    Since we can't see your programming, we don't know if it is coded appropriately or not. We don't know your OS version nor what languages you are programming in. We don't know if you're using native I/O or SQL. We don't know your report structure. We don't know the business logic that relates the files to each other. I don't see a way to guess if you're using a fair approach or not. -- Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    If the fields with the same name have the same structure then this will work.  If they don't have the same structure the program won't compile.  
    49,950 pointsBadges:
    report
  • ToddN2000
    I assume the record formats are a different layout but keep the same fields and field definitions. If you are processing just 1 file at a time it should work fine? If the record formats are the same I would see if making it either a parameter driven applications based on the individual file or in the code use a call QCMDEXC to do an OVRDBF to access the other files and still have all the data on one report.
    11,100 pointsBadges:
    report
  • WoodEngineer
    Do all 10 files need to be open at the same time?
    6,670 pointsBadges:
    report
  • TomLiotta
    It's not possible to say if it's a "fair approach" or not. We don't have the code to see if alternatives will work.   We don't know the OS version. We don't know what language you're coding in. If it's RPG, we don't know OPM or ILE.   If the files are processed separately, we don't know why you would need to rename any of the fields. Under many logic circumstances, it's not needed, nor is prefixing or qualification. Specifying data structures isn't even needed.   But we don't know anything about the files. We don't know if relationships exist or the business logic that brings them together.   We don't know what the report's business purpose is nor its structure.   Renaming is useful because it takes no extra CPU cycles in your C-specs. By using appropriate naming techniques in D-specs, you can often simplify a lot of C-specs. But it's only needed when values from multiple fields with the same names in different files are needed simultaneously, and then only if you don't specify separate data structures. If files are processed separately without separate data structures, there's no need for renaming in RPG. It can, however, be useful if logic is complex and maintenance will be easier if the values are individually identified.   As it is, we don't even know if any C-specs are needed at all. It's possible that this program could be a very straightforward 'Cycle' program with no I-, C- or O-specs (except possible references to external database and printer files).   So, it might be a "fair approach". Or it might be unnecessary. No way to know from the question.   Tom
    125,585 pointsBadges:
    report
  • rajeshece
    It will work. But Field values will be taken from last read File. It may create confusion
    1,215 pointsBadges:
    report
  • RamvishakRamesh
    All 10 files open at the same time. I have put 10 'ExSR subroutine' one after the other.  And each subroutine is meant for each file and in each of these subroutine I am writing each printer file record format. From the discussion I conclude the last file read will override the previous value in the field and so there wont be any issue.
    2,505 pointsBadges:
    report
  • TomLiotta
    From the discussion I conclude the last file read will override the previous value in the field and so there wont be any issue.   If the program structure and code is correct, then your conclusion will be correct. But if you code differently, then your conclusion can be wrong. The use of subroutines has bearing on this at all, so there's no reason to mention that to use. Things will work exactly the same if you put the code in-line.   But numerous other coding elements could make your conclusion wrong.
    125,585 pointsBadges:
    report
  • WoodEngineer
    IBM provides an easy technique to make field names unique when the same name is used in multiple files in a single program.  Check out the F-spec keywork "PREFIX". 
    6,670 pointsBadges:
    report
  • TomLiotta
    It will work. But Field values will be taken from last read File. It may create confusion   Any programming element will be confusing to someone not familiar with that element.   A MOVE statement in COBOL can be confusing to someone who expects the value to be moved rather than copied. Trigraphs in C can be confusing to... well, almost anyone who isn't using them regularly. List parameters in CL commands are confusing to CL programmers who first try to assign variables to them.   Tom
    125,585 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