birdych28 / RPG400

IBM AS400 RPG/ILEPRG
2 stars 0 forks source link

How share two user in same physical file in RPG code? #1

Open huseeinma opened 6 months ago

birdych28 commented 5 months ago

There have 2 method for solving this issue: (I). add the user member in this physical file who executed this program, and must create CLP Program to control open PF/Member by using OVRDBF

Like below :
CHGVAR VAR(%SST(&MBR 1 2)) VALUE(&DEPT) /
/
CHGVAR VAR(%SST(&MBR 3 8)) VALUE(' /
CHGVAR VAR(&MBR) VALUE(&USER)
ADDPFM FILE(LIBL/TWN863WF) MBR(&MBR) +
TEXT('TWN863WF: '
CAT &MBR TCAT ':USER MONMSG MSGID(CPF7306)
CHGDTAARA DTAARA(
LDA (101 10)) VALUE(&USER)
OVRDBF FILE(TWN863WF) TOFILE(LIBL/TWN863WF) +
MBR(&MBR) LVLCHK(
NO) SHARE(YES) +
SEQONLY(
YES)
CALL PGM(SAP860R)
DLTOVR FILE(*ALL)

 ENDPGM                                                             
birdych28 commented 5 months ago

Method 2: Use CLP ADDPFM , ADDLFM and OVRDBF to the file PATH

like below: ADDLFM FILE(AOUTFHLA) MBR(&FACTORY) +
DTAMBRS((AOUTFHP (&FACTORY))) +
TEXT('FACTORY : ' CAT &FACTORY TCAT '放行單資料 MONMSG MSGID(CPF7306)

ADDPFM FILE(AOUTFBP) MBR(&FACTORY) +
TEXT('FACTORY : ' CAT &FACTORY TCAT '放行單資料 MONMSG MSGID(CPF7306)
ADDLFM FILE(AOUTFBLC) MBR(&FACTORY) +
DTAMBRS((AOUTFBP (&FACTORY))) +
TEXT('FACTORY : ' CAT &FACTORY TCAT '放行單資料 MONMSG MSGID(CPF7306)

OVRDBF FILE(AOUTFHP ) TOFILE(AOUTFHP ) MBR(&FACTORY) +
LVLCHK(NO) SHARE(YES) SEQONLY(YES)
OVRDBF FILE(AOUTFHLA) TOFILE(AOUTFHLA) MBR(&FACTORY) +
LVLCHK(
NO) SHARE(YES) SEQONLY(YES)