Conversation
| - Required preconditions | ||
| - Unsupported input types | ||
|
|
||
| - `Outcomes` |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Side Effects and Return Values and Output Parameters should be sufficent to document that.
docs/pages/task/explain_module.md
Outdated
|
|
||
| - `Outcomes` | ||
| - `Usage Example` | ||
| Define the expected outcomes of the procedure’s execution. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@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.
docs/pages/task/explain_program.md
Outdated
| - 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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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".
docs/pages/task/explain_module.md
Outdated
| - Global variables | ||
| - Shared resources | ||
| - Logs or external states | ||
| - Dataaera updates |
There was a problem hiding this comment.
It should not discuss Global variables unless they are defined with the IMPORT or EXPORT keyword.
There was a problem hiding this comment.
I think "Data area" is better
docs/pages/task/explain_module.md
Outdated
|
|
||
| - `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. |
There was a problem hiding this comment.
It should list any subroutines within the procedure with a brief description of each subroutine.
docs/pages/task/explain_module.md
Outdated
| 3. `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) | ||
|
|
||
| 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. |
There was a problem hiding this comment.
For each procedure, state whether it is exported or internal to the module.
|
|
||
| 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. |
There was a problem hiding this comment.
Git would not let me put this comment on the "Return values" line.
It should say
Return value: List the value returned by the procedure. Specify the data type and the meaning of the return value.
| - 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. |
There was a problem hiding this comment.
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.
|
|
||
| 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. |
There was a problem hiding this comment.
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.
docs/pages/task/sample_module.md
Outdated
| @@ -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 | | |||
There was a problem hiding this comment.
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.
docs/pages/task/sample_module.md
Outdated
| - The returned value will be blank. | ||
| - Calling code must ensure the returned value is not reused inappropriately in future calls. | ||
|
|
||
| #### Usage Example |
There was a problem hiding this comment.
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);
docs/pages/task/sample_module.md
Outdated
| @@ -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` | | |||
There was a problem hiding this comment.
Fix this information about the return value to be in the same format as for GetAccNo above.
| - If no match is found: | ||
| `account_desc` will be blank. The calling logic should handle such cases to avoid misinterpretation. | ||
|
|
||
|
|
There was a problem hiding this comment.
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
AccPfphysical 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
AccPfphysical file based on a given customer ID (CustId). Specifically, it contains exported procedures to obtain:
|
|
||
| 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 |
There was a problem hiding this comment.
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;There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 There was a problem hiding this comment.
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
bmorris1
left a comment
There was a problem hiding this comment.
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 ... :-)
docs/pages/task/explain_module.md
Outdated
| Example: | ||
| | Parameter Name | Data Type | Description | | ||
| |----------------|------|--------| | ||
| | `pOrderId` | `char(10)` | The unique identifier for the order being processed | |
There was a problem hiding this comment.
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
docs/pages/task/explain_module.md
Outdated
| - APIs or external libraries | ||
| - Data areas | ||
| - Data queues | ||
| - Any other external modules or systems |
There was a problem hiding this comment.
Change the last one to just "etc"
docs/pages/task/explain_module.md
Outdated
| List all external components the program relies on to function correctly. This includes: | ||
| - Called programs | ||
| - Service programs (SRVPGMs) | ||
| - APIs or external libraries |
There was a problem hiding this comment.
This should be two separate points
docs/pages/task/explain_module.md
Outdated
| | Component Name | Type | Description | | ||
| |-----------------|----------|-------------| | ||
| | `CALC_SERVICE` | Service | Performs complex calculations for order processing | | ||
| | `DATA_AREA_1` | Data Area| Stores configuration settings for the program | |
There was a problem hiding this comment.
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 |
docs/pages/task/explain_module.md
Outdated
| 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). |
There was a problem hiding this comment.
It is always applicable for an rpgle example for scope=module, since the caller is expected to be in a different module.
There was a problem hiding this comment.
Add this:
When there is no /COPY file with the prototypes, it is a problem in the application, especially if the other programs in the application define their own prototypes so they can call the procedures.
In that case, the issue with the missing /COPY with the prototypes should be mentioned in the "Problems" section.
There was a problem hiding this comment.
@edmundreinhardt @Chandra-IBM1 @jiatianzhong How should usage samples be handled when the module doesn't have a copy file with the prototypes for its procedures?
- Should the sample just make up the name of a /COPY file?
- Should the sample actually code the prototype (which would add to the problem of the prototype being coded in multiple modules)
There was a problem hiding this comment.
I started a Slack thread about this in the #wca4i-tcs-datagen channel: https://my.slack.com/archives/C08FGHCDT26/p1750425339221139
There was a problem hiding this comment.
I am unable to follow that slack link but my opinion is that if no copybook is present/known, the prototype should be in the usage example. The developer can then copy it into a copybook
@bmorris1 @Chandra-IBM1 @jiatianzhong
docs/pages/task/explain_module.md
Outdated
| - 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. |
There was a problem hiding this comment.
input and output parameters and any return value
docs/pages/task/explain_module.md
Outdated
|
|
||
| 3. The Procedure Call | ||
| - Demonstrate the call using: | ||
| - `CALLP` if using a procedure with a prototype. |
There was a problem hiding this comment.
The CALLP opcode is not necessary. It is very rare that CALLP is used for a prototyped call in free form.
docs/pages/task/explain_module.md
Outdated
| DCL-S orderTotal PACKED(9:2); | ||
| DCL-S statusCode CHAR(2); | ||
|
|
||
| CALLP CalculateOrderTotal(customerId : orderTotal : statusCode); |
There was a problem hiding this comment.
Remove the CALLP. Just do the procedure call.
CalculateOrderTotal(customerId : orderTotal : statusCode);Removed extra sections for different types of data structures. Will later move the examples to a separate file
Examples of data structure explanations
Most of the information was moved into other files.
Minor change
Minor changes
The main change is to remove the Side Effects section since that should be covered by the global variables, file I/O, and dependencies.
Minor change
Minor changes
Minor changes
Minor change
Fix formatting
Some formatting changes.
Code-formatting corrections, some content corrections. More changes are needed for it to conform to the required output format.
Code formatting changes, some general output-format changes, more needed.
Add the parameter-number column to the parm tables
| - Otherwise, use a clle snippet to represent a call from the command line. | ||
| ```clle | ||
| call mypgm parm(parameters) | ||
| ``` |
There was a problem hiding this comment.
Question (@edmundreinhardt @Chandra-IBM1 @jiatianzhong )
If it is a fixed-form program with no prototype for the call, and the parameters in the *ENTRY PLIST form, would it be better to show a fixed form RPGLE CALL rather than showing a clle-style call from the command line?
C call 'MYPGM'
C parm parameterThere was a problem hiding this comment.
Yes, use the fixed-form RPGLE CALL with PARM to match the style and parameter-passing method of the program. It is clearer and more accurate for understanding how the program expects to be called.
There was a problem hiding this comment.
Ok, thanks. I changed it to have 3 possibilities:
- free-form call if there is a prototype
- else fixed-form CALL+PARM if there is a *ENTRY PLIST
- otherwise clle call
Fixed the algorithm for determining the number of bytes in packed fields with an even number of digits
Suggest to use a fixed-form CALL if the parameters are in *ENTRY PLIST format
| - External APIs or modules | ||
| 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. |
There was a problem hiding this comment.
There should be sections with "Possible Problems with this Code" and "Possible Improvements to this Code"
| The parameters are described in a table with columns for the parameter number, `Data Type`, `Usage`, `Description`, and possibly `Attributes`. | ||
|
|
||
| The column for the parameter number does not have a heading. | ||
|
|
There was a problem hiding this comment.
Add this:
If it is an unnamed parameter in a prototype, put
not namedin the name column. Also, add a point in the "Possible Improvements to this Code" that it's a good idea to give names to the parameters in a prototype
| | * | PROCPTR | pointer(*proc) | | ||
| | O | CLASS(*java ...) | object(*java ... ) | | ||
| | D | DATFMT(fmt) | date(fmt) | | ||
| | T | TIMFMT(fmt) | time(fmt) | |
There was a problem hiding this comment.
Add some information about data structure subfields that don't have any data type. See this Slack thread in #wca4i-tcs-datagen: https://my.slack.com/archives/C08FGHCDT26/p1750425339221139
There was a problem hiding this comment.
Sorry. The correct link for the Slack thread about subfields with no data type is https://my.slack.com/archives/C08FGHCDT26/p1750441642809399
docs/pages/task/explain_module.md
Outdated
|
|
||
| 2. `Exported Procedures` | ||
|
|
||
| 2. #### Exported Procedures |
There was a problem hiding this comment.
I think the general part of api_output before the procedures should have the global dependencies (files and other objects)
bmorris1
left a comment
There was a problem hiding this comment.
I made several new comments but I haven't finished my review yet.
|
|
||
| ##### Variables | ||
| This section documents all variables used in the program, module, or procedure. It should be described in tabular format with columns for Name, Data Type, Description, and Attributes. | ||
| Only include the Attributes column if necessary. |
There was a problem hiding this comment.
Add the following information about how to describe externally-described fields that are implicitly defined by the compiler:
If it is a field that was defined by the compiler from an externally described file, mention that in the description. For example if you have this file:
A R ORDERFMT
A ORDERID 6A
A QUANTITY 5P 0
A PRICE 9P 2
A K ORDERID
and this rpgle code
dcl-f orders;
dcl-s total int(10);
begsr add_to_total;
total += quantity * price;
endsr;Put this for the description when describing the global variables used by the subroutine:
| Name | Data Type | Description |
|---|---|---|
| Price | packed(9:2), (5 bytes) | Externally-described field from file 'ORDERS', likely set by a READ operation from the file |
No description provided.