Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem during a CALL statement.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dunkinjonats

New User


Joined: 14 Aug 2008
Posts: 2
Location: Philippines

PostPosted: Wed Apr 22, 2009 6:04 pm    Post subject: Problem during a CALL statement.
Reply with quote

Hello,

I recently encountered a run time error in my CALL statement.
In my calling program i had 3 parameters that are passed but the called program was expecting that i have four parameters to be passed.

I was wondering if this kind of error could be caught during compilation/link phase...? Or is this is just one of those errors that we really need to watch out for since this could not be caught and only seen during run time?

Thanks.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 22, 2009 6:14 pm    Post subject:
Reply with quote

yes, you have to test.

unlike JAVA and C, where the GUI Dev will flag such things,
Mainframe COBOL does not have that capability.
Could be that PC based development tools for COBOL have that.

Though one could write a REXX Macro
to compare the USING List of the Procedure Division of the CALLed program
to the USING List of the CALL as you EDIT the module.

But then again,
with split-screen,
it is very easy to VIEW the CALLed module in another session,
and determine if the CALL you are coding is correct.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 22, 2009 6:29 pm    Post subject: Reply to: Problem during a CALL statement.
Reply with quote

You could change the parmlist, to include a "mask" (for example, a PIC X(08)), which is initialized to SPACES and then for each passed-parm, you would set the mask-position to a "Y", which indicates to the sub-program that this parm has been passed.

I'm using an 8-Byte mask only as an example, but it may be OK to keep it as it can be used for expansion if the number of parms ever grows in the future.

EG:

Code:

03  WS-PARM-MASK PIC  X(008).
03  WS-PARM-01   PIC  X(256).
03  WS-PARM-02   PIC  X(256).
03  WS-PARM-03   PIC  X(256).
03  WS-PARM-04   PIC  X(256).
03  WS-SUB-PGM   PIC  X(008) VALUE 'MYSUBPGM'.

* ONLY PASSING PARMS 01-03. POSITIONS 04-08 ARE SPACES.
MOVE 'YYY' TO WS-PARM-MASK.

CALL WS-SUB-PGM USING WS-PARM-MASK,
                      WS-PARM-01,
                      WS-PARM-02,
                      WS-PARM-03,
                      WS-PARM-04.


Although all four parms are in the the CALL USING, when the sub-program gains control, it will look at the parm-mask to determine which parms should be addressed.

Your sub-program LINKAGE SECTION, needs to be modified and the 8-Byte mask-parameter must be added. In addition, the parmlist in the PROCEDURE DIVISION USING must be changed to include the mask-parameter first, then followed by the four current parms.

HTH....

Regards,
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 6:30 pm    Post subject:
Reply with quote

IIRC, at runtime, you could check the address of each of the passed items and if low-values, it ain't there so don't access it.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 22, 2009 7:16 pm    Post subject: Reply to: Problem during a CALL statement.
Reply with quote

CICS Guy,

You rattled my brain and IIRC, you can "OMIT" parameters from a parmlist, either using the keyword "OMIT" or substituting a given parm with a comma.

Then the sub-program can check the ADDRESS OF each defined parm for NULL or NOT NULL.

And I'm sure this is documented somewhere in the applicable COBOL manual....

Regards,
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 7:33 pm    Post subject:
Reply with quote

Back in the "static" call days, I'd update common subroutines and use additional passed fields. To avoid problems with existing code, checking the newest added passed field for addressability, I'd get the routine to run correctly for all programs.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us