Skip to content

Docs/chandra explain1 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Docs/chandra explain1 #8

wants to merge 8 commits into from

Conversation

Chandra-IBM1
Copy link
Collaborator

No description provided.

Matta Chandrashekar added 2 commits May 15, 2025 13:18
@@ -59,9 +54,8 @@ Each exported procedure should be documented using the following structure:
- Required preconditions
- Unsupported input types

- `Outcomes`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have removed Output sections, I feel that outcomes will be a valuable section to keep as this will provide the user an overall view of what result will be produce after code execution. @bmorris1 @edmundreinhardt . Could you please suggest on this point ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side Effects and Return Values and Output Parameters should be sufficent to document that.

@@ -59,9 +54,8 @@ Each exported procedure should be documented using the following structure:
- Required preconditions
- Unsupported input types

- `Outcomes`
- `Usage Example`
Define the expected outcomes of the procedure’s execution.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usage Example: This should provide an example on how we can utilize or call the procedure instead of defining the expected outcomes. fyi @bmorris1, @edmundreinhardt, @Chandra-IBM1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anandsha20 I agree that it should show how to call the procedure.

It should show an example of all aspects of calling the procedure

  • The /copy statement with the prototype
  • any setup needed for parameters
  • the call to the procedure
  • if it returns a value or modifies a parameter, it should either show or describe how the caller would use those values.

But for cases where the caller would not do any further coding related to that call, I don't think anything is needed in the Usage section. For example, if the procedure did something related to files, that's not really part of the Usage, it's a Side Effect.


4. `Side Effects`: Mention any indirect or non-obvious effects such as data area updates, logs, or changes to global state.
- Example: Programs might update data areas, which can affect other programs or procedures that rely on the same data areas

5. `Limitations & Assumptions`: Mention any assumptions the code makes, or scenarios where it may fail or behave incorrectly.
- Example: The load all subfile can load only up to 9999 records.

6. `Outcomes`: List possible major outcomes or scenarios resulting from the code execution. This section can include an optional `usage example` to illustrate the expected outcome.
6. `Usage Example`: Define the expected outcomes of the program execution.
Copy link

