Wednesday, September 11, 2019

Library section in Easytrieve

In Library Section Easytrieve have below statements

FILE statement - This statement describes the files accessed by the program.

Syntax: FILE <filename> <filetype> <devicetype> <recordformat>

Example: FILE INFILE      FB(80 0)

File Name: same as DD name in JCL (max length is 8 char)

File Type: specifies the type of file (by default it is sequential )

                             1) IS: Indexed Sequential Access Method
                             2) VS: Virtual Storage Access Method
                             3) ES: ESDS VSAM File

Device Type: This could be CARD, PUNCH, PRINTER and TAPE
                             (For Report we must use PRINTER option)

Record Format: This specificities the record format of the file.
                            F   : Fixed Unblocked
                            FB: Fixed Blocked
                            V   :Variable Unblocked
                            VB:Variable Blocked
                             U  :Undefined

Field Declarations: Field names can be a max of 40 characters. It can contain alphabets(A-Z and a-z), numbers(0-9) and all special characters except delimiters. A field name should contain atleast one alphabet or special char.


Working Storage Fields


Example1:  WS-NAME       W 10 A

Where  W: indicates it is working storage Variable
            10: it is the length of the WS-NAME field
            A: is the datatype if the WS-NAME field

Example2: WS-NAME       W 7 A VALUE 'RATNESH' (It is similar to COBOL)


  • Fields to be used within Report Section like page number etc., should be defined with type “S”
  • MASK can be used for editing characters(to be displayed in report)                
          MASK of 9 causes a digit to print.
          MASK of Z causes a digit to print (except for leading zeros).
          MASK of * causes an asterisk to replace leading zero digits.
          MASK of - causes a minus sign to print prior to the first non-zero digit of a negative number.
          MASK of $ causes a currency symbol to print prior to the first non-zero digit      

  • We can use DEFINE statement to declare fields.
          For Example DEFINE CURRENT-MONTH W 10 A VALUE 'JANUARY'   
  • We can Redefine fields/records by specifying the offset.                  
          Lets see the below example for Library Section: 

    FILE   INFILE      FB(80 0)

    INPUT-REC-STRC                      1  80 A
      INPUT-ID                          1  08 N
      INPUT-NAME.                       9  20 A
      INPUT-ADDRESS                     29 20 A
      INPUT-CONTACT.                    49 10 N
      FILLER                            59 21 A                              









No comments:

Post a Comment