write physical file member using RPGLE program

3790 pts.
Tags:
RPGLE Program
How to write record in Physical file member using RPG program...
i want insert record in pf member file..


Software/Hardware used:
as400 v5r3

Answer Wiki

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

i got the answer for write record in physical file member

i shared that concept coding….

Femp1 uf a e k disk usropn extmbr(a3) — emp1 -> pf name
Da3 s 10a
C eval a3=’EMP12′ — emp12 -> pf member name
C open emp1
C write employee — employee – pf record format name
C close emp1
C eval *inlr=*on

Thanks, Mr.Pradeep, Mr. Phil and Mr. Tom…….

Discuss This Question: 11  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
  • deepu9321
    You can use EXTMBR Keyword in F - Spec while defining the file.
    FSAMPLEPF  UF A E           K DISK    EXTMBR(MBR1) 
    The EXTMBR keyword specifies which member of the file is opened. You can specify a member name, '*ALL', or '*FIRST'. Note that '*ALL' and '*FIRST' must be specified in quotes, since they are member "names", not RPG special words. The value can be a literal or a variable. The default is '*FIRST'. The name must be in the correct case. For example, if you specify EXTMBR(mbrname) and variable mbrname has the value 'mbr1', the member will not be found. Instead, it should have the value 'MBR1'. Pradeep.
    3,650 pointsBadges:
    report
  • deepu9321
    Write Operation on a File will remain as usual(using WRITE Opcode). Records will be added to Selected Member using EXTMBR keyword. Pradeep.
    3,650 pointsBadges:
    report
  • pdsathishkumar
    i tried, but i didn't get the solution... i share my program with you... if you find the solution, share with me......... Femp1 uf a e k disk extmbr(a3) -- emp1-> pf name Da3 s 10a C eval a3='EMP11' -- emp11 -> pf member name C movel 120 empno -- empno -> field name C movel 'sathish' empname -- empname -> field name C write emp11 C eval *inlr=*on i got error --- *RNF7030 30 1 The name or indicator is not defined.
    3,790 pointsBadges:
    report
  • philpl1jb
    Arrrr yesss. It's the only user open trick. Your pogram trys to open the file prior to running any c-specs Therefore it is trying to open the member with a blank value for a3 Changes 1. add keyword USROPN to F-spec 2. add C-spec OPEN EMP1 after the c-spec C: ---- eval a3=’EMP11′ — emp11 -> pf member name 3. add C-spec CLOSE EMP1 before evel *INLR = *ON <-- this isn't necessary in this case. Phil
    49,550 pointsBadges:
    report
  • pdsathishkumar
    Mr. Phil, i tried your tips... but i didn't get solution.... i got error.. Froughdsp cf e workstn -- display file Femp1 uf a e k disk usropn extmbr(a3) -- emp1 -> pf name Da3 s 10a C open emp1 C eval a3='EMP11' -- emp11 -> pf member name C exfmt mbrw C write emp1 C close emp1 C eval *inlr=*on My error --- *RNF5063 30 1 Factor 2 operand must not be an externally described file for this operation.
    3,790 pointsBadges:
    report
  • TomLiotta
    First, move your OPEN statement after you set the member name in a3. You can't open the file until you set the member name. Then, use the record format name in your WRITE statement. You are using the file name. You tagged this with V5R3, but it's not totally clear what release you are compiling for. To be certain, use the record format name. I don't see anything else that might cause the RNF5063 error. Tom
    125,585 pointsBadges:
    report
  • pdsathishkumar
    Mr. Tom, i do it... but i got same error Froughdsp cf e workstn — display file Femp1 uf a e k disk usropn extmbr(a3) — emp1 -> pf name Da3 s 10a C eval a3=’EMP11′ — emp11 -> pf member name C open emp1 C exfmt mbrw C write emp1 C close emp1 C eval *inlr=*on my error --- *RNF5063 30 26 000502 Factor 2 operand must not be an externally described file for this operation.
    3,790 pointsBadges:
    report
  • deepu9321
    I guess, The error showing here is not because of the Member selection. But, Because of the Factor2(File Name) given on WRITE Opcode. For WRITE & UPDATE Operations you will need to mention the Record format name of the Physical file. Verify whether you have the same(EMP1) or Different Name. Pradeep.
    3,650 pointsBadges:
    report
  • philpl1jb
    These were all compile time errors. The compiled listing gives the error number - which you reported to use but if you search the code for that number it will either show you the line in error or give you the line number in error. Use that to investigate your code. Your first error *RNF7030 30 1 The name or indicator is not defined must have occurred because either EMPNO or EMPNAME wasn't defined in your file. Your second error *RNF5063 30 1 Factor 2 operand must not be an externally could be one of two lines your listing will tell you specifically which. C exfmt mbrw <-- this must be a record name in the file roughdsp C write emp1 <- this must be the record format name not the file name If you type DSPFD EMP1 you will see a description of the file emp1 including the record format name. Phil
    49,550 pointsBadges:
    report
  • TomLiotta
    There is no error that refers to duplicate definitions, so we're pretty sure that the record format name is not EMP1. (The error might not be shown, but I don't think that we'd see a RNF5063 if the file and format had the same name.) Phil's suggestion for using DSPFD will show you the record format name. Your compile listing should also show that record format name for the EMP1 file. The error is telling you that you can't use the file name. We can be pretty sure that the error doesn't apply to the EXFMT because the file name isn't used there. It almost has to be the WRITE statement. So don't use the file name on the WRITE statement. Change the statement. Use the record name. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    But most important, spend a little more time with the compile listing, you aren't getting as much out of it as you should. Phil
    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