How to identify the program(main/Subpgm)?
Moderators: dbzTHEdinosauer, Moderator Group
-
- Member
- Posts: 10
- Joined: Thu Apr 09, 2009 3:11 pm
How to identify the program(main/Subpgm)?
How to identify whether a cobol program is a main program or Subprogram,Other than finding out by program name ie eg:AB100P/AB100S??
-
- Member
- Posts: 10
- Joined: Thu Apr 09, 2009 3:11 pm
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
From the syntactic perspctive, a COBOL subprogram is nearly identical to that of a COBOL program; in particular, it has the same four divisions: IDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE.
However, in a sub-program DATA DIVISION includes a LINKAGE section, in addition to the FILE and WORKING-STORAGE sections. in LINKAGE section programmer describes the subprogram's formal arguments.
Another syntactic difference is that, in a subprogram, the PROCEDURE DIVISION header includes a USING clause that lists the names of the formal arguments and, in so doing, indicates the order in which the corresponding actual arguments must be listed by the caller in making a call to the subprogram.
Finally, to terminate execution of a subprogram (and return control to its caller), the statement GO-BACK is used, rather than STOP RUN. STOP-RUN statement will, as usual, have the effect of terminating execution of the whole logical unit of work; in other words, if it is executed within a subprogram, control will not return to its caller.
However, in a sub-program DATA DIVISION includes a LINKAGE section, in addition to the FILE and WORKING-STORAGE sections. in LINKAGE section programmer describes the subprogram's formal arguments.
Another syntactic difference is that, in a subprogram, the PROCEDURE DIVISION header includes a USING clause that lists the names of the formal arguments and, in so doing, indicates the order in which the corresponding actual arguments must be listed by the caller in making a call to the subprogram.
Finally, to terminate execution of a subprogram (and return control to its caller), the statement GO-BACK is used, rather than STOP RUN. STOP-RUN statement will, as usual, have the effect of terminating execution of the whole logical unit of work; in other words, if it is executed within a subprogram, control will not return to its caller.
Regards,
Anuj
Anuj
Do you need to make the distinction at run-time, problem diagnosis, or just by the causal program source observation?
Smart/RESTART :: Checkpoint Restart for z/OS batch applications
Hello.
1. Compile your program with the following COBOL compiler options: MAP, XREF and LIST (just to obtain extra information for our analysis).
2. Find ' TGT '
Please note the location of RUNCOM, it's at +58 off TGT.
3. The following IBM manual provides some information with which to map RUNCOM:
http://publibz.boulder.ibm.com/cgi-bin/ ... T#FIRSTHIT
The IBM LE RUNCOM block would allow you to determine whether or not your program is the main or a sub-program within IBM LE runcom unit.
4. We have an assembler routine that performs these TGT /RUNCOM analysis during COBOL applications run.
I hope my information helps somewhat.
Best.
1. Compile your program with the following COBOL compiler options: MAP, XREF and LIST (just to obtain extra information for our analysis).
2. Find ' TGT '
Code: Select all
*** TGT MEMORY MAP ***
TGTLOC
000000 RESERVED - 72 BYTES
000048 TGT IDENTIFIER
00004C RESERVED - 4 BYTES
000050 TGT LEVEL INDICATOR
000051 RESERVED - 3 BYTES
000054 32 BIT SWITCH
000058 POINTER TO RUNCOM
00005C POINTER TO COBVEC
. . .
3. The following IBM manual provides some information with which to map RUNCOM:
http://publibz.boulder.ibm.com/cgi-bin/ ... T#FIRSTHIT
The IBM LE RUNCOM block would allow you to determine whether or not your program is the main or a sub-program within IBM LE runcom unit.
4. We have an assembler routine that performs these TGT /RUNCOM analysis during COBOL applications run.
I hope my information helps somewhat.
Best.
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page