How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

IBM i e-Book

A Developer’s Guide to Mastering IBM i Concepts

Integrated Language Environment

Binder Language

Binder language is an instruction which is used to write an “EXPORT source file” (source member type “BND”). It is used at the time of compilation for specifying in the compiler for the procedures which will be exported by service program, instead of exporting all procedures exported from different modules bound in service program.

Binder language commands & parameters

Below are the instructions which are typically used to write the export source file in binder language:

  • STRPGMEXP & ENDPGMEXP commands
    • STRPGMEXP command specifies the start of the list of exported symbols (or procedures) and it is paired by ENDPGMEXP command to specify the end of this export list.
    • There can be multiple blocks of STRPGMEXP-ENDPGMEXP inside a binder language.
    • Every block specifies different export list & corresponding signature of the service program.
    1. PGMLVL parameter
      • This parameter is used with STRPGMEXP command used in binder language; and it specifies which STRPGMEXP-ENDPGMEXP block export list should be used to create the latest/current signature of the service program.
      • “*CURRENT” & “*PRV” are the values which are used with PGMLVL command.
      • Only one PGMLVL parameter can have *CURRENT value (It shows that the STRPGMEXP-ENDPGMEXP block used with PGMLVL (*CURRENT) parameter is the current signature of the service program).
      • Apart from one PGMLVL having *CURRENT value, rest all PGMLVL parameters in an export source file must have PGMLVL values as *PRV.
    2. SIGNATURE parameter
      • This parameter is also provided with STRPGMEXP command but it’s not mandatory. It is used to explicitly provide a signature for the export list.
      • *GEN (Default) and explicit name provided by programmers are possible values which are used with SIGNATURE parameter.
      • A possible situation to provide an explicit name for signature is that there is a change in parameters of an existing procedure of the service program (and no other change), even after recompiling the module and updating the service program the system can generate the same signature (because the signature depends on the list of exported procedures and their order in the export list and not on the parameters of procedures).For this case we can provide a different signature name while updating the service program to force all programs to recompile.
  • EXPORT command:
    • The EXPORT command is used to provide the name of the procedure to be exported from service program using SYMBOL parameter.

      If the symbol name contains lower case character, use apostrophe while mentioning the name in SYMBOL parameter.

Binder Language examples

Below are some samples of binder language sources:

  • Example (1) : How to use binder language source in service program creation
    There is a module named NUMERICOPS with below procedures:

    To create a service program named NUMERICOPS, while providing only the functionality of adding numbers (export only “AddNumbers” procedure), we can create below binder language source file.

    While creating the service program we can provide the binder language source file as below:

  • Example (2): Maintaining multiple signatures for the service program

    For the service program created in example 1, below is the signature which has been created (we can see this signature using DSPSRVPGM SRVPGM(NUMERICOPS) DETAIL(*SIGNATURE) command):

    Now to start exporting “SUBTRACTNUMBERS” procedure, we modify the binder language as below:

    Create the service program again using the binder language export list file (through CRTSRVPGM command given in example 1). After re-creating the service program, we see below signatures available for service program:

    As the older signature is still maintained with service program, we will not need to recompile older modules bound with service program.

  • Example (3): Impact of “SIGNATURE” parameter in binder language

    As we can see, in example 2, the SIGNATURE parameter has been used with STRPGMEXP command.

    Now, let’s say we change the “ADDNUMBERS” procedure to accept three numbers instead of two and modify the returning parameter length from 8 to 10 numeric as below (compare with example 1 source to see the modifications):

    If we re-create the program using the same binder language source (no modifications made in SIGNATURE parameter), there will be no impact on the signatures of the service program because no new procedure added/no existing procedure removed AND no change done in the order of the procedures being exported earlier.
    Below are the signatures after recompiling the module and re-creating the service program:

    We can observe that these are same signatures which were generated in example 2 (Given above again for quick reference/comparison).

    To resolve this issue (to generate a new signature when there is a change in the parameters of the procedure), we can modify the SIGNATURE parameter (for this example, modified it from “ADD2_SUB2” to “ADD3_SUB3”):

    Now, if we re-create the service program, we find below signatures and we can see that new signature has been generated which will force the recompilation of existing programs.

Additional tips

Tip 1: To retrieve the current binder language source file for the service program, use RTVBNDSRC command.

Tip 2: While creating the service program, to see the errors in compilation listing related to binder language, use parameter DETAIL(*EXTENDED) or DETAIL(*FULL).

Tip 3: There should be no change in the order of the symbols exported earlier while providing a new STRPGMEXP-ENDPGMEXP block, otherwise it will create instability in service program processing.

How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

share_iconShare
X

Awards and Certifications

company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo