The New COBUG Site.   Read the Full Story
GnuCOBOL (formerly OpenCOBOL) Description
GnuCOBOL (formerly OpenCOBOL) is a free COBOL compiler. cobc translates COBOL to executable using intermediate C sources, providing full access to nearly all C libraries. OpenCOBOL 1.1 continued on as GNU Cobol 1.1. Officially posted to ftp://ftp.gnu.org/gnu/gnucobol, also available here. GnuCOBOL 2.0 is on its way to a pre-release. A superb manual by Gary Cutler, along with a FAQ / How-To, and other documentation is indexed at http://opencobol.add1tocobol.com/guides OpenCOBOL 1.1 is Copyright (C) 2001-2009 Keisuke Nishida
Copyright (C) 2007-2012 Roger While
Read the Full Story
Why COBOL Will Never Die October 25, 2012 by Naomi Karten Way back when I was a programmer, COBOL was the language of choice. It wasn’t as much fun as Fortran, which made me feel like a logician, and I loved using Assembler whenever I had the chance. But COBOL did the trick, and we developed some pretty nifty systems with it. Read the Full Story
image NEW COBUG
image GnuCOBOL
image COBOL Die Never!

COBOL News

  • Other Headlines
  • COBOL Die?

Top Headline

16 Grid Layout

Why COBOL Will Never Die
Way back when I was a programmer, COBOL was the language of choice. It wasn’t as much fun as Fortran, which made me feel like a logician, and I loved using Assembler...

Read More

New COBUG News

  • Other Headlines
  • NCOBUG Site

Top Headline

The New COBUG Site.

The New COBUG Site.
This site is in memory of the late Thomas Perry the founder of the original COBUG site...

Read More

GnuCOBOL

  • Other Headlines
  • GnuCOBOL

Top Headline

RTL Support

market for Cobol skills/developers
Is there still a market for Cobol skills/developers?COBOL is dead, right? All the IT developer jobs now are in modern languages like C++, .NET and Java, right? Wrong!...

header 396x89.fw

nlogo

 

To get the username of the current process, from the level of DCL, you could invoke the command:

$ write sys$output f$getjpi("", "USERNAME")
WISNIOS
$

But it is not so obvious to implement this in the COBOL code. The function as it is called from DCL would be replaced by run-time library rutine. The prefix of function – F$ – would be replaced by LIB$ routine prefix.

LIB$ ones are the routines that handle I/O data type convertion, resource allocation, signal exceptions, and system information obtainance (for others see the HP COBOL User Manual). The Get Job/Process Information routine provides a simplified interface to the $GETJPI system service. It provides accounting, status, and identification information about a specified process.

To get the proper CALL invocation I look to HP OpenVMS RTL Library (LIB$) Manual. The $GETJPI routine has the following format: LIB$GETJPI item-code [,process-id] [,process-name] [,resultant-value] [,resultant-string] [,resultant-length] where the item-code is the only required argument and should be requested by reference:

item-code

OpenVMS usage:  longword_signed 
type:  longword (signed) 
access:  read only 
mechanism: by reference 

Item identifier code specifying the item of information you are requesting. The item-code argument is the address of a signed longword containing the item code. You may request only one item in each call to LIB$GETJPI. LIB$GETJPI accepts all $GETJPI item codes. These names begin with JPI$_ and are defined in symbol libraries in module $JPIDEF supplied by HP.

So, sample code [username.cob] might look like:

identification division.
program-id. USERNAME.

data division.
working-storage section.
01      item-code       pic s9(9) comp value external jpi$_username.
01      result          pic x(9).

procedure division.
username-begin.
        call "LIB$GETJPI"
                using by reference item-code
                by descriptor result.

        display "LIB$GETJPI(jpi$_username): " result.

username-end.
        stop run.

But despite a fact that the other arguments – process-id, process-name, resultant-value are optional, the returned string is empty.

% cobol username
% link username
% run username
LIB$GETJPI(jpi$_username):

To let the code to do its work we have to add the omitted keywords in place of optionals arguments. The corrected CALL invocation:

        call "LIB$GETJPI"
                using by reference item-code,
                omitted,
                omitted,
                omitted,
                by descriptor result.

Quick test and voilà:

% cob username
% link username
% r username
LIB$GETJPI(jpi$_username): WISNIOS

Final notes The PIC S9(9) is used for item-code variable because it is a pointer to object. Am I right?

Compilation errors Error related to the lack of COMP data declaration:

% cobo hello.cob
    6         01  item-code       pic s9(9) value external jpi$_username.
                  1
%COBOL-E-ERROR  435, (1) VALUE EXTERNAL clause ignored - valid only on COMP data
-item under 10 digits

Solution:

01      item-code       pic s9(9) comp value external jpi$_username.

Read more http://openvms.deadsystems.com/?p=352

This website uses cookies to manage authentication, navigation, and other functions. By using our website, you agree that we can place these types of cookies on your device.

View e-Privacy Directive Documents

You have declined cookies. This decision can be reversed.

You have allowed cookies to be placed on your computer. This decision can be reversed.

Login

Who's Online

blank

To get the username of the current process, from the level of DCL, you could invoke the command:

$ write sys$output f$getjpi("", "USERNAME") WISNIOS $

But it is not so obvious to implement this in the COBOL code. The function as it is called from DCL would be replaced by run-time library rutine. The prefix of function – F$ – would...

Read more...

blank

Thanks to Tim I finally managed to install the COBOL on my OpenVMS system.

Here you are a few “screen shots”.

Unzipping the archive.

$ set def dua2:[cobol] $ unzip cobol057.zip Archive: DUA2:[COBOL]COBOL057.ZIP;1 inflating: cobol057.a inflating: cobol057.b inflating: cobol057.c

Loading the license.

$ license load...
Read more...

Contact Us

2me

Contact our website news team via our Online Customer Support Service.

Member Login