Coding Programs

Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

While the templates do provide a solid foundation for your programs, your programs are likely to require additional functionality that is not provided by the code generated by the program templates.

As you code a program, you specify the COBOL program locations where the code belongs, such as the Working-Storage Section or Procedure Division, by entering AMB keywords in columns 4 through 7.

You can enter your source code and associated keywords in any sequence; when you generate the program, AMB arranges the source into the proper COBOL program sequence. For example, you can define Working-Storage fields in the Procedure Division instead of Working-Storage.

Online Programs

You can add to or modify the template as needed. To do this, enter additional AMB keywords with your source code to specify the program location where the source belongs. For example, you can:

  • Add Working-Storage or Linkage Section data elements and flags for your procedural routines
  • Redefine the AMB Commarea data structure to accommodate the data that you pass between programs
  • Add to or modify the default program invocation logic to suit your program requirements
  • Add calls to user-defined Customizer rules, and set any variable values required by the rules

Batch Programs

There are a few items you need to code into your program that are not provided by the batch program template. Use Program Painter keywords, COBOL, S-COBOL, database calls, and user-defined Customizer rules to code:

  • Data Division, File Section
  • Data elements and flags for your procedural routines
  • Procedural source code

Program Stub

A program stub is just part of a program. Usually, it consists of a paragraph or paragraphs, and is written in COBOL or S-COBOL. A stub can also contain user-defined Customizer rules. You can call a program stub from other programs, but you cannot compile and run it on its own. You add a program stub to an application in the Project Explorer, which makes the stub available to all other programs in the application that contains it. You code program stubs in the Program Painter.

APSSRC

If you choose, you can also code a program directly using S-COBOL, that is, without coding the logic into the Program Painter. To do this, create a source member in your APSSRC directory, and code S-COBOL statements directly into it. Effectively, an APSSRC member contains the same code as would a GENSRC member if you coded the same logic into the Program Painter.

Customizer Rules

In your program, you can enter any Customizer rule calls or statements that your program requires. For example, if on the Project Explorer you include user-defined rules in a Globals folder, call the rules you need, and assign values to any variables that the rules require. Use the following keywords to place Customizer source in the appropriate program location.

Keyword

Program Location

SYM1

At the beginning of the program, before rule libraries that you include at the beginning of the program

SYM2

After rule libraries that you include at the beginning of the program

SYEN

In the Environment Division, after the Special-Names paragraph

SYDD

At the beginning of the Data Division

SYFD

In the File Section, after rules that you include at the beginning of the File Section

SYWS

In the Working-Storage Section, after rules and data structures that you include in Working-Storage

SYLT

In the Linkage Section, after rules and data structures that you include at the beginning of Linkage

SYLK

In the Linkage Section, after source code that you include with the SYLT keyword

SYBT

At the end of the program

Example

   SYM1
   /*      RULE VARIABLE TO APPEAR AT BEGINNING OF PROGRAM,BEFORE
   /*      RULE LIBRARY THAT I INCLUDE AT BEGINNING OF PROGRAM.  
           % &MY-SYMBOL = 1234

   SYM2
   /*      RULE VARIABLE TO APPEAR AFTER RULE LIBRARY THAT I
   /*      INCLUDE AT BEGINNING OF PROGRAM.  
           % &MY-STRING-SYMB = "THIS IS A STRING"
  
   SYWS
   /*      RULE VARIABLE TO APPEAR AFTER RULE LIBRARY THAT I
   /*      AT INCLUDE BEGINNING OF WORKING-STORAGE.  
           % &MY-WS-SYMBOL = 1234