15 pts.
 Output file
I have an logical file,3 physical files and i need to create an output file which will extract all the data present in the files how can i do that using RPG.

Software/Hardware used:
ASKED: January 10, 2012  4:23 PM
UPDATED: March 19, 2012  1:44 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question. Michael Tidmarsh   11,400 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

We need more specifications
What do the input files look like?
What should the output file look like?
How would the data be collated?
Phil

 44,180 pts.

 

I have an logical file,3 physical files…

Does that mean you have four files? Or does it mean that you have a logical file that is built over three physical files?

how can i do that using RPG.

I don’t seem to understand the question. The answer is to read records from each input file and write every one of those to the output file. But that is so obvious that it doesn’t seem like it makes sense. Please describe the circumstances more fully.

Tom

 108,055 pts.

 

logical file is not dependent on those physical file
In logical file i have some 30 columns but i need only 8 of them and all the columns from physical files should be extracted
here is the sample
dow the indicator is off
read logical file
if indicator is off
den i wll be moving the fields
similarly, i will be reading the physical files and writing dem in output file
but i don’t where i went wrong not getting the output.

 15 pts.

 

We don’t know
.. Not getting the output!
Do you have an output command after the Move of fileds
WRITE to an open file or EXCEPT to an open spool file.
.. Not getting the output!
Because the spool file isn’t being sent to a printer?
or because you haven’t looked in the output file?

Phil

 44,180 pts.

 

You description of the logic seems okay. But we can’t tell what is wrong without seeing the program code, and we might need a little more explanation of what happens beyond “…not getting the output.”

Tom

 108,055 pts.

 

As Tom said, it’s hard to tell without seeing your code and we can not tell if there are records in the files.

If you are using the same indicator for all loops you’re logic will never enter the second, third or fourth files.

I would always perfer to write a read loop like this

Read file1
Dow not %EOF(file1) <– if this is RPG as opposed to RPG IV then an indicator is needed
move stuff
write RecOut
Read file1
Enddo

Phil

 44,180 pts.