Difference between revisions of "Test268 Section 1"

From MidrangeWiki
Jump to: navigation, search
(Use EXTFILE. EXTMBR and OPEN/CLOSE file operations in a program)
(Use EXTFILE. EXTMBR and OPEN/CLOSE file operations in a program)
Line 80: Line 80:
  
 
==== EXTMBR ====
 
==== EXTMBR ====
 +
  
 
==== OPEN ====
 
==== OPEN ====
 +
open myfile;
  
 
==== CLOSE ====
 
==== CLOSE ====
 +
close myfile;
  
 
=== When using externally described files, rename fields ===
 
=== When using externally described files, rename fields ===

Revision as of 23:24, 30 November 2005

<< Previous Section | Home | Next Section >>

Section 1 - Externally Described Files in Programs (14%)

Use printer files and "O" specs to define output in a program

Even though this is not used as much anymore, there is still a lot of programs out there that still use this.

FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++Comments++++++++++++
FMYOUTPUT  O    F  132        PRINTER OFLIND(OVERFLOW)                                         

OFilename++DF..N01N02N03Excnam++++B++A++Sb+Sa+.............................Comments++++++++++++
OMYOUTPUT  E            HEADINGS          2  1                                                 
O          E            HEADINGS2         2                                                    
O          E            DETAILLINE        1                                                    
O          E            BREAKLINE         1                                                    
O          E            TOTALLINE         1

Use database file I/O operations in a program

Grab one particular record in a file:

      chain (employee) empfile;

Write a record:

      write roperator;

Set the pointer to a spot in the file then read all records that match the key:

      setll (employee) emphist;
      reade (employee) emphist;
      
      dow not %eof();
        ::: Logic here :::
        reade (employee) emphist;
      enddo;

Update a record:

      update record;

Use display file I/O operations in a program

Write a display record:

      write footer;

EXFMT:

      exfmt screen1;

Read a display record:

      read screen;

Use externally described database files in a program

FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++Comments++++++++++++
FMYFILE    IF   E           K DISK

Use externally-described printer files in a program

FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++Comments++++++++++++
FREPORT    O    E             PRINTER USROPN OFLIND(*IN40)

Use externally-described display files in a program

FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++Comments++++++++++++
FREPORT    CF   E             WORKSTN

Create DDS externally described files

.....A..........T.Name++++++RLen++TDpB......Functions+++++++++++++++++++++++++++
     A          R CURCOEMAIL         
     A            CMPNY          4  0
     A            EMAILADDR1   100   
     A            EMAILADDR2   100

Create SQL externally described files

CREATE TABLE LAWCUSTDBF.CUPCOEMAIL ( 
       CMPNY DECIMAL(4, 0) NOT NULL DEFAULT 0 , 
       EMAILADDR1 CHAR(100) CCSID 37 NOT NULL DEFAULT  , 
       EMAILADDR2 CHAR(100) CCSID 37 NOT NULL DEFAULT  ) ;

Use EXTFILE. EXTMBR and OPEN/CLOSE file operations in a program

EXTFILE

Can be used to open a specified file at runtime.

EXTMBR

OPEN

open myfile;

CLOSE

close myfile;

When using externally described files, rename fields

When using externally described files, show how to rename record formats in a program

FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++Comments++++++++++++
FMYFILE    IF   E             DISK    RENAME(MYFILE:MYREC)

Create Physical, Logical/View, Printer, and Display externally described files

Use a field reference file to create an externally described file

<< Previous Section | Home | Next Section >>