Probably this is easy question and I am missing something.
I am getting error for GIVING keyword in Procedure Division statement.
"error: syntax error, unexpected GIVING, expecting Identifier"
When I change GIVING keyword with RETURNING then I get warning. Dose this warning mean RETURNING keyword will not work?
warning: program RETURNING is not implemented
This is the Procedure division of Program
procedure division using lk-filename
GIVING lk-return-code.
Both of the above variables are parh of linkage section.
cobc -std=ibm-strict Program.cob
Small point the arguments used in a PD using
Can as standard be used as a receiving area, i.e., if the called modules
provides changed data to any of the supplied vars they can be processed
by the calling program.
Nothing new here been around for 30+ years.
So using returning is not really needed.
Vince
You will get faster responses if you are a registered user on
Sourceforge as comms using a anonymous from name will be held until
released by one of the moderators.
--- So please register yourself.
Last edit: Simon Sobisch 2020-07-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2020-07-13
Hi,
I would like to add that this program was orginally written for Realia compiler.
When I used std as realia, I still get same error
cobc -std=realia Program.cob
TN3EXTRC.cob(345): error: syntax error, unexpected GIVING, expecting Identifier
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
GIVING in proc-div is an extension (seems from IBM, supported by Realia) that seems to be not recognized yet.
Adding the "recognizing" is easy, but the rest isn't.
When I change GIVING keyword with RETURNING then I get warning. Dose this warning mean RETURNING keyword will not work?
warning: program RETURNING is not implemented
Yes, that is exactly what cobc wants to tell you.
The only option you have for now is to manually move your GIVING identifier to the RETURN-CODE sepcial register, but that will only work if it is a numeric item that can be stored there - but then this would be not compatible to the ibm extension which explicit says it is left out:
The existence of the RETURNING phrase has no effect on the setting of the RETURN-CODE special register.
and it also notes an additional rule for the caller
If the calling program is COBOL, it must specify the GIVING/RETURNING phrase of the CALL statement. In addition, data-name-2 and the corresponding CALL RETURNING identifier in the calling program must have the same number of character positions and must be of the same USAGE clause, SIGN clause and category.
... but it actually doesn't say what happens when this is not the case...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We have lots of COBOL programs with this coding standard i.e use of GIVING keyword in both CALL statements and PROCEDURE DIVISION statement.
I guess I would have to change the code in all the programs.
Is there any plan to implement this keyword GIVING in GnuCOBOL in coming future?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, but as I said this is about much more than just adding the keyword (which is a two-minutes task). Also see [bugs:#650].
If you have this in many programs it seems reasonable to add it to GnuCOBOL sooner, you may have someone that can do this already (or can contract someone for that)?
@abhijeet-chavan any update here?
Furthermore: how to you use the GIVING, can you please share a minimal code example of the caller and callee and everything directly referenced in the CALL / PROCEDURE DIVISION?
Do you also use RETURN-CODE register?
Note: in the meanwhile I've found realia and ibm to use a different implementation and rules for this:
CA-Realia II (from the COBOL Reference Guide):
CALL: GIVING or RETURNING is a data-item that must be defined in the LINKAGE SECTION. In a mixed-language environment, the data item can only be one, two, or four bytes long. Do not modify the linkage address of a GIVING or RETURNING data item.
program / note for RETURN-CODE: Alternately, a GIVING data-item may be specified on the PROCEDURE DIVISION header that will override the default result value of RETURN-CODE.
I read this as "only numeric items are allowed" with a maximum size of the RETURN-CODE register.
For COBOL to COBOL this means:
the codegen for the callee has only to be adjusted to get the GIVING parameter a storage "as if it would have been defined in WORKING-STORAGE" and on the end of the program an implicit move giving-item to return-code has to be done.
the caller already "works", because he gets the value of the callee's RETURN-CODE, either directly or via GIVING
That should actually be possible to add and definitely would need a dialect option (because it is non-standard and very different from the MF implementation) soon. Is there still the need for that for your project?
For COBOL to "mixed-language" this likely means that there needs to be an external return-code of different size, but this could be added later, too.
IBM: that is more or less an additional parameter of any type.
The implementation here: internally handle the GIVING option as an additional parameter (must be specified by the caller and be of same size -> like any USING item); in this case the dialect option has to be specified for both the caller and the callee, we possibly could add/imply a special CALL-CONVENTION[or bit in there] for that.
Also would be doable relative fast.
Syntax rules: MF and RM: RETURNING item can be specified in WORKING-STORAGE or LINKAGE, IBM (and Realia): must be defined in LINKAGE; MF: also allows the RETURNING in ENTRY statements; MF also allows ANY LENGTH variables (that's at least something we should explicit test).
Last edit: Simon Sobisch 2021-07-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Probably this is easy question and I am missing something.
I am getting error for GIVING keyword in Procedure Division statement.
"error: syntax error, unexpected GIVING, expecting Identifier"
When I change GIVING keyword with RETURNING then I get warning. Dose this warning mean RETURNING keyword will not work?
warning: program RETURNING is not implemented
This is the Procedure division of Program
procedure division using lk-filename
GIVING lk-return-code.
Both of the above variables are parh of linkage section.
cobc -std=ibm-strict Program.cob
If I am right both GIVING/RETUNING are valid keywords for IBM
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzasb/procf1.htm
Regards,
Abhijeet
Small point the arguments used in a PD using
Can as standard be used as a receiving area, i.e., if the called modules
provides changed data to any of the supplied vars they can be processed
by the calling program.
Nothing new here been around for 30+ years.
So using returning is not really needed.
Vince
You will get faster responses if you are a registered user on
Sourceforge as comms using a anonymous from name will be held until
released by one of the moderators.
--- So please register yourself.
Last edit: Simon Sobisch 2020-07-14
Hi,
I would like to add that this program was orginally written for Realia compiler.
When I used std as realia, I still get same error
cobc -std=realia Program.cob
TN3EXTRC.cob(345): error: syntax error, unexpected GIVING, expecting Identifier
GIVINGin proc-div is an extension (seems from IBM, supported by Realia) that seems to be not recognized yet.Adding the "recognizing" is easy, but the rest isn't.
Yes, that is exactly what cobc wants to tell you.
The only option you have for now is to manually move your
GIVING identifierto theRETURN-CODEsepcial register, but that will only work if it is a numeric item that can be stored there - but then this would be not compatible to the ibm extension which explicit says it is left out:and it also notes an additional rule for the caller
... but it actually doesn't say what happens when this is not the case...
Thank you. I have registered myself.
We have lots of COBOL programs with this coding standard i.e use of GIVING keyword in both CALL statements and PROCEDURE DIVISION statement.
I guess I would have to change the code in all the programs.
Is there any plan to implement this keyword GIVING in GnuCOBOL in coming future?
Yes, but as I said this is about much more than just adding the keyword (which is a two-minutes task). Also see [bugs:#650].
If you have this in many programs it seems reasonable to add it to GnuCOBOL sooner, you may have someone that can do this already (or can contract someone for that)?
Related
Bugs: #650
Looking at the coding changes required in my COBOL programs to remove the GIVING keyword, it looks like a lot of effort and probably not feasible.
Unfortunately, I do not have any contact for GnuCOBOL changes. I will check with my team.
@abhijeet-chavan any update here?
Furthermore: how to you use the
GIVING, can you please share a minimal code example of the caller and callee and everything directly referenced in theCALL/PROCEDURE DIVISION?Do you also use
RETURN-CODEregister?Note: in the meanwhile I've found realia and ibm to use a different implementation and rules for this:
CA-Realia II (from the COBOL Reference Guide):
I read this as "only numeric items are allowed" with a maximum size of the
RETURN-CODEregister.For COBOL to COBOL this means:
GIVINGparameter a storage "as if it would have been defined inWORKING-STORAGE" and on the end of the program an implicitmove giving-item to return-codehas to be done.RETURN-CODE, either directly or viaGIVINGThat should actually be possible to add and definitely would need a dialect option (because it is non-standard and very different from the MF implementation) soon. Is there still the need for that for your project?
For COBOL to "mixed-language" this likely means that there needs to be an external return-code of different size, but this could be added later, too.
IBM: that is more or less an additional parameter of any type.
The implementation here: internally handle the
GIVINGoption as an additional parameter (must be specified by the caller and be of same size -> like anyUSINGitem); in this case the dialect option has to be specified for both the caller and the callee, we possibly could add/imply a specialCALL-CONVENTION[or bit in there] for that.Also would be doable relative fast.
Syntax rules: MF and RM:
RETURNINGitem can be specified inWORKING-STORAGEorLINKAGE, IBM (and Realia): must be defined inLINKAGE; MF: also allows theRETURNINGinENTRYstatements; MF also allowsANY LENGTHvariables (that's at least something we should explicit test).Last edit: Simon Sobisch 2021-07-21