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
 

 

regarding call verb

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

New User


Joined: 08 Apr 2004
Posts: 25
Location: hyd

PostPosted: Thu Apr 15, 2004 9:22 am    Post subject: regarding call verb
Reply with quote

Hi,
suppose i've two programs like prog A is calling program and prog B is called program.
i've written CALL PROGRAM-ID USING PARM1,PRAM2
and i've also specified in called program as:
PROCEDURE DIVISION USING AA,BB

my doubt is , if initially im not sending any values from calling program to called program i.e. when calling program called the sub program intially.

that means it gives any error? if not ,what values will be passed to called program initially.
Back to top
View user's profile Send private message

mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 238
Location: USA

PostPosted: Thu Apr 15, 2004 11:35 am    Post subject:
Reply with quote

Hello kiran,

Quote:

if initially im not sending any values from calling program to called program


With this there are 2 options...

1) You have removed USING phrase
2) You are not passing ANYTHING in the variables.

In case of second option, if you are initializing the linkage section variables before using the calling program values, there will not be a problem as per the normal initialization rules.

Best way is to try out a simple calling & called program.

Calling Program

Code:

IDENTIFICATION DIVISION.                             
PROGRAM-ID.    MAIN-PRG.
DATE-COMPILED.                                       
ENVIRONMENT DIVISION.                               
DATA DIVISION.                                       
WORKING-STORAGE SECTION.                             
01 PASSED-DATA    PIC  X(05).

PROCEDURE DIVISION.                                 

    CALL "SUB-PRG" USING PASSED-DATA.

    MOVE SPACES TO PASSED-DATA.
    CALL "SUB-PRG" USING PASSED-DATA.

    MOVE 'KIRAN' TO PASSED-DATA.
    CALL "SUB-PRG" USING PASSED-DATA.

    GOBACK.                                         




Called Program

Code:

IDENTIFICATION DIVISION.                             
PROGRAM-ID.    SUB-PRG.
DATE-COMPILED.                                       
ENVIRONMENT DIVISION.                               
DATA DIVISION.                                       
WORKING-STORAGE SECTION.                             
01 WS-DATA    PIC  X(05) VALUE SPACES.

LINKAGE-SECTION.
01 RECEIVED-DATA  PIC  X(05).


PROCEDURE DIVISION USING RECEIVED-DATA.

   DISPLAY RECEIVED-DATA
   INITIALIZE WS-DATA
   MOVE RECEIVED-DATA TO WS-DATA
   DISPLAY WS-DATA
   GOBACK.                                         


I have not tried this code..so let us know the results.

Hope this helps,

Regards
Mayuresh Tendulkar
Back to top
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 151
Location: Tokyo, Japan

PostPosted: Thu Apr 15, 2004 11:36 am    Post subject:
Reply with quote

I think it will thrrow any error unless you want this. Initially the value passed from Program A to Program B depeneds on the structures of PARM1 and PARM2. Example if those are numeric the value passed will be 0 and if those are alphanumeric then SPACE.
Expert, please correct me if I am wrong.

Regards,
Sandip.
Back to top
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 151
Location: Tokyo, Japan

PostPosted: Thu Apr 15, 2004 11:38 am    Post subject:
Reply with quote

I am sorry about the first sentence. It should not throw any error messages.
Back to top
View user's profile Send private message
mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 238
Location: USA

PostPosted: Thu Apr 15, 2004 11:40 am    Post subject:
Reply with quote

Hello sandip,

Thats why i specified

Quote:
In case of second option, if you are initializing the linkage section variables before using the calling program values, there will not be a problem as per the normal initialization rules.


INITIALIZE verb will initialize the numeric items to ZERO to alphanumeric items to SPACES.

Hope this helps,

Regards
Mayuresh Tendulkar
Back to top
View user's profile Send private message
kiran

New User


Joined: 08 Apr 2004
Posts: 25
Location: hyd

PostPosted: Thu Apr 15, 2004 11:49 am    Post subject: regarding call verb
Reply with quote

