OpenFrame ASM Verification

This chapter describes how to compile the sample ASM file after installing OpenFrame ASM and about the compile command. It also describes how to use the interface module code generation tool and its command options, and how to use g++ to compile an interface module.

1. Compile

The following describes how to use the ofasm command to compile the sample ASM file after installing OpenFrame ASM.

  1. Find the sample file in the following location.

    $OFASM_HOME/sample
  2. Execute the ofasm command and compile the SAMPLE.asm file.

    ofasm ADD.asm
  3. If the following .asmo file is created after the compilation, then OpenFrame ASM has been installed successfully. The .asmo file is created in the $LD_LIBRARY_PATH folder.

    ADD.asmo

1.1. ofasm Command

The following describes how to use the OpenFrame ASM compile command (ofasm).

ofasm sourcefile... [command option...]
  • Source Files

    The files to compile must have the 'asm' extension to be recognized as an ASM source file.

  • Command Options

    The following describes basic command options for compiling a source file.

    Option Description

    -o filename

    Specifies the name of the object file. If not specified, the default name is <input filename>.asmo.

    --debug

    Outputs log messages during preprocessing and compilation.

    -L <dir>

    Sets a macro library path.

    -h(H) or --help

    Displays help.

    --version

    Displays the current version information of OpenFrame ASM.

    -E

    Only executes preprocessing (input: .asm file, output: .asmi file).

    -S

    Only executes assembly (input: .asmi file, output: .asmo file).

    --enable-cics

    Enables CICS library.

    --list

    Displays macros, copybooks, machine and assembler instructions, and outdated instruction supported by OpenFrame ASM.

    -x <params..>

    Immediately executes the assembler using the parameter specified by the user on the command line. Parameters must be hexadecimal values.

    -f <filepath>

    Can only be used with the -x option. Specifies a JSON files that defines parameter information.

    -r <reg_no> <value>

    Can only be used with the -x option. Specifies the register value before execution.

    --entry <entryname>

    Can only be used with the -x option. Specifies the name of the entry to execute.

    --save-punch

    Generates an output file for PUNCH record data.

    --enable-spm

    Enables structured programming macros.

    --license

    Displays license information.

    --force-rmode31

    Forcibly applies 31-bit RMODE to the object code of the target program.

    --no-reuse

    A new program instance is created every time the target program is loaded into OpenFrame ASM.

    --sysparm <string>

    Specifies the value of &SYSPARM used during preprocessing for the target program.

    --enable-outdated

    Enables the use of outdated instructions for the target program. For details, refer to the outdated instructions displayed by the --list option.

    --amode <24,31,ANY>

    Specifies the addressing mode to use for compilation. This value overrides the AMODE value defined in the target file.

    --rmode <24,31,ANY>

    Specifies the residency mode to use for compilation. This value overrides the RMODE value defined in the target file.

2. Creating an Interface Module

The following describes how to use the ofasmif command to create an interface module after installing OpenFrame ASM.

  1. Find the sample JSON file in the following location.

    $OFASM_HOME/sample
  2. Execute the ofasmif command with the ADD.json file to create the interface module.

    ofasmif -i ADD.json
  3. The following ADD_OFASM_VM_ENTRY.cpp file and the .so file have been created.

    ADD_OFASM_VM_ENTRY.cpp

2.1. ofasmif Command

The following describes how to use the ofasmif command.

ofasmif [command option...]
  • Command Options

    The following describes each basic command option for compiling source files.

    Option Description

    -i filename

    Sets an input file. Must have the json extension to be recognized as an interface specification file.

    --cpp-only

    Generates only the cpp file. Must be used with the -i option.

    --comp-only

    Compiles the cpp file using g++. Must be used with the -i option.

    -g <interface type>

    Interface type of the JSON file to be generated.

    -n <program name>

    Name of the JSON file to be used as the program name. Must be used with the -g option.

    -e <entry name>

    Entry name of the JSON file to be generated. Must be used with the -g option. If not set, the program name will be used as the entry name.

    -t <parameter type>

    Parameter types (V, F, PCB, or JCL). Must be used with the -e option.

    -m <number of parameters>

    Maximum number of parameters. Used for -t V (variable parameters).

    -s <size list>

    Size list of parameters. Used for -t F (fixed parameters).

    --ptr-offset <pointer parameter offset list>

    Specifies the list of offsets for pointer parameters when using -t F (fixed parameters) with pointer parameters. This must be used with the --ptr-size option, and the two lists must correspond to each other.

    --ptr-size <pointer parameter size list>

    Specifies the list of sizes for pointer parameters when using -t F (fixed parameters) with pointer parameters. This must be used with the --ptr-offset option, and the two lists must correspond to each other.

    -p <filename>

    Enables auto indentation.

    -h(H)

    Displays help.

Examples

The following examples show generating various interfaces by parameter type using the ofasmif -g option.

  • Basic variable parameter ENTRY interface. Up to 10 parameters can be specified.

    ofasmif -g entry -n TEST -e TEST
  • Variable parameter ENTRY interface. The maximum number of parameters must be specified.

    ofasmif -g entry -n TEST -e TEST -t V -m 10
  • Fixed parameter ENTRY interface. This is an example of a case without pointer parameters.

    ofasmif -g entry -n TEST -e TEST -t F -s 100,200,300
  • Fixed parameter ENTRY interface. This is an example of a case with pointer parameters.

    ofasmif -g entry -n TEST -e TEST -t F -s 100,14,24 --ptr-offset “[(),(0,4),(4,8)]” --ptr-size “[(),(100,200),(200,300)]”
  • PCB parameter ENTRY interface. The maximum number of PCB parameters must be specified.

    ofasmif -g entry -n TEST -e TEST -t PCB -m 100
  • JCL parameter ENTRY interface.

    ofasmif -g entry -n TEST -e TEST -t JCL
  • EXIT interface. This is an example of a case without pointer parameters.

    ofasmif -g exit -n TEST -e TEST -m 10
  • EXIT interface. This is an example of a case with pointer parameters.

    ofasmif -g exit -n TEST -e TEST -t F -s 100,14,24 --ptr-offset “[(),(0,4),(4,8)]” --ptr-size “[(),(100,200),(200,300)]”
  • LOAD interface. It is created in the same way as a fixed parameter ENTRY interface.

    ofasmif -g exit -n TEST -e TEST -t F -s 1024
  • Interface for multiple ENTRYs.

    ofasmif -g entry -n TEST -e ENTRY_1 -t F -s 100,200 -e ENTRY_2 -t V -m 10