@anandsha20 anandsha20 May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usage Example: This should provide an example on how we can utilize the program instead of defining the expected outcomes. Please check for other scopes as well. fyi @bmorris1, @edmundreinhardt, @Chandra-IBM1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. It should be similar to the Usage section for a procedure in a module, although depending on the nature of the program it might be better to show a ```clle call which could also represent a call from the command line.

But if there is a /copy file with an RPG prototype for the program, the Usage should be similar to the Usage for a procedure

  • The /copy statement
  • Any setup for parameters
  • The call
  • Code or discussion saying what to do with any output variables

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this should be an example of calling the program. The outcomes should have been discussed in side effects .
In fact for programs, I think we should rename Side Effects to Outcomes
What do you think @bmorris1 @anandsha20 @Chandra-IBM1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure.

Any procedure or program could have both outcomes and side effects, although I'm not always sure which is which.

How about having a more general name for both outcomes and side effects such as "Outside effects", although I don't really like that name. For procedures and subroutines, it could have a subsection about "Global variables".


- `Side Effects`
Describe any indirect or hidden impacts the procedure has on:

- Global variables
- Shared resources
- Logs or external states
- Dataaera updates
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not discuss Global variables unless they are defined with the IMPORT or EXPORT keyword.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Data area or DATARA

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data area or DTAARA

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Data area" is better


- `Initialization`: Describe the initial setup required for the procedure. Include all local variables and parameters.
- `Definitions`: This section covers all declarations and setup required before the main logic of the procedure begins. It includes the definition of local variables, data structures, and any constants or initial values needed to support the procedure’s execution
- `Main Logic`: Explain the core logic of the procedure, detailing the steps taken to achieve the procedure's purpose.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should list any subroutines within the procedure with a brief description of each subroutine.


Provide a step-by-step description of the logic for each procedure.
4. `Procedures` : Provide a step-by-step description of the logic for each procedure.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For each procedure, state whether it is exported or internal to the module.

@@ -28,32 +28,21 @@ The `api_output` part provides a high-level summary of the procedure or subrouti

3. `Return Values` : List the return value accepted by the procedure, specifying whether it is an output

4. `Dependencies`: This section outlines all components that the procedure or subroutine depends on in order to run successfully. Dependencies include physical and logical files used for data access, external procedures for business logic, and display files for user interface interactions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git would not let me put this comment on the "Return values" line.

It should say

  1. Return value: List the value returned by the procedure. Specify the data type and the meaning of the return value.


5. `Side Effects`: Mention any indirect or non-obvious effects such as data area updates, logs, or changes to global state.
- Example: This includes any global variables whose values are changed within the procedure.

6. `Limitations & Assumptions`: Mention any assumptions the code makes, or scenarios where it may fail or behave incorrectly.
- Example: The caller cannot update records it is only input. This means the procedure or subroutine is designed to read data but not modify it.

7. `Outcomes`: List possible major outcomes or scenarios resulting from the code execution. This section can include an optional usage example to illustrate the expected outcome.
7. `Usage Example`: List possible major outcomes or scenarios resulting from the code execution. This section can include an optional usage example to illustrate the expected outcome.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should show a call to the procedure, with any setup required for parameters, and either an example or a description of what the caller would do with the return value or any output parameters.

- `Keywords`: Explain any keywords used in variable declarations, such as `LIKE`, `INZ`, `N` data type, etc

1. `Global Components`: The Global Variables section includes all variables, prototypes for external program calls, data structures, arrays, constants, and keywords used in the variable declarations (example`LIKE`, `INZ`, `N` data type)

2. `Field Mapping`: If the procedure or subroutine relates to any display file or printer file, create a clear table or list to show how physical/logical file fields are mapped to display fields or printer file. This includes field names and display fields.

3. `Indicators`: If the procedure or subroutine uses indicators, explain their purpose and how they are set or cleared during execution in table format.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify that this is only the *IN indicators or any indicators in an INDDS data structure.

It should not be about any ordinary variables that happen to have the indicator data type.

@@ -94,27 +94,16 @@ The `GetActInf` module provides reusable subprocedures to retrieve account-relat
#### Return Value
| -Return Value- | Output | `char(10)` | The account number associated with the given ID |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the Return Value, The first two columns are not needed.

Data Type Description
char(10) The account number associated with the given ID

If it is a data structure, list the subfields.

- If `P_UserId` is blank or unmatched:
- The returned value will be blank.
- Calling code must ensure the returned value is not reused inappropriately in future calls.

#### Usage Example
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For small snippets, I don't think it would be good to put **free at the top. But without **free, free-form code has to start in column 8. So, I think any little snippet like this should have 7 blanks before the code.

This version has the code starting in column 1. The formatter thinks the 'd' in userid is the D of a fixed-form D spec and it doesn't "see" the "dcl-s" part of the declarations so it doesn't colour them red.

dcl-s userid char(10);
dcl-s account_number char(10);
/copy getactinfcpy;

userid = 'TEST01';
account_number = GetAccNo(userid);

This version has 7 blanks preceding each line of code.

       dcl-s userid char(10);
       dcl-s account_number char(10);

       /copy getactinfcpy;

       userid = 'TEST01';
       account_number = GetAccNo(userid);

@@ -141,28 +130,17 @@ account_number = GetAccNo(userid);
| `P_UserId` | Input | `char(10)` | Customer ID to search for in the `AccPf` file |
| -Return Value- | Output | `char(50)` | The account description associated with the input `CustId` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix this information about the return value to be in the same format as for GetAccNo above.

- If a match is found:
`account_desc` will contain something like `'Premium Savings Account - Tier 1'`.
- If no match is found:
`account_desc` will be blank. The calling logic should handle such cases to avoid misinterpretation.


Copy link
Collaborator

@bmorris1 bmorris1 May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git would not let me add a comment on the line about the purpose.

It currently says

The RPGLE program provides reusable subprocedures to retrieve account-related information from the AccPf physical file based on a given customer ID (CustId). Specifically, it allows external programs to obtain:

It should say

The RPGLE module provides reusable subprocedures to retrieve account-related information from the AccPf physical file based on a given customer ID (CustId). Specifically, it contains exported procedures to obtain:

@@ -41,33 +41,24 @@ Therefore the `context` directory would look like:

The RPGLE program is designed to retrieve the account number (`AccNo`) for a given user ID (`P_UserId`) from the `AccPf` file. It reads through the records in the `AccPf` file and searches for a match with the provided user ID. Once a match is found, it sets the corresponding account number in the output parameter `P_AccNo`.

### Parameters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git would not let me add a comment at the beginning of this file. The code sample for the program must have the **free right at the beginning of the line.

This is what the code looks like with the **free starting in column 5. It thinks the code is column-limited, so it interprets column 6 as being the spec type.

    **free
    ctl-opt dftactgrp(*no) actgrp(*new);

    dcl-f AccPf if e k disk;

This is what it looks like with the **free in column 1:

**free
    ctl-opt dftactgrp(*no) actgrp(*new);

    dcl-f AccPf if e k disk;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was not addressed yet.

- If the same program runs again without resetting `P_AccNo`, it retains the previous value, leading to incorrect or unintended output.

#### Usage Example
### 6. Usage Example
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git would not let me add a comment in the File Specifications section.

It has this bit of sample code for a fixed-form statement. This would not be helpful for someone who does not know RPG.

FAccPf IF E K Disk

Please correct all such samples of fixed-form statements in all these documents to show the actual statement, surrounded by the two lines rpgle and and with 5 leading blanks.

     FAccPf     IF   E      K      Disk 

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to have a page about how to format code snippets, and link to the page from each document.

  • For small free-form snippets, don't put **free, but instead have 7 leading spaces
  • For large free-form snippets, make sure the **free is in column 1.
  • For fixed-form snippets, always have the correct fixed-format of the lines

Copy link
Collaborator

@bmorris1 bmorris1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of my comments apply to all the documents, such as my comments about formatting code snippets.

Also, some of my comments are not positioned against the line they apply to, because Git would not let me make a comment for some lines in large unchanged sections. I hope I made it clear what I was actually referring to ... :-)

Example:
| Parameter Name | Data Type | Description |
|----------------|------|--------|
| `pOrderId` | `char(10)` | The unique identifier for the order being processed |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a column after the Data Type column for whether it is input or output.

  • If CONST or VALUE is specified, it is input-only
  • If CONST or VALUE is not specified, it is input and output

- APIs or external libraries
- Data areas
- Data queues
- Any other external modules or systems
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the last one to just "etc"

List all external components the program relies on to function correctly. This includes:
- Called programs
- Service programs (SRVPGMs)
- APIs or external libraries
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be two separate points

| Component Name | Type | Description |
|-----------------|----------|-------------|
| `CALC_SERVICE` | Service | Performs complex calculations for order processing |
| `DATA_AREA_1` | Data Area| Stores configuration settings for the program |
Copy link
Collaborator

@bmorris1 bmorris1 May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this example library qualified since the library should be listed if it is known

| LIB1/DATA_AREA_1 | Data Area| Stores configuration settings for the program |

This section should illustrate all relevant aspects of calling the procedure, including:

1. The `/COPY` Statement
- Show how the caller includes the prototype using a `/COPY` directive (if applicable).
Copy link
Collaborator

@bmorris1 bmorris1 May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is always applicable for an rpgle example for scope=module, since the caller is expected to be in a different module.

- Show how the caller includes the prototype using a `/COPY` directive (if applicable).

2. Parameter Setup
- Define and initialize all input and output parameters required for the call.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input and output parameters and any return value


3. The Procedure Call
- Demonstrate the call using:
- `CALLP` if using a procedure with a prototype.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CALLP opcode is not necessary. It is very rare that CALLP is used for a prototyped call in free form.

DCL-S orderTotal PACKED(9:2);
DCL-S statusCode CHAR(2);
CALLP CalculateOrderTotal(customerId : orderTotal : statusCode);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the CALLP. Just do the procedure call.

       CalculateOrderTotal(customerId : orderTotal : statusCode);


example:
```rpgle
/COPY QRPGLESRC,MYPROTOTYPE
Copy link
Collaborator

