Hi,
my requirement is how can I open a file from another library in RPG program … noted that I have tried to use keyword : EXTFILE(LIBRARY _Nam / FILE_Nam) but it doesn’t work.
Please advise. Thanks!
Tarek yaseen
Software/Hardware used:
software
ASKED:
November 11, 2012 3:17 AM
UPDATED:
November 12, 2012 1:25 PM
Yes, it does work. You can’t tell us what you tried. You have to show us. Also, saying that it “doesn’t work” isn’t enough. You have to tell us what happened. Was there an error message? If so, which one? If not, did it open the wrong file? — Tom
EXTFILE(LIBRARY_Nam/FILE_Nam)1. If these are variables you should designate the file USROPN2. It should probably be 1 21 char variable that gets populated with the actual values and the /.3. Open the file after the variable is populated.
sorry a type USROPN !
and all caps.
Normal
0
false
false
false
EN-US
X-NONE
AR-SA
MicrosoftInternetExplorer4
Dear all – Many thanks for your response
You all right I’m sorry for missing details ….. But unfortunately
I’m
currently out of office
I will provide you with the message appeared when I tried to
use this command.
Regards,
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:”";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:”Times New Roman”;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
We’ll need more – F specs, D specs, C specs that relate to this issue.
Another option is to do an OVRDBF in the RPG using the QCMDEXEC command. Are you locked into doing this a specific way ?
Forgot to add you would still need to make the file user controlled and then do the file override to the other library , open file and close file commands manually.
try this below mentioned way… it definitely works.
hellofriends
That’s very nice but your code requires USROPN on the F spec and Open File1 in the C-spec. Files that aren’t USROPN are opened by the cycle … before any C spec’s are run and while it’s open it isn’t going to “re-target”.
Note that USROPN should only be required if the value of EXTFILE() is variable. If it’s constant, it can have the appropriate value at the time files are opened by the Cycle. — Toml
Gents
The message appeared was: ‘A right parenthesis is
expected but is not found’ when I used
keyword EXTFIL(Library_Name/FILE_Nam)
However, the below commands used and it works fine.
FCUSTMAST IF E K DISK EXTFILE (myFile)
D myFile S 21A Inz(‘KINPLIV/CUSTMAST’)
Many thanks… for your attention
Tarek
Normal
0
false
false
false
EN-US
X-NONE
AR-SA
MicrosoftInternetExplorer4
Correction: EXTFILE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:”";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:”Times New Roman”;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
The message appeared was: ‘A right parenthesis is expected but is not found’…
Message text is often less helpful than the message identifier. Different messages can have the same text.
when I used keyword EXTFIL(Library_Name/FILE_Nam)…
In this case, the message text is helpful. You didn’t show enough for us to see what Library_Name and FILE_Nam are, but now the text helps.
You can’t use two variables for library and file. You can only use a single variable to hold the entire name. When the compiler found the variable Library_Name, the next thing it expected to find was a right-parenthesis. Instead it found a slash character, “/”. The compiler didn’t know what to do with the slash, so it told you what it expected to find that was missing.
Tom
thanks Tom for clarifications.Tarek