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
 

 

Number of parameters in Linkage

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

New User


Joined: 16 Mar 2006
Posts: 18

PostPosted: Wed Jan 27, 2016 5:13 pm    Post subject: Number of parameters in Linkage
Reply with quote

hello all,

i need to know wich parameter is last given, when the subprogram is called.

Program a
call 'subpgm' using a, b, c

Program b
call 'subpgm' using a, b

Program c
call 'subpgm' using a

subpgm
linkage
01 a PIC x(10).
01 b PIC x(07).
01 c PIC x(05).
procedure division using a, b, c.
.
.
.
goback

how can i know how much paramters has the
mainprogram given to the subprogram?

regards
kai
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Jan 27, 2016 5:36 pm    Post subject: Reply to: Number of parameters in Linkage
Reply with quote

Why do you want to know that?

The traditional way if there is a valid reason for a program to receive different numbers of parameters is to have something in the first item which indicates that. An IO-subroutine that knows from O(pen) and C(lose) that there is no record-area required, for instance.
Back to top
View user's profile Send private message
kregen

New User


Joined: 16 Mar 2006
Posts: 18

PostPosted: Wed Jan 27, 2016 5:53 pm    Post subject:
Reply with quote

hi Bill,
i want to check that the mainprogram has given the parameters that the subprogramm needed.

example
function open no other parameter needed
function close no other parameter needed
function insert one other parateer is needed
function update two other parameter are needed

when the parameter wasn't give then the modul crash. i don't like it.
i want to give the result 'Parameter is Missing'.

In REXX have i no Problem to do this.

regards
Kai
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Wed Jan 27, 2016 6:13 pm    Post subject:
Reply with quote

Are you saying that the sub-program actions the first parameter without first checking that any required subsequent parameter has been passed? If so, then do the proper thing and edit your parameters first BEFORE actioning. If necessary then have the calling program pass a parameter coiunt as the first parameter and move the other parameters down one (p1 becomes p2 etc).
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Jan 27, 2016 6:21 pm    Post subject: Reply to: Number of parameters in Linkage
Reply with quote

Well, COBOL isn't rexx.

It crashes or otherwise goes badly in testing. It gets fixed. Once it is fixed, there is nothing to worry about.

Once you are up-and-running, say that your subroutine is CALLed 100m times a day/week/month. You want to check each time that the correct number of parameters are used, even though it is only when there is a new use of the subroutine that could get the number of parameters wrong?

Whether you like it or not, matching the order and number of parameters on a CALL to the PROCEDURE DIVISION USING (or ENTRY USING) is down to the programmer.
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 CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
No new posts Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
No new posts Symbolic Parameters in SYSIN DD state... madishpa DFSORT/ICETOOL 3 Mon Jun 27, 2016 6:23 pm
No new posts Multiple parameters Csongor All Other Mainframe Topics 16 Thu Jun 09, 2016 7:54 pm


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