- Using INFDS with INFSR to catch file exception in RPG AS400
<
https://www.as400andsqltricks.com/2021/12/Using%20INFDS%20with%20INFSR%20catch%20file%20exception%20in%20RPGLE.html>
I am trying to put in INFSR just to prove I can do it.
Not sure about the "D File *file"
D FILE *FILE
* File name
D OPEN_IND 9 9N
* File open
D EOF_IND 10
10N * File at eof
D STATUS
*STATUS * Status code
D OPCODE
*OPCODE * Last opcode
D ROUTINE
*ROUTINE * RPG Routine
D LIST_NUM 30
37 * Listing line
D SPCL_STAT 38 42S
0 * SPECIAL status
D RECORD
*RECORD * Record name
D MSGID 46 52
* Error MSGID
D SCREEN
*SIZE * Screen size
D NLS_IN
*INP * NLS Input
D NLS_OUT
*OUT * NLS Output
D NLS_MODE
*MODE * NLS Mode?
Here is what I have in my code.
dcl-f SFL004DF workstn infds(Info) Sfile(Sfl1:Rrn1)
Sfile(Sfl2: Rrn2);
dcl-ds info;
list_num char(07) pos(30);
spcl_stat packed(4:0) pos(38);
msgid char(07) pos(46);
Cfkey char(01) pos(369);
open_ind ??(9:9);
eof_ind ??(9:9);
statue *status;
optcode *optcode;
routine *routine;
record *record;
screen *size;
nls_in *input;
nls_out *output;
nls_mode *mode;
end-ds;
33 dcl-ds info;
34 list_num char(07) pos(30);
35 spcl_stat packed(4:0) pos(38);
36 msgid char(07) pos(46);
37 Cfkey char(01) pos(369);
38 open_ind ind(9:9);
==> abcde
3308 20 a 003800 Keyword name is not valid; the keyword is ignored.
39 eof_ind ind(9:9);
==> abcde
3308 20 a 003900 Keyword name is not valid; the keyword is ignored.
same error twice. I know that
45 nls_in *input;
==> aaaaaa
3308 20 a 004500 Keyword name is not valid; the keyword is ignored.
46 nls_out *output;
==> aaaaaaa
3308 20 a 004600 Keyword name is not valid; the keyword is ignored.
47 nls_mode *mode;
48 end-ds;
If anyone wants to look at the code on PUB400.COM
user profile is COBOLKID
pw bear1963
library is cobolkid1
and in QRPGLESRC member SFL004RG
Original code is from Kevin Vandever. But I am going through and converting
the F and D specs to free format.
And want to add some error routine ability.
Not finding any examples on the internet of free format for
dcl-f SFL004DF workstn infds(Info) Sfile(Sfl1:Rrn1)
Sfile(Sfl2: Rrn2);
Will not even go into if the MONITOR command is a better way to go. Which I
think might be the way, but I want to solve the problem both ways.
Thomas
As an Amazon Associate we earn from qualifying purchases.