Unable to overwrite file with OVRDBF

425 pts.
Tags:
OVRDBF
DCLF FILE(EMP001P)                                                                                                    RCvF RcdFmt(EMPREC)                                                                                                   OVRDBF FILE(EMP001P) TOFILE(EMP001P) MBR(SECOND) + SHARE(*YES)                                 MONMSG MSGID(CPF0000)  EXEC(SNDUSRMSG  MSG("ERROR") )                                                                 RCvF RcdFmt(EMPREC)                                        

Here, I'm unable to overwrite the EMP001P file with second record. pls suggest correct way to do it.

Answer Wiki

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

You are correct.
DCLF in CL opens files when the program starts –
Therefore the OVRDBF is too late

One strategy might be to have a CL with OVRDBF then calls the CL with the DCLF

I’m sure our experts have a few more clever options
Phil

========

If your are trying to process all the data in a multimbr file, you might try something like this.
RTVMBRD EMP001P RTNMBR(&vMbrName)
Loop:
OVRDBF EMP001C Mbr(&MbrName)
Call xxxxxx — phil thinks this is calling the cl program with the DCLF

– phil thinks that DLTOVR EMP001C should be right about here
RTVMBRD EMP001P MBR(&MbrName *Next) RTNMBR(&MbrName)
MonMsg (CPF3049 CPF9815) Exec(Goto End)
GOTO CMDLBL(Loop)
END:

CharlieBrown — with comments by phil

Discuss This Question: 2  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
  • Kar
    Here, I'm unable to overwrite the EMP001P file with second member. pls suggest correct way to do it.
    425 pointsBadges:
    report
  • TomLiotta
    That's right. The override isn't going to override a file that's already been opened in your CL program. The override could only affect a second CL program that you might call after the override. You don't say anything about what OS version/release you are working with. If you're at V5R4 or later, you might be able to declare two different file names. Override the first file name to your first actual file and override the second file name to your second actual file. I've never seen any need to do this, so I haven't tried it -- I don't know how the conflicting field names might be handled by CL. I probably wouldn't do this in CL in the first place. CL is not a language for data manipulation other than basic input. 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