@bmorris1 bmorris1 May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the free-form snippets must be indented by at least 7 spaces before the code.

This should be an IMPORTANT guideline at the beginning of each of the "explain_*" documents.

(And also fix up all the snippets in these documents. :-)

If you look at the rendered markdown you can see that it doesn't understand the code properly. Here is what yours currently looks like with fewer than 7 spaces. It thinks column 5 is the fixed-form specification type.

    /COPY QRPGLESRC,MYPROTOTYPE
    DCL-S customerId   CHAR(10)   INZ('CUST001');
    DCL-S orderTotal   PACKED(9:2);
    DCL-S statusCode   CHAR(2);
    CALLP CalculateOrderTotal(customerId : orderTotal : statusCode);      

    // After call, orderTotal and statusCode will have updated values
Here it is with 7 spaces:
       /COPY QRPGLESRC,MYPROTOTYPE
       DCL-S customerId   CHAR(10)   INZ('CUST001');
       DCL-S orderTotal   PACKED(9:2);
       DCL-S statusCode   CHAR(2);
       CALLP CalculateOrderTotal(customerId : orderTotal : statusCode);      

       // After call, orderTotal and statusCode will have updated values

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an IMPORTANT guideline at the top of every explain_x file:

IMPORTANT

  • All the free-form snippets must be indented by at least 7 spaces before the code.
  • All fixed-form snippets must have exactly 5 spaces before the specification type.
  • If the rpgle to start the snippet is indented, the 5 or 7 spaces must start at the same indentation as the rpgle line.

| File Name | Type | Used | Description |
|-----------------|----------|------|-------------|
| `CUSTOMER` | Data | Input | Reads customer records for processing |
| `ORDER_DISPLAY` | Display | Input/Output | Displays order details to the user |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add another example with "Input/Update" in the "Used" column. For RPG programmers, "output" only means the equivalent of the SQL "INSERT" statement.

| ORDERS | Data | Input/Update| Updates an order|

The how_output part explains how the module works internally, covering the full execution flow and logic used at each step. It includes details on control specifications, file declarations, global variables, constants, indicators, field mapping, subroutines, error handling, and the logic of each procedure.
Provide the subfields in a table format with columns for subfield name, type, and description.
Example: Data Structures
Subfield Name | Type | Description |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the example, put the name of the data structure before the list of subfields.


## how_output
##### Data Structures
This section documents all data structures used in the program, including their subfields and purposes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and anything else that is interesting about the data structure such as whether it is qualified or whether it is an array.

Subfield Name | Type | Description |
|----------------|--------|-------------|
| `OrderDetail` | 10 Length Character | Details of the order |
| `OrderAmount` | 7 numeric 2 decimals | Amount of the order |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be a standard way of documenting the data types, in a separate file that is linked from anywhere that it mentions types.

And then all the examples in these documents should follow that standard.

I think an extra meeting is needed, with all the participants.

But for now, I think the first thing mentioned should be the type, then any other information

  • Character, length 10
  • Packed numeric, length 7, with 2 decimals
  • Date, *ISO format

Example: Arrays
| Array Name | Dimensions | Description |
|-------------|------------|-------------|
| `OrderArray` | 1000 elements | Array to hold order details |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data type is also needed for arrays.

These tables would be the same as the variables and data structure tables above with an extra column for the dimension.

But I think it would be better to document arrays with the other variables and data structures. If it's an array, that could just be mentioned as part of the description.

Also, since subfields can be arrays, it would be very complex to list array subfields somehow separate from the data structure.

So for example, in the Variables table above, you could have an example like this:

| MeetingDates | Date, *ISO format | Array with dimension 10, the available dates for meetings |

Copy link
Collaborator

@bmorris1 bmorris1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only reviewed explain_module.md so far since the meeting on May 26/May 27.

This should show how to call the procedure, including any necessary setup for parameters, along with an example or description of how the caller would handle the return value or any output parameters.

```rpgle
/COPY QRPGLESRC,MYPROTOTYPE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary to have the /COPY for a scope=proc usage example. For this scope, the assumption is that the call will be in the same module, so the prototype for the call isn't even necessary.

Example:
| Parameter Name | Data Type | Description |
|----------------|------|--------|
| `pOrderId` | `char(10)` | The unique identifier for the order being processed |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this way of showing the data type much better than "length 10 character" and also better than "character, length 10".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any variable is declared using the LIKE keyword to refer to a field from a file, and that file's DDS (Data Description Specifications) is not present in the repository. That what we should mention as data type for that?

Copy link
Collaborator Author

@Chandra-IBM1 Chandra-IBM1 May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we follow this way for other type of variable?

Parameter Name Data Type Usage Description
customerId char(10) Input/Output The unique identifier for the customer
orderTotal packed(9:2) Input/Output The total amount of the order calculated
currencyCode char(3) CONST Input only The currency in which the order is placed
taxRate packed(5:2) VALUE Input only The applicable tax rate for the order
orderDate date(*ISO) Input/Output The date the order was placed

or should we follow this way

Name Type Usage Description
customerId Character, length 10 Input/Output The unique identifier for the customer
orderTotal Packed numeric, length 9, with 2 decimals Input/Output The total amount of the order calculated
currencyCode Character, length 3 (CONST) Input only The currency in which the order is placed
taxRate Packed numeric, length 5, with 2 decimals (VALUE) Input only The applicable tax rate for the order
orderDate Date, *ISO format Input/Output The date the order was placed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the first way better.

If it is defined with LIKE, put both pieces of information.

LIKE(somefield), date(*ISO)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK how about
LIKE(somefield) = DATE(*ISO)

But Chandra is asking about whether we give a natural language description
I suspect that this will become very repetitive if we always do it. The end user only needs to learn once what PACKED means.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any variable is declared using the LIKE keyword to refer to a field from a file, and that file's DDS (Data Description Specifications) is not present in the repository. That what we should mention as data type for that?

If the meaning of the LIKE keyword is not known, then just put "LIKE(name)" for the type. And then if there is some indication of the type, such as an assignment, put something in the description such as "Likely a numeric type"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that a natural language description is not necessary for data types.


- At end of this you can explain any specific keywords used in the variable declarations, such as `LIKE`, `INZ`, or `N` data type.

##### Arrays
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of the comments I made for explain_module also apply to this document.


6. `Outcomes`: List possible major outcomes or scenarios resulting from the code execution. This section can include an optional `usage example` to illustrate the expected outcome.
2. The Program Call
- Use `CALL` to invoke a program object.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this:

  1. The program call.
  • If there is an RPG prototype for the program, use an rpgle snippet with the /COPY for the prototype, and any definitions needed for parameters. Do not use the CALL or CALLP opcode.
       /copy qrpglesrc,prototype
              
       mypgm (parameters);
  • Otherwise, use a clle snippet to represent a call from the command line.
call mypgm parm(parameters)

| `pStatus` | Output | `char(10)` | The status code indicating success or failure of the procedure |

3. #### File Inputs/Outputs
Describe how the program reads from and writes to:
Copy link
Collaborator

@bmorris1 bmorris1 May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change "program" to "subroutine" in several places in this file.

| `ORDER_DISPLAY` | Display | Input/Output | Displays order details to the user |
| `PRINTER_FILE` | Printer | Output | Sends reports to the printer |

4. #### Dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this section really needed for a subroutine?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe it's important to document any external programs, APIs, data areas, or data queues that the program interacts with

Provide a short insight into the purpose of the code for the subroutine. This should focus on the business logic or functional role of the code.

2. #### Global Components
This section lists the global elements used by the subroutine, such as indicators.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't mention indicators here. There is already too much focus on indicators.

Instead, say this:

This section lists the global elements used by the subroutine, such as variables and files.


`Include:`
- `*INxx` Indicators: Standard RPG indicators (e.g., `*IN03`) or fixed-format numeric indicators controlling logic or UI.
- Indicators in `INDDS` Structures: Subfields defined inside indicator data structures linked to files using `INDARA`. These control function keys, display flags, etc.
Copy link
Collaborator

@bmorris1 bmorris1 May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a general comment for all the explain files. Also show an example table for an indds. I think the good layout for an indds table has already been established but I don't know where it is. But I think the following would be a good way to show an INDDS.

  • Indicator data structure myIndds for display file MYDSPF

    Subfield name Indicator number Description
    exit 03 Indicates that the user pressed F3
    sfl_clear 55 Used to clear the subfile
    error 99 Used to show error messages

Copy link
Collaborator

@bmorris1 bmorris1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of my comments apply to all the explain files.

I have not looked at the sample files yet. I will review those after changes are made according to the explain documents.

@Chandra-IBM1 Chandra-IBM1 requested a review from bmorris1 May 28, 2025 14:21
Provide a code snippet showing how the subroutine is called within the program.
Example:
```rpgle
D InputVar S 10A INZ('Test')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't define any variables for calling a subroutine.