mdtendulkar wrote:
Hello kiran,

Quote:

if initially im not sending any values from calling program to called program


With this there are 2 options...

1) You have removed USING phrase
2) You are not passing ANYTHING in the variables.

In case of second option, if you are initializing the linkage section variables before using the calling program values, there will not be a problem as per the normal initialization rules.

Best way is to try out a simple calling & called program.

Calling Program

Code:

IDENTIFICATION DIVISION.                             
PROGRAM-ID.    MAIN-PRG.
DATE-COMPILED.                                       
ENVIRONMENT DIVISION.                               
DATA DIVISION.                                       
WORKING-STORAGE SECTION.                             
01 PASSED-DATA    PIC  X(05).

PROCEDURE DIVISION.                                 

    CALL "SUB-PRG" USING PASSED-DATA.

    MOVE SPACES TO PASSED-DATA.
    CALL "SUB-PRG" USING PASSED-DATA.

    MOVE 'KIRAN' TO PASSED-DATA.
    CALL "SUB-PRG" USING PASSED-DATA.

    GOBACK.                                         




Called Program

Code:

IDENTIFICATION DIVISION.                             
PROGRAM-ID.    SUB-PRG.
DATE-COMPILED.                                       
ENVIRONMENT DIVISION.                               
DATA DIVISION.                                       
WORKING-STORAGE SECTION.                             
01 WS-DATA    PIC  X(05) VALUE SPACES.

LINKAGE-SECTION.
01 RECEIVED-DATA  PIC  X(05).


PROCEDURE DIVISION USING RECEIVED-DATA.

   DISPLAY RECEIVED-DATA
   INITIALIZE WS-DATA
   MOVE RECEIVED-DATA TO WS-DATA
   DISPLAY WS-DATA
   GOBACK.                                         


I have not tried this code..so let us know the results.

Hope this helps,

Regards
Mayuresh Tendulkar



Hi,
thanx for the reply. And I've one more doubt i.e. if suppose the sub program function is reading some file and passing the record of the file to the calling program.
in the sub program i've mentioned as

SELECT FILENAME ASSIGN TO DD1
ORGANIZATION .....
ACCESSMODE ....... .

then how to specify this DD1 in compile jcl and run jcl.

pls give me the example jcl's for both comiple and run jcls.
Back to top
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 151
Location: Tokyo, Japan

PostPosted: Thu Apr 15, 2004 11:54 am    Post subject:
Reply with quote

Hello Mayuresh,
It seems that we both have submitted the replies almost at at time. Beleive me...I didn't see that you have already replied.

hello kiran,

the ddname dd01 will not have anything special. you can just code -

//dd01 dd dsn=..........,disp=shr

Regards,
Sandip.
Back to top
View user's profile Send private message
sudha

New User


Joined: 16 Aug 2004
Posts: 7

PostPosted: Mon Aug 16, 2004 10:11 pm    Post subject:
Reply with quote

hi,

i think it will not give error. if you are passing numeric item then 0's will move to identifiers and if u r passing alphanumeric or alphabetic then spaces will be moved.
if my answer is wrong please suggest

thank you
bye
Back to top
View user's profile Send private message
sudha

New User


Joined: 16 Aug 2004
Posts: 7

PostPosted: Mon Aug 16, 2004 10:13 pm    Post subject:
Reply with quote

hi,

i think it will not give error. if you are passing numeric item then 0's will move to identifiers and if u r passing alphanumeric or alphabetic then spaces will be moved.
if my answer is wrong please suggest

thank you
bye
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Aug 18, 2004 9:15 am    Post subject:
Reply with quote

Sudha,

The best thing to do is add a 3rd param to indicate the type of CALL, e.g. initial (I), repetative (R), or final (F).

The CALLing pgm enters I R or F depending on circumstannces. The CALLed pgm should contain code to test the 3rd param and act accordingly.

Regards, Jack.
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 Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts Need help in triggering a PL1 module ... Varungv99 IMS DB/DC 0 Fri Apr 07, 2017 10:01 am
No new posts Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am


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