Define F specs in Fully Free RPG |
Defined F specs in Fixed RPG vs Free form RPG
Here we defined F specs File statements in RPG fixed format and their respective free format. We use DCL-F operation code for free form File statements, followed by the file name and then by zero or more keywords, and ends with a semicolon.
Define Externally described disk file without a key and open for Input
FFILE1 IF E DISK
The device type and usage are determined by default for file1 and they can also be defined explicitly as can be seen below declarations.
DCL-F FILE1;
or
DCL-F FILE1 DISK(*EXT) USAGE(*INPUT);
or
DCL-F FILE1 DISK USAGE(*INPUT);
Define Externally described disk file with a key and open for Input
FFILE1 IF E K DISK
The device type and usage are determined by default for file1 and they can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED;
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*INPUT);
or
DCL-F FILE1 DISK KEYED USAGE(*INPUT);
Define Externally described disk file with a key and open for Input and using PREFIX(rename file field) keyword
FFILE1 IF E K DISK PREFIX(X)
The device type and usage are determined by default for file1 and they can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED PREFIX(X);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*INPUT) PREFIX(X);
or
DCL-F FILE1 DISK KEYED USAGE(*INPUT) PREFIX(X);
Define Externally described disk file with a key and open for Input and using RENAME(Rename file record format name) keyword
FFILE1 IF E K DISK RENAME(RFILE1:RFILE1CHG)
The device type and usage are determined by default for file1 and they can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED RENAME(RFILE1:RFILE1CHG);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*INPUT) RENAME(RFILE1:RFILE1CHG);
or
DCL-F FILE1 DISK KEYED USAGE(*INPUT) RENAME(RFILE1:RFILE1CHG);
Define Externally described disk file with a key and open for Input and using both PREFIX and RENAME keyword
FFILE1 IF E K DISK RENAME(RFILE1:RFILE1CHG) F PREFIX(X)
The device type and usage are determined by default for file1 and they can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED RENAME(RFILE1:RFILE1CHG) PREFIX(X);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*INPUT) RENAME(RFILE1:RFILE1CHG) PREFIX(X);
or
DCL-F FILE1 DISK KEYED USAGE(*INPUT) RENAME(RFILE1:RFILE1CHG) PREFIX(X);
Define Externally described disk file with a key and open for Update.
FFILE1 UF E K DISK
The device type(DISK) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED USAGE(*UPDATE);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*UPDATE);
or
DCL-F FILE1 DISK KEYED USAGE(*UPDATE);
Define Externally described disk file without a key and open for Output only.
FFILE1 O E DISK
The device type(DISK) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 USAGE(*OUTPUT);
or
DCL-F FILE1 DISK(*EXT) USAGE(*OUTPUT);
or
DCL-F FILE1 DISK USAGE(*OUTPUT);
Define Externally described disk file with a key and open for Input and Output both without Update.
FFILE1 IF A E K DISK
The device type(DISK) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED USAGE(*INPUT:*OUTPUT);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*INPUT:*OUTPUT);
or
DCL-F FILE1 DISK KEYED USAGE(*INPUT:*OUTPUT);
Define Externally described disk file with a key and open for Input and Output both With Update as well.
FFILE1 UF A E K DISK
The device type(DISK) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED USAGE(*UPDATE:*OUTPUT);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*UPDATE:*OUTPUT);
or
DCL-F FILE1 DISK KEYED USAGE(*UPDATE:*OUTPUT);
Define Externally described disk file with a key and open for Input and Delete.
FFILE1 UF E K DISK
The device type(DISK) and USAGE(*INPUT) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED USAGE(*DELETE);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*DELETE);
or
DCL-F FILE1 DISK KEYED USAGE(*DELETE);
DCL-F FILE1 KEYED USAGE(*INPUT:*DELETE);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*INPUT:*DELETE);
or
DCL-F FILE1 DISK KEYED USAGE(*INPUT:*DELETE);
Define Externally described disk file with a key and open for Update and Delete and Write.
FFILE1 UF A E K DISK
The device type(DISK) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 KEYED USAGE(*UPDATE:*DELETE:*OUTPUT);
or
DCL-F FILE1 DISK(*EXT) KEYED USAGE(*UPDATE:*DELETE:*OUTPUT);
or
DCL-F FILE1 DISK KEYED USAGE(*UPDATE:*DELETE:*OUTPUT);
Define Externally described disk file without a key and opened for Input and using EXTFILE keyword.
FFILE1 IF E DISK EXTFILE('EASYCLASS1/FILE1')
The device type(DISK) and USAGE(*INPUT) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 EXTFILE('EASYCLASS1/FILE1');
or
DCL-F FILE1 DISK(*EXT) USAGE(*INPUT) EXTFILE('EASYCLASS1/FILE1');
or
DCL-F FILE1 DISK USAGE(*INPUT) EXTFILE('EASYCLASS1/FILE1');
or
DCL-F FILE1 USAGE(*INPUT) EXTFILE('EASYCLASS1/FILE1');
or
DCL-F FILE1 DISK EXTFILE('EASYCLASS1/FILE1');
or
DCL-F FILE1 DISK(*EXT) EXTFILE('EASYCLASS1/FILE1');
Define Externally described disk file without a key and opened for Input and using EXTMBR keyword.
FFILE1 IF E DISK EXTMBR('FILE1')
The device type(DISK) and USAGE(*INPUT) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 EXTMBR('FILE1');
or
DCL-F FILE1 DISK(*EXT) USAGE(*INPUT) EXTMBR('FILE1');
or
DCL-F FILE1 DISK USAGE(*INPUT) EXTMBR('FILE1');
or
DCL-F FILE1 USAGE(*INPUT) EXTMBR('FILE1');
or
DCL-F FILE1 DISK EXTMBR('FILE1');
or
DCL-F FILE1 DISK(*EXT) EXTMBR('FILE1');
Define Externally described disk file without a key and open for Input and using EXTFILE and EXTMBR keyword.
FFILE1 IF E DISK EXTFILE('EASYCLASS1/FILE1') EXTMBR('FILE1')
The device type(DISK) and USAGE(*INPUT) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
DCL-F FILE1 EXTFILE('EASYCLASS1/FILE1') EXTMBR('FILE1');
or
DCL-F FILE1 DISK(*EXT) USAGE(*INPUT) EXTFILE('EASYCLASS1/FILE1') EXTMBR('FILE1');
or
DCL-F FILE1 DISK USAGE(*INPUT) EXTFILE('EASYCLASS1/FILE1') EXTMBR('FILE1');
or
DCL-F FILE1 USAGE(*INPUT) EXTFILE('EASYCLASS1/FILE1') EXTMBR('FILE1');
or
DCL-F FILE1 DISK EXTFILE('EASYCLASS1/FILE1') EXTMBR('FILE1');
or
DCL-F FILE1 DISK(*EXT) EXTFILE('EASYCLASS1/FILE1') EXTMBR('FILE1');
Define Externally described disk file without a key and open for Input and using LIKEFILE keyword to define another file.
FFILE1 IF E DISK BLOCK(*NO) FFILE2 LIKEFILE(FILE1) * FFILE3 IF A E DISK FFILE4 LIKEFILE(FILE3)
The device type(DISK) and USAGE(*INPUT) is determined by default for file1(optional) and can also be defined explicitly as can be seen below declarations.
When a file is defined with LIKEFILE, the F for the parent file has to decide whether or not the file is blocked. It is necessary to specify the BLOCK keyword for the parent file. For example, for an input DISK file, the BLOCK keyword is required if the file is used in a LIKEFILE keyword. For an Input-Add DISK file, the file can never be blocked, so the BLOCK keyword is not required.
DCL-F FILE1 BLOCK(*NO); DCL-F FILE2 LIKEFILE(FILE1); DCL-F FILE3 USAGE(*INPUT:*OUTPUT) ; DCL-F FILE4 LIKEFILE(FILE3);
or
DCL-F FILE1 DISK(*EXT) USAGE(*INPUT) BLOCK(*NO); DCL-F FILE2 LIKEFILE(FILE1); DCL-F FILE3 DISK(*EXT) USAGE(*INPUT:*OUTPUT); DCL-F FILE4 LIKEFILE(FILE3);
or
DCL-F FILE1 DISK USAGE(*INPUT) BLOCK(*NO); DCL-F FILE2 LIKEFILE(FILE1); DCL-F FILE3 DISK USAGE(*INPUT:*OUTPUT); DCL-F FILE4 LIKEFILE(FILE3);
or
DCL-F FILE1 USAGE(*INPUT) BLOCK(*NO); DCL-F FILE2 LIKEFILE(FILE1); DCL-F FILE3 USAGE(*INPUT:*OUTPUT); DCL-F FILE4 LIKEFILE(FILE3);
or
DCL-F FILE1 DISK BLOCK(*NO); DCL-F FILE2 LIKEFILE(FILE1); DCL-F FILE3 DISK USAGE(*INPUT:*OUTPUT); DCL-F FILE4 LIKEFILE(FILE3);
or
DCL-F FILE1 DISK(*EXT) BLOCK(*NO); DCL-F FILE2 LIKEFILE(FILE1); DCL-F FILE3 DISK(*EXT) USAGE(*INPUT:*OUTPUT); DCL-F FILE4 LIKEFILE(FILE3);
Define Externally described PRINTER file opened for output.
The usage is determined by default as Output for the printer files and can be seen below from the free format RPG declaration. We need to give file type as PRINTER for printer files. We can associate an overflow indicator through *IN01-*IN99(Used with Externally described Printer Files) and *INOA-*INOG, *INOV(Used for Program Described Printer files) using the OFLIND(Indicator) keyword.
FPRTF1 O E PRINTER OFLIND(IN01)
DCL-F PRTF1 PRINTER OFLIND(IN01) ;
or
DCL-F PRTF1 PRINTER USAGE(*OUTPUT) OFLIND(IN01);
Define Externally described Display file(WORKSTN) opened for both input and output.
The usage is determined by default as Input and Output for the WORKSTN files.
FDSPF1 CF E WORKSTN
DCL-F DSPF1 WORKSTN;
or
DCL-F DSPF1 WORKSTN(*EXT);
Define Externally described Display file(WORKSTN) opened for both input and output and using indicator data Structure INDDS.
The usage is determined by default as Input and Output for the WORKSTN files.
FDSPF1 CF E WORKSTN INDDS(DS1)
DCL-F DSPF1 WORKSTN INDDS(DS1);
or
DCL-F DSPF1 WORKSTN(*EXT) INDDS(DS1);
Define Externally described Display file(WORKSTN) opened for both input and output and using subfile SFILE.
The usage is determined by default as Input and Output for the WORKSTN files.
FDSPF1 CF E WORKSTN SFILE(SFLRFMT:RRN)
DCL-F DSPF1 WORKSTN SFILE(SFLRFMT:RRN);
or
DCL-F DSPF1 WORKSTN(*EXT) SFILE(SFLRFMT:RRN);
Define Externally described Display file(WORKSTN) opened for both input and output and using EXTDESC keyword.
The usage is determined by default as Input and Output for the WORKSTN files. We will define DSPF1NEW which is opened in combined mode using the file description from external format DSPF1.
FDSPF1NEW CF E WORKSTN EXTDESC(DSPF1)
DCL-F DSPF1NEW WORKSTN EXTDESC(DSPF1);
or
DCL-F DSPF1NEW WORKSTN(*EXT) EXTDESC(DSPF1);
Related Post
Define D specs in fully free RPG AS400
Define H,F,D,P specs in fully free RPG AS400