- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Parameter passing in COBOL
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
Forums
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
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-02-2007 07:09 AM
тАО08-02-2007 07:09 AM
01 t_accpornam pic x(255) value spaces.
procedure division
giving tt_accpornam.
But, COBOL doesn't allow it:
giving tt_accpornam.
...........^
%COBOL-F-OPDGIVING, Operand must be a COMP data-name with 18 digits or less and
no scaling positions, COMP-1, or COMP-2
at line number 37 in file DISK$DKB100:[GET_TT_ACCPORNAM]GETTTACCPORNAM.COB;65
Is there any way that I pass "back" a pic x(255) data item?
Thanks in advance!
Solved! Go to Solution.
- Tags:
- COBOL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2007 07:25 AM
тАО08-02-2007 07:25 AM
Re: Parameter passing in COBOL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2007 08:55 AM
тАО08-02-2007 08:55 AM
Re: Parameter passing in COBOL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2007 11:15 AM
тАО08-02-2007 11:15 AM
SolutionThis one returns a VARCHAR, but does pretty much what you want (I think?) Somewhere in the procedure calling standard you find the bit about the first parameter being the non-integer return mechanism for functions.
create function ef_get_user_dir (in char(32) by descriptor)
returns varchar(94) by reference
language sql
;
external name ef_get_user_dir
location 'maher$user' with all logical_name translation
language cobol
general parameter style variant
comment is 'Get UAF device and directory info for user'
BIND ON CLIENT SITE
bind scope connect
;
linkage section.
*
01 username_desc pic x(8).
*
01 out_dir.
03 out_dir_len pic 9(4) comp.
03 out_dir_text pic x(94).
*
procedure division
using out_dir,
username_desc.
00.
Cheers Richard Maher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2007 11:30 AM
тАО08-02-2007 11:30 AM
Re: Parameter passing in COBOL
Something like this:
IDENTIFICATION DIVISION.
PROGRAM-ID GetAccpornam.
...
LINKAGE SECTION.
01 tt_accpornam PIC X(255).
...
PROCEDURE DIVISION USING tt_accpornam.
...
MOVE whatever TO tt_accpornam.
...
EXIT PROGRAM.
(caller)
01 ACCPORNAM PIC X(255).
PROCEDURE DIVISION
...
CALL "GetAccpornam" USING ACCPORNAM.
The reason your example doesn't work is the OpenVMS calling standard only allows scalar objects to be returned as function results. Maximum size is 64 bits. Larger objects can only be returned via arguments.
(note that you could return a pointer to a string, but that's a bit cumbersome in COBOL and it raises issues of ownership and lifetime of the string storage).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2007 11:34 AM
тАО08-02-2007 11:34 AM
Re: Parameter passing in COBOL
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2007 11:36 AM
тАО08-02-2007 11:36 AM