425 pts.
 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.

Software/Hardware used:
ASKED: October 22, 2009  2:18 PM
UPDATED: October 22, 2009  8:57 PM

Answer Wiki:
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
Last Wiki Answer Submitted:  October 22, 2009  5:37 pm  by  philpl1jb   44,630 pts.
All Answer Wiki Contributors:  philpl1jb   44,630 pts. , CharlieBrowne   33,695 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

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

 425 pts.

 

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

 110,105 pts.