Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COBOL/400 LINKAGE SECTION

Status
Not open for further replies.

baruch

MIS
Mar 2, 2000
59
IL
Hi
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. DEMO.
000003 DATA DIVISION.
000004 WORKING-STORAGE SECTION.
000005 01 VAR-P USAGE POINTER.
000006 01 VAR-W PIC X(2).
000007 LINKAGE SECTION.
000008 01 VAR-L PIC X(2).
000009 PROCEDURE DIVISION USING VAR-L.
000010 MAIN1.
000011 SET VAR-P TO ADDRESS OF VAR-L.

How the program can know if some parmeter was sent by the calling program, or not.

When i type in the command line : "CALL DEMO 'ab' "
its end without any errores.
When i type: "CALL DEMO" i have an error:

Argument associated with external or internal parameter not passed.
Function check. MCH0801 unmonitored by .., at statement 11,

thx

Barry

 
Have you tried something like this ?
IF ADDRESS OF VAR-L = NULL

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I'm using ACU Cobol on Windows, and in my case, if I try to do [bold]anything[/bold] on a linkage item that was not passed down, the runtime crashes unceremoniously, and tells me that I tried to access a variable that was not sent by the calling pgm.

They do provide, however, an API that I can call to see how many vars were passed down from the parent pgm: C$NARG. If the number matches the number of vars I'm expecting, then I know all's well (although I can't tell if the size, type, and order of the fields is exactly what I'm expecting...)

Check if your particular compiler offers something like this.

.DaviD.
 
Barry,

It looks like the runtime is intercepting the problem, before any code you may put into the called program could do anything about it.
 
First thx to all that tried to help.
in rm/cobol or mf/cobol both in unix/pc its simple,
the independend/calling program gives power to run the code once direct with dilog box & to run at batch mode with default parmeters.
such a common task should have also at as/4000 eviroment.

here a sample at rm/cobol:
....
WORKING-STORAGE SECTION.
01 CUSTOMER-N-X.
02 CUSTOMER-N PIC 9(6) VALUE 0.
LINKAGE SECTION.
01 EXTR-PARAM.
02 PARAM-LENGTH PIC 9(4) BINARY.
02 LINKAGE-REC.
03 FILLER PIC X(1) OCCURS 1 TO 6
DEPENDING ON PARAM-LENGTH.
PROCEDURE DIVISION USING EXTR-PARAM.
MAIN SECTION.
0. IF PARAM-LENGTH > 0 MOVE LINKAGE-REC TO CUSTOMER-N-X.

AT MF/COBOL:
WORKING-STORAGE SECTION.
01 X PIC X(64) VALUE SPACES.
01 INP-SCREEN.
02 ....
PROCEDURE DIVISION.
MAIN SECTION.
ACCEPT X FROM COMMAND-LINE.
IF X = SPACES PERFORM INPUT-SCREEN THRU EX-INPUT-SCREEN
ELSE MOVE X TO INP-SCREEN.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top