Before the EXSR, set the values for any input variables.

After the EXSR, show how to use the output variables.

       InputVar = 'abc';
       EXSR MySubroutine;       
       If OutputVar > 5;
        ...


2. Parameter Setup
- Define and initialize all input, output parameters and any return values required for the call.
- Include declarations for any necessary constants, variables, or data structures.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define data structures using LIKEDS with the name of the data structure defined in the /COPY file.


example:
```rpgle
/COPY QRPGLESRC,MYPROTOTYPE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 7 spaces before the code must start in the same column as the ```rpgle

With only 5 extra spaces

     /COPY QRPGLESRC,MYPROTOTYPE

     DCL-S customerId   CHAR(10)   INZ('CUST001');
     DCL-S orderTotal   PACKED(9:2);
     DCL-S statusCode   CHAR(2);

With 7 extra spaces
example:

       /COPY QRPGLESRC,MYPROTOTYPE

       DCL-S customerId   CHAR(10)   INZ('CUST001');
       DCL-S orderTotal   PACKED(9:2);
       DCL-S statusCode   CHAR(2);

mypgm (parameters);
```
- Otherwise, use a clle snippet to represent a call from the command line.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rendered as part of the example. I think it is because it is indented too much.

- At end of this you can explain any specific keywords used in the data structure declarations, such as `LIKEDS`, `QUALIFIED`, or `INZ`.

##### Arrays
This section documents all arrays used in the module, including their dimensions and purposes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is good to have arrays documented separately from other variables. My earlier suggestion was to avoid having an extra section for arrays, and just put dimension information as part of the description.

But if arrays will be separate, then data structure arrays should be included in the "arrays" section. Or there should be a separate "Data structure arrays" section.

Copy link
Collaborator

@bmorris1 bmorris1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few more comments to the explain documents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants