Suggesions for programming task in RPG

pts.
Tags:
RPG
RPG Subroutine
RPG/400
Hi I have a task to perform Create a screen with a date and year field,the value given in this field will be mapped to a database file and a set of records will be retrieved from this file with the screen values as select conditions.This has to be further written to a new file. Please suggest .....

Answer Wiki

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

– here is the basic flow
– this design uses the “load all” Subfile strategy
– this is appropriate if the number retrieved is low
and the work to prepare a subfile record is low.

exfmt Screen1 – get date and year
Edit inupts — return to screen1 if bad inputs

clear subfile
setll in file using key’s entered
read record from file
Dow more records
format and write record to subfile
read record from file
enddo
Screen 2 – subfile displaying list of items retrieved
on f12 return to screen1
or f03 exit program

Discuss This Question: 3  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
  • am not very comfortable with subfile concepts. I have a suggestion not sure if its right. Get the values from the screen as parameters Declare a key list to which these values are moved later,chain with the database file and if present write the data to another file that has been declared as o/p.May be i need to put this in a loop. Can you please suggest a code logic using opcodes like chain,reade etc.
    0 pointsBadges:
    report
  • The screen has from date and to date so that is another problem.If it was just for one date i could have have mapped it with the file.But since its a range am confused...Please help with a solution...
    0 pointsBadges:
    report
  • philpl1jb
    You'll need to get to subfiles eventually but meanwhile this is a good project. If the file is keyed with the fromDate field then you can use the key with setll and reade- if this isn't the case then it might look a little like this? *loval setll myfile read myfile dow not %eof(myfile)) if dateIn >= fromDate and datein <= toDate write newRecord endif read myfile
    49,550 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