- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: How to define arguments for callable programs ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2006 03:07 AM
тАО08-21-2006 03:07 AM
Re: How to define arguments for callable programs written in COBOL
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2006 09:38 AM
тАО08-21-2006 09:38 AM
Re: How to define arguments for callable programs written in COBOL
In the "By Descriptor" example, is it the LIB$SCOPY_DXDX call that handles size mismatches in parameters between calling and called programs?
I want to code my sub-program with, say, a 1000 byte string variable for some text manipulation. But I want the calling program to be able to define that at any lengnth 1 to 1000. No need to define 1000 byte field when I know I will only need 20 bytes in a particular main program.
See my attached examples. A1.exe works because the sizes match. A2.exe hangs. B.cob currently doesn't do anything special to resolve the size differences.
Thanks,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2006 03:04 PM
тАО08-21-2006 03:04 PM
Re: How to define arguments for callable programs written in COBOL
>> In the "By Descriptor" example, is it the LIB$SCOPY_DXDX call that handles size mismatches in parameters between calling and called programs?
Yeah, but you want to focus on the STR$COPY calls IMHO.
>> I want to code my sub-program with, say, a 1000 byte string variable for some text manipulation. But I want the calling program to be able to define that at any lengnth 1 to 1000. No need to define 1000 byte field when I know I will only need 20 bytes in a particular main program.
How is the called program to know how much data to work on. You'll need to pass an explicit length in a param, or pass by descriptor and decode the descriptor, or... use a terminator: yuck!
>> . A2.exe hangs. B.cob currently doesn't do anything special to resolve the size differences.
Righth. So B will just display 1000 bytes starting at the buffer pointend to by A2, but that only points to 200 initialized values. Beyond that, it it 'pot luck'. The program will send semi-random data to the terminal, which apparently manged to hang it. The program 'hang' is just it waiting for terminal IO to finish.
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:48 AM
тАО08-22-2006 12:48 AM
Re: How to define arguments for callable programs written in COBOL
I actually did one of these years ago (using another example from our tech staff) and remembered having to do some system calls to resolve the length and copy to the actual work string inside the CALLED program.
I feel like the code I need is in one of these examples, I'm just overlooking it.
Thanks for your patience, guys...
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 04:09 PM
тАО08-22-2006 04:09 PM
Re: How to define arguments for callable programs written in COBOL
First, to 'see' what went wrong with your A2, do a $define/user sys$output a2.log.
Then $run A2
and $dump/record a2.log
---- solution 1 ----
Change the caller to call "BY DESCRITOR data-element".
Use a helper routine to de-reference the argument. The first layer, accepts the descriptor as a structure and passed on teh firrst element as the length, and then passes the VALUE of the next element which in fact is the address of the data element.
The Real McCoy, takes the low word from the length and uses that in a reference modification to the data.
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLEDPROG.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
01 DESC.
03 DESC_LENGTH PIC 9(9) COMP.
03 DESC_ADDRESS USAGE POINTER.
01 L-1000-CHAR PIC X(1000).
PROCEDURE DIVISION USING DESC.
0000.
CALL "REALMCCOY" USING DESC_LENGTH, BY VALUE DESC_ADDRESS.
EXIT PROGRAM.
-----
IDENTIFICATION DIVISION.
PROGRAM-ID. REALMCCOY.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
01 DESC_LENGTH.
03 DESC_LENGTH_WORD PIC 9(4) COMP.
03 FILLER PIC XX.
01 L-1000-CHAR PIC X(1000).
PROCEDURE DIVISION USING DESC_LENGTH, L-1000-CHAR.
0000.
DISPLAY 'L-1000-CHAR=' L-1000-CHAR(1:DESC_LENGTH_WORD).
EXIT PROGRAM.
---- solution 2 ----
Change the caller to call "BY DESCRITOR data-element".
Now use library routines to play with the descriptor. Where thy expect an argmument by descriptor, just pass along the address of the received descriptor.
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLEDPROG.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 DESC_LENGTH PIC 9(9) COMP.
01 DESC_ADDRESS USAGE POINTER.
01 L-1000-CHAR PIC X(1000).
LINKAGE SECTION.
01 DESC PIC X.
PROCEDURE DIVISION USING DESC.
0000.
CALL "STR$ANALYZE_SDESC" USING BY REFERENCE DESC,
BY REFERENCE DESC_LENGTH, BY REFERENCE DESC_ADDRESS.
CALL "STR$COPY_DX" USING BY REFERENCE DESC, BY DESCRIPTOR L-1000-CHAR.
DISPLAY 'length=', DESC_LENGTH with conversion.
DISPLAY 'L-1000-CHAR=' L-1000-CHAR(1:DESC_LENGTH).
EXIT PROGRAM.
Enjoy,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2006 05:22 AM
тАО08-23-2006 05:22 AM
Re: How to define arguments for callable programs written in COBOL
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2006 06:20 AM
тАО08-23-2006 06:20 AM
Re: How to define arguments for callable programs written in COBOL
perhaps now would be a good time to check
http://forums1.itrc.hp.com/service/forums/helptips.do?#33
and quantify your thanks to those who helped.
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2006 11:49 AM
тАО08-26-2006 11:49 AM
Re: How to define arguments for callable programs written in COBOL
I'm Richard, he's John :-)
The only thing about the STR$ versions is they they often wish to signal errors and one really shouldn't rely on cob$handler's behaviour in these circumstances. So unless you've lib$established a condition handler (or at least lib$sig_to_ret) then I'd opt for the lib$ versions.
Didn't fancy the Bruden gig?
Hi John,
Lib$cvt_dx appears to do a lot more than you were looking for but if it works for you then great.
As you've seen, you don't have to use lib$analyze_sdesc to break up the descriptor as you already have it in the Linkage Section (Some validation of what classes will be handled maybe useful)
Also, don't be afraid to subsequently pass the Linkag Section Descriptor "By Reference" to a routine that is asking for an argument "By Descriptor" (That is, you can dispense with the intermediate step of copying the string to your local WS-VAR and then passing that by descriptor.
Regards Richard Maher
PS. UPPER CASE IS NOT COMPULSORY FOR cobol
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2006 02:59 PM
тАО08-27-2006 02:59 PM
Re: How to define arguments for callable programs written in COBOL
>> I'm Richard, he's John :-)
Ooops.
>> The only thing about the STR$ versions is >> they they often wish to signal errors and
Yeah STR$ seems the heaviest, next LIB$ then OTS$SCOPY__DXDX
>> As you've seen, you don't have to use lib$analyze_sdesc to break up the descriptor
Right, my example shows that also.
>> PS. UPPER CASE IS NOT COMPULSORY FOR cobol
But is is so ADDICTIVE...
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-16-2006 01:14 AM
тАО10-16-2006 01:14 AM
Re: How to define arguments for callable programs written in COBOL
- « Previous
-
- 1
- 2
- Next »