View previous topic :: View next topic
|
Author |
Message |
Avinashhlg
New User
Joined: 05 Jan 2010 Posts: 7 Location: Bangalore
|
|
|
|
To accept the data from parameters passed from COBOL program to assembler, we know that R1 will have the address of the parameter, but I have difficulty in identifying the length of the data. How will I able to get the length of parameter passed? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
You will not!
review the LE interlanguage reference for the parameter passing rules
note:
R1 will point to the list of the addresses of the parameters |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Actually, register 1 does not have the address of the parameter -- register 1 has the address of the parameter list. This is a significant difference.
What does this mean?
Quote: |
I have difficulty in identifying the length of the data |
Are you referring to the number of parameters?
Are you referring to the length of an individual parameter? |
|
Back to top |
|
|
Avinashhlg
New User
Joined: 05 Jan 2010 Posts: 7 Location: Bangalore
|
|
|
|
Yes, iam referring to the length of the indivisual parameter. Is there any way by which I can extract the exact data passed from the calling program. The problem is that I dont know the length of the data I receive in my assembler code. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
A scenario could be :
UPON ENTRY R1 POINTS TO ADDRESS OF PLIST PLIST+0 : LENGTH OF PARM
PLIST+2 : START OF PARM
Another scenario is :
R1 POINTS TO ADDRESS OF PLIST
PLIST CONTAINS POINTERS TO PARAMETERS WITH LENGTH+DATA
PLIST ENDS WITH X'80',AL3(0) |
|
Back to top |
|
|
Avinashhlg
New User
Joined: 05 Jan 2010 Posts: 7 Location: Bangalore
|
|
|
|
I could see only the data in the plist and not length. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
cobol follows the assembler conventions
it' s Your concern to know the structure of the data You are dealing with
just to show a different scenario
in PL/I
with the OPTIONS ASM clause for parameter passing,
PL/I will use the assembler convention ==> data address
without the OPTIONS ASM clause,
PL/I will use it's internal scheme ==> locator descriptor address
where all the info about the variable is kept ( length,type,..., content) |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Maybe there is no length, cause the parameter is always fixed length.
The called routine, and the calling routine MUST know that of course.
But thats a stupid way of supplying parameter lists. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Pass the length as a parameter. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If your goal is to write a generic module that will handle "anything" that arrives, i suspect you will expereience considerable frustration. . .
If the data has a structure, use the same in both the calling and called modules and there is no need to determine length.
Why do you believe you need to determine the length dynamically?
Possibly i have misunderstood something. . . |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi Avinashhlg !
The lengt depends on the structure of the data you would receive.
If there are several structures, the best is, as said before, to define al field at the first point of the structure which contains the length.
Also a field with a FunctionCode would be useful. Several parms indicate several functions.
So, as everyone told before, it's your turn to handle this. If there is nothing that fits your requirement, just create it by yourselfe. |
|
Back to top |
|
|
|