Now, Get RPG Codes in all three formats only on this website on every RPGLE related programming article.

Fixed, /Free and Fully Free RPG


Define F specs in Fully Free RPG

Define F specs in Fully Free RPG
Define F specs in Fully Free RPG, Define F specs in rpg all free, rpg free format , free format file definition, display file definition in rpg all free, printer file definition in rpg all free, fully free rpg, **FREE, WORKSTN.DCL-F, Using DCL-F, rpgle, as400, f specs in rpg fixed and free format, ibmi
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

  • Fixed RPG
  •      FFILE1     IF   E             DISK
    
  • Free RPG
  • 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

  • Fixed RPG
  •      FFILE1     IF   E           K DISK
    
  • Free RPG
  • 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

  • Fixed RPG
  •      FFILE1     IF   E           K DISK    PREFIX(X)
    
  • Free RPG
  • 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

  • Fixed RPG
  •      FFILE1     IF   E           K DISK    RENAME(RFILE1:RFILE1CHG)
    
  • Free RPG
  • 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

  • Fixed RPG
  •      FFILE1     IF   E           K DISK    RENAME(RFILE1:RFILE1CHG)
         F                                     PREFIX(X)
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     UF   E           K DISK
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     O    E             DISK
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     IF A E           K DISK
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     UF A E           K DISK
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     UF   E           K DISK
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     UF A E           K DISK
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     IF   E             DISK    EXTFILE('EASYCLASS1/FILE1')
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     IF   E             DISK    EXTMBR('FILE1')
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     IF   E             DISK    EXTFILE('EASYCLASS1/FILE1') EXTMBR('FILE1')
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FFILE1     IF   E             DISK    BLOCK(*NO)
         FFILE2                                LIKEFILE(FILE1)
          *
         FFILE3     IF A E             DISK   
         FFILE4                                LIKEFILE(FILE3)
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FPRTF1     O    E             PRINTER OFLIND(IN01)
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FDSPF1     CF   E             WORKSTN 
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FDSPF1     CF   E             WORKSTN INDDS(DS1)
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FDSPF1     CF   E             WORKSTN SFILE(SFLRFMT:RRN)
    
  • Free RPG
  • 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.

  • Fixed RPG
  •      FDSPF1NEW  CF   E             WORKSTN EXTDESC(DSPF1)
    
  • Free RPG
  • 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

    2 comments

    1. Excellent !!!
    2. Excellent !!!
    © AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain