IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

regarding call verb


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 237
Location: USA

PostPosted: Thu Apr 15, 2004 11:35 am
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: 150
Location: Tokyo, Japan

PostPosted: Thu Apr 15, 2004 11:36 am
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: 150
Location: Tokyo, Japan

PostPosted: Thu Apr 15, 2004 11:38 am
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: 237
Location: USA

PostPosted: Thu Apr 15, 2004 11:40 am
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
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: 150
Location: Tokyo, Japan

PostPosted: Thu Apr 15, 2004 11:54 am
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
No new posts Batch call online program, EXCI task ... CICS 3
No new posts CSQBGET - Call giving completion code... COBOL Programming 3
No new posts CICS DPL call CICS 6
Search our Forums:

Back to Top