Previous Topic Next topic Print topic


To define the Input-Output Section

Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.
  1. In the Program Painter, for each input and output file, type IO in columns 4 and 5.
  2. Type paragraph clauses starting in column 12. Do not code the word SELECT in the SELECT clause; AMB generates it for you.
  3. Continue on as many lines as you need. AMB generates the Input-Output Section and File-Control headers. For example:
       IO      INPUT-CUSTFILE
               ASSIGN TO EXTERNAL GARYDD
               ORGANIZATION IS LINE SEQUENTIAL
       IO      OUTPUT-FILE
               ASSIGN TO EXTERNAL GARYOUT
               ORGANIZATION IS LINE SEQUENTIAL
    Generated AMB Source:
     INPUT-OUTPUT SECTION.  
     FILE-CONTROL.  
         SELECT INPUT-CUSTFILE
         ASSIGN TO EXTERNAL GARYDD
         ORGANIZATION IS LINE SEQUENTIAL.
         SELECT OUTPUT-FILE
         ASSIGN TO EXTERNAL GARYOUT
         ORGANIZATION IS LINE SEQUENTIAL.
  4. Define the file description of your first (or only) input file in the File Section, by typing FD in columns 4 and 5, and a COBOL file description starting in column 12. For example:
       FD      INPUT-CUSTFILE
               RECORD CONTAINS 80 CHARACTERS.
  5. Next, define the input file record description using one of the following formats:
    • COBOL format - Type 01 columns 4 and 5), and the 01-level data item starting in column 12. To define elementary data items, skip a line and enter them starting in column 12, as shown below. We recommend that you indent each new level of elementary data items four columns. For example:
         01      INPUT-REC.
                 05  INP-ACTION-CODE     PIC X(1).
                 05  INP-CUSTOMER-NO     PIC X(6).
                 05  INP-CUSTOMER-NAME   PIC X(20).
                 05  INP-CUSTOMER-ADDR   PIC X(20).
                 05  INP-CUSTOMER-CITY   PIC X(20).
                 05  INP-CUSTOMER-ZIP    PIC X(9).
                 05  FILLER              PIC X(4).
    • Data Structure Editor format -Type REC in columns 4 through 6, and the 01-level data item starting in column 12. To define elementary data items, skip a line and enter them starting in column 16, as shown below. Do not enter the data item level numbers, such as 01 or 05; AMB generates them based on how you indent the items. We recommend that you indent each new level of elementary data items four columns. For example:
         REC     INPUT-REC
                     INP-ACTION-CODE     X1
                     INP-CUSTOMER-NO     X6
                     INP-CUSTOMER-NAME   X20
                     INP-CUSTOMER-ADDR   X20
                     INP-CUSTOMER-CITY   X20
                     INP-CUSTOMER-ZIP    X9
                     FILLER              X4
      Generated AMB source:
       01  INPUT-REC.
           05  INP-ACTION-CODE     PIC X(1).
           05  INP-CUSTOMER-NO     PIC X(6).
           05  INP-CUSTOMER-NAME   PIC X(20).
           05  INP-CUSTOMER-ADDR   PIC X(20).
           05  INP-CUSTOMER-CITY   PIC X(20).
           05  INP-CUSTOMER-ZIP    PIC X(9).
           05  FILLER              PIC X(4).
    • Include a data structure - If you created the record description in a data structure object, include the data structure in your program. Type DS in columns 4 and 5, and the data structure file name in column 12. For example:
         DS      INREC
  6. Define additional input files in the File Section in the same manner that you defined the first one.
  7. Define the file description of your first (or only) output file in the File Section. Type FD in columns 4 and 5, and a COBOL file description starting in column 12. For example:
       FD      OUTPUT-FILE
               RECORD CONTAINS 80 CHARACTERS.
  8. Define the output file record descriptions as in steps 5 and 6. For example, the following is sample generated AMB souce code:
    01      OUTPUT-REC.
             05  OUTPUT-STATUS           PIC X(2).
             05  OUTPUT-CUSTOMER-NO      PIC X(6).
             05  OUTPUT-CUSTOMER-NAME    PIC X(20).
             05  OUTPUT-CUSTOMER-ADDR    PIC X(20).
             05  OUTPUT-CUSTOMER-CITY    PIC X(20).
             05  OUTPUT-CUSTOMER-ZIP     PIC X(9).
             05  OUTPUT-FILLER           PIC X(3).
  9. To define a sort file description in the File Section, type SD in columns 4 and 5, and the file description starting in column 12. For example:
       SD      SORT-FILE
               RECORD CONTAINS 80 CHARACTERS
               DATA RECORD IS SORT-RECORD.
  10. Define the sort file record description as in steps 5 and 6. For example, the following is sample generated AMB souce code:
    01      SORT-RECORD.
             05  SORT-CUSTOMER-NAME      PIC X(8).
             05  FILLER                  PIC X(72).
Previous Topic Next topic Print topic