|
For bound programs this should work:
PROCESS NOMONOPRC UNREF.
IDENTIFICATION DIVISION.
PROGRAM-ID. GETNAME.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-AS400.
OBJECT-COMPUTER. IBM-AS400.
SPECIAL-NAMES.
LINKAGE TYPE SYS FOR "_MATPGMNM".
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Receiver.
05 Bytes-Provided PIC S9(09) BINARY VALUE 80.
05 Bytes-Available PIC S9(09) BINARY VALUE 80.
05 Format-Field PIC S9(09) BINARY VALUE 0.
05 Reserved PIC X(04) VALUE LOW-VALUE.
05 Lib-Type PIC X(01).
05 Lib-SubType PIC X(01).
05 Lib PIC X(30).
05 Pgm-Type PIC X(01).
05 Pgm-SubType PIC X(01).
05 Pgm PIC X(30).
PROCEDURE DIVISION.
MAIN-LINE.
CALL "_MATPGMNM" USING BY REFERENCE Receiver.
DISPLAY "Program: " Pgm.
STOP RUN.
Pgm is defined as Char(30) though what you will most likely want is in the
first 10 bytes.
Bruce
Cesar Altamirano
<cesaralt@xxxxxxxxxx To: COBOL AS/400
<cobol400-l@xxxxxxxxxxxx>
> cc:
Sent by: Subject: Program Name from a
COBOL program
cobol400-l-bounces@m
idrange.com
11/17/2003 10:24 PM
Please respond to
COBOL Programming on
the iSeries/AS400
Hi,
How Can I retrieve the program name from A COBOL program?
RPG has a DS structure from where It can be retrieve.
Is there something like that in COBOL?
Please send me an example.
Thanks for any help,
Caesar Altamirano.
_______________________________________________
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.