Defaults the Physical file with ‘%’ for Character fields and -9999 for Numeric fields.

170 pts.
Tags:
AS/400
IBM DB2
RPG
RPG ILE
Hi all, I have requirements in which I have to pass the file as parameter to another program with defaulting the field value as, If character field default the first character as '%' and if Numeric default till the length of the field with -9999. As per now I'm getting two options. 1. Create the outfile of the PF, read it in prog and loop the file to default the value on the basis of field type. 2. Create an another external file,with default values. Define in my program as external data structure and move the values to the other file. But I'm not finding both the options good. Can anyone suggest me something better. It will be great help.

Software/Hardware used:
AS400, Iseries,

Answer Wiki

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

Discuss This Question: 4  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
    I don't quite understand. Do you need to create a file that has default values defined for its fields? Or are you creating a file and adding records to it that have values in the fields? . Those are two different things. The first has no records, but the fields have attributes for "defaults". The second does have records, but might not have field attributes for "defaults"; instead it simply has values in the fields. . What command are you using to "create" the file? . What is the point? What purpose is served? What business problem is being solved? . Tom
    125,585 pointsBadges:
    report
  • ToddN2000
    The request seems confusing. Are you to read a file, then set default values for all missing fields? If so, you could have an issue if the file is defined with unique keys and one of them is to be updated with your default value. Do we know the file layout to determine the field types and length to set the defaults properly ? If this is to be used for multiple files, I am assuming this because you state you are passing the file as a parameter. Not all files have the same format/layout so creating this as a generic program make little sense. Show us what you have tried.
    11,245 pointsBadges:
    report
  • ddaswani
    Appreciate you take time to understand my prob. and Sorry for the confusion, Lets Me give a better try. We have product for Insurance. Suppose we create a policy and we want to change some data into it. e.g. Premium Now we will create the file with data only in premium field, for rest of the fields we have to pass the default value for Numeric we have to pass '-9999' and for character fields we have to pass '%'. The problem is if we pass the blanks or Zeros in rest of the fields , it will get override. so we need to pass the default values so prevent the override. Now the 2 ways which i m getting it. 1. Create the outfile of DSPFFD and read the file in my prog to identify the data type of fields and populate the fields with default value which should not be changed in product. and move the data in fields which needs to be updated. 2. Create a structure similar to that file and default the values in DDS. Defined the file in program and move the data in the fields which we need to change and the rest of fields will be defaulted automatically. I hope this time you don't have any problem.
    170 pointsBadges:
    report
  • TomLiotta
    Both of your suggested alternatives make good sense. The choice might be determined by the exact situation. . Now, what exactly do you mean by "pass the file as parameter to another program". What will be 'passing' the file? How are you intending to 'pass' it? Will you 'pass' from one RPG program procedure to another RPG procedure? Can you show an example of the CALLP statement and the prototype that you expect to use? . 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