Handling program calls

Learn how to use the tag syntax to handle program calls.

You can handle program calls by specifying sdcall tags on the code block that contains the program call statement. To specify a tag on code blocks, you can either add or edit tags as described in Using the Code Blocks view and Using the service editor.

The tag syntax for program calls to work is sdcall:<called_program>:<called_paragraph_or_section_name>:<ordinal>. For example, a real-life tag syntax can be defined as sdcall:LGUPOL01:UPDATE-POLICY-DB2-INFO:1. Refer to the following guidance to specify the tag syntax for program calls based on your needs.
  • sdcall is a reserved keyword that indicates that a program call tag is specified.
  • Specify the tag <called_program> with the called program name.
  • Specify the tag <called_paragraph_or_section_name> with the called paragraph name or section name.
  • Optional: Specify the tag <ordinal> with the ordinal number.
    • By not specifying the ordinal number, you replace all the calls from the calling program to the specified called program with the specified PERFORM paragraph name statement.
    • By specifying the ordinal number, you can specify which call needs to be replaced with which PERFORM statement.

      The ordinal number is used to indicate which call in the code block needs to be replaced in a sequential manner. Therefore, if there are three calls from a code block to a program, and you want to only replace calls 1 and 3 and leave the 2nd call unchanged, you need to specify 2 tags, 1 with ordinal 1 and another with ordinal 3.

      The ordinal number starts from 1 for each combination of code block and called program. To elaborate, if a code block has 2 program calls to the same program LGIPOL01, the tag with ordinal 1 can specify that the first call to be replaced with PERFORM para1 and the second with PERFORM para2. Suppose that the same code block has another program call to a new program LGUPOL01, then the ordinal for that called program should start from 1